opj_bio_create:
  114|   251M|{
  115|   251M|    opj_bio_t *bio = (opj_bio_t*)opj_malloc(sizeof(opj_bio_t));
  116|   251M|    return bio;
  117|   251M|}
opj_bio_destroy:
  120|   251M|{
  121|   251M|    if (bio) {
  ------------------
  |  Branch (121:9): [True: 251M, False: 0]
  ------------------
  122|   251M|        opj_free(bio);
  123|   251M|    }
  124|   251M|}
opj_bio_numbytes:
  127|   251M|{
  128|   251M|    return (bio->bp - bio->start);
  129|   251M|}
opj_bio_init_dec:
  141|   251M|{
  142|   251M|    bio->start = bp;
  143|   251M|    bio->end = bp + len;
  144|   251M|    bio->bp = bp;
  145|   251M|    bio->buf = 0;
  146|   251M|    bio->ct = 0;
  147|   251M|}
opj_bio_read:
  170|   255M|{
  171|   255M|    OPJ_INT32 i;
  172|   255M|    OPJ_UINT32 v;
  173|       |
  174|   255M|    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|   255M|    v = 0U;
  182|   514M|    for (i = (OPJ_INT32)n - 1; i >= 0; i--) {
  ------------------
  |  Branch (182:32): [True: 259M, False: 255M]
  ------------------
  183|   259M|        v |= opj_bio_getbit(bio) <<
  184|   259M|             i; /* can't overflow, opj_bio_getbit returns 0 or 1 */
  185|   259M|    }
  186|   255M|    return v;
  187|   255M|}
opj_bio_inalign:
  203|   251M|{
  204|   251M|    if ((bio->buf & 0xff) == 0xff) {
  ------------------
  |  Branch (204:9): [True: 20.2k, False: 251M]
  ------------------
  205|  20.2k|        if (! opj_bio_bytein(bio)) {
  ------------------
  |  Branch (205:13): [True: 4, False: 20.2k]
  ------------------
  206|      4|            return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
  207|      4|        }
  208|  20.2k|    }
  209|   251M|    bio->ct = 0;
  210|   251M|    return OPJ_TRUE;
  ------------------
  |  |  117|   251M|#define OPJ_TRUE 1
  ------------------
  211|   251M|}
bio.c:opj_bio_getbit:
   98|   259M|{
   99|   259M|    if (bio->ct == 0) {
  ------------------
  |  Branch (99:9): [True: 252M, False: 6.88M]
  ------------------
  100|   252M|        opj_bio_bytein(
  101|   252M|            bio); /* MSD: why not check the return value of this function ? */
  102|   252M|    }
  103|   259M|    bio->ct--;
  104|   259M|    return (bio->buf >> bio->ct) & 1;
  105|   259M|}
bio.c:opj_bio_bytein:
   87|   252M|{
   88|   252M|    bio->buf = (bio->buf << 8) & 0xffff;
   89|   252M|    bio->ct = bio->buf == 0xff00 ? 7 : 8;
  ------------------
  |  Branch (89:15): [True: 298k, False: 251M]
  ------------------
   90|   252M|    if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) {
  ------------------
  |  Branch (90:9): [True: 250M, False: 1.39M]
  ------------------
   91|   250M|        return OPJ_FALSE;
  ------------------
  |  |  118|   250M|#define OPJ_FALSE 0
  ------------------
   92|   250M|    }
   93|  1.39M|    bio->buf |= *bio->bp++;
   94|  1.39M|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.39M|#define OPJ_TRUE 1
  ------------------
   95|   252M|}

opj_read_bytes_LE:
   84|  3.70M|{
   85|  3.70M|    OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value) + p_nb_bytes - 1;
   86|  3.70M|    OPJ_UINT32 i;
   87|       |
   88|  3.70M|    assert(p_nb_bytes > 0 && p_nb_bytes <= sizeof(OPJ_UINT32));
   89|       |
   90|  3.70M|    *p_value = 0;
   91|  11.8M|    for (i = 0; i < p_nb_bytes; ++i) {
  ------------------
  |  Branch (91:17): [True: 8.14M, False: 3.70M]
  ------------------
   92|  8.14M|        *(l_data_ptr--) = *(p_buffer++);
   93|  8.14M|    }
   94|  3.70M|}
opj_stream_create:
  160|  9.22k|{
  161|  9.22k|    opj_stream_private_t * l_stream = 00;
  162|  9.22k|    l_stream = (opj_stream_private_t*) opj_calloc(1, sizeof(opj_stream_private_t));
  163|  9.22k|    if (! l_stream) {
  ------------------
  |  Branch (163:9): [True: 0, False: 9.22k]
  ------------------
  164|      0|        return 00;
  165|      0|    }
  166|       |
  167|  9.22k|    l_stream->m_buffer_size = p_buffer_size;
  168|  9.22k|    l_stream->m_stored_data = (OPJ_BYTE *) opj_malloc(p_buffer_size);
  169|  9.22k|    if (! l_stream->m_stored_data) {
  ------------------
  |  Branch (169:9): [True: 0, False: 9.22k]
  ------------------
  170|      0|        opj_free(l_stream);
  171|      0|        return 00;
  172|      0|    }
  173|       |
  174|  9.22k|    l_stream->m_current_data = l_stream->m_stored_data;
  175|       |
  176|  9.22k|    if (l_is_input) {
  ------------------
  |  Branch (176:9): [True: 9.22k, False: 0]
  ------------------
  177|  9.22k|        l_stream->m_status |= OPJ_STREAM_STATUS_INPUT;
  ------------------
  |  |   74|  9.22k|#define OPJ_STREAM_STATUS_INPUT   0x2U
  ------------------
  178|  9.22k|        l_stream->m_opj_skip = opj_stream_read_skip;
  179|  9.22k|        l_stream->m_opj_seek = opj_stream_read_seek;
  180|  9.22k|    } 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|  9.22k|    l_stream->m_read_fn = opj_stream_default_read;
  187|  9.22k|    l_stream->m_write_fn = opj_stream_default_write;
  188|  9.22k|    l_stream->m_skip_fn = opj_stream_default_skip;
  189|  9.22k|    l_stream->m_seek_fn = opj_stream_default_seek;
  190|       |
  191|  9.22k|    return (opj_stream_t *) l_stream;
  192|  9.22k|}
opj_stream_destroy:
  200|  9.22k|{
  201|  9.22k|    opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  202|       |
  203|  9.22k|    if (l_stream) {
  ------------------
  |  Branch (203:9): [True: 9.22k, False: 0]
  ------------------
  204|  9.22k|        if (l_stream->m_free_user_data_fn) {
  ------------------
  |  Branch (204:13): [True: 0, False: 9.22k]
  ------------------
  205|      0|            l_stream->m_free_user_data_fn(l_stream->m_user_data);
  206|      0|        }
  207|  9.22k|        opj_free(l_stream->m_stored_data);
  208|  9.22k|        l_stream->m_stored_data = 00;
  209|  9.22k|        opj_free(l_stream);
  210|  9.22k|    }
  211|  9.22k|}
opj_stream_set_read_function:
  215|  9.22k|{
  216|  9.22k|    opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  217|       |
  218|  9.22k|    if ((!l_stream) || (!(l_stream->m_status & OPJ_STREAM_STATUS_INPUT))) {
  ------------------
  |  |   74|  9.22k|#define OPJ_STREAM_STATUS_INPUT   0x2U
  ------------------
  |  Branch (218:9): [True: 0, False: 9.22k]
  |  Branch (218:24): [True: 0, False: 9.22k]
  ------------------
  219|      0|        return;
  220|      0|    }
  221|       |
  222|  9.22k|    l_stream->m_read_fn = p_function;
  223|  9.22k|}
opj_stream_set_seek_function:
  227|  9.22k|{
  228|  9.22k|    opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  229|       |
  230|  9.22k|    if (!l_stream) {
  ------------------
  |  Branch (230:9): [True: 0, False: 9.22k]
  ------------------
  231|      0|        return;
  232|      0|    }
  233|  9.22k|    l_stream->m_seek_fn = p_function;
  234|  9.22k|}
opj_stream_set_skip_function:
  250|  9.22k|{
  251|  9.22k|    opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  252|       |
  253|  9.22k|    if (! l_stream) {
  ------------------
  |  Branch (253:9): [True: 0, False: 9.22k]
  ------------------
  254|      0|        return;
  255|      0|    }
  256|       |
  257|  9.22k|    l_stream->m_skip_fn = p_function;
  258|  9.22k|}
opj_stream_set_user_data:
  262|  9.22k|{
  263|  9.22k|    opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  264|  9.22k|    if (!l_stream) {
  ------------------
  |  Branch (264:9): [True: 0, False: 9.22k]
  ------------------
  265|      0|        return;
  266|      0|    }
  267|  9.22k|    l_stream->m_user_data = p_data;
  268|  9.22k|    l_stream->m_free_user_data_fn = p_function;
  269|  9.22k|}
opj_stream_set_user_data_length:
  273|  9.22k|{
  274|  9.22k|    opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  275|  9.22k|    if (!l_stream) {
  ------------------
  |  Branch (275:9): [True: 0, False: 9.22k]
  ------------------
  276|      0|        return;
  277|      0|    }
  278|  9.22k|    l_stream->m_user_data_length = data_length;
  279|  9.22k|}
opj_stream_read_data:
  283|  2.31M|{
  284|  2.31M|    OPJ_SIZE_T l_read_nb_bytes = 0;
  285|  2.31M|    if (p_stream->m_bytes_in_buffer >= p_size) {
  ------------------
  |  Branch (285:9): [True: 2.28M, False: 23.6k]
  ------------------
  286|  2.28M|        memcpy(p_buffer, p_stream->m_current_data, p_size);
  287|  2.28M|        p_stream->m_current_data += p_size;
  288|  2.28M|        p_stream->m_bytes_in_buffer -= p_size;
  289|  2.28M|        l_read_nb_bytes += p_size;
  290|  2.28M|        p_stream->m_byte_offset += (OPJ_OFF_T)p_size;
  291|  2.28M|        return l_read_nb_bytes;
  292|  2.28M|    }
  293|       |
  294|       |    /* we are now in the case when the remaining data if not sufficient */
  295|  23.6k|    if (p_stream->m_status & OPJ_STREAM_STATUS_END) {
  ------------------
  |  |   75|  23.6k|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  |  Branch (295:9): [True: 213, False: 23.4k]
  ------------------
  296|    213|        l_read_nb_bytes += p_stream->m_bytes_in_buffer;
  297|    213|        memcpy(p_buffer, p_stream->m_current_data, p_stream->m_bytes_in_buffer);
  298|    213|        p_stream->m_current_data += p_stream->m_bytes_in_buffer;
  299|    213|        p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  300|    213|        p_stream->m_bytes_in_buffer = 0;
  301|    213|        return l_read_nb_bytes ? l_read_nb_bytes : (OPJ_SIZE_T) - 1;
  ------------------
  |  Branch (301:16): [True: 0, False: 213]
  ------------------
  302|    213|    }
  303|       |
  304|       |    /* the flag is not set, we copy data and then do an actual read on the stream */
  305|  23.4k|    if (p_stream->m_bytes_in_buffer) {
  ------------------
  |  Branch (305:9): [True: 3.95k, False: 19.4k]
  ------------------
  306|  3.95k|        l_read_nb_bytes += p_stream->m_bytes_in_buffer;
  307|  3.95k|        memcpy(p_buffer, p_stream->m_current_data, p_stream->m_bytes_in_buffer);
  308|  3.95k|        p_stream->m_current_data = p_stream->m_stored_data;
  309|  3.95k|        p_buffer += p_stream->m_bytes_in_buffer;
  310|  3.95k|        p_size -= p_stream->m_bytes_in_buffer;
  311|  3.95k|        p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  312|  3.95k|        p_stream->m_bytes_in_buffer = 0;
  313|  19.4k|    } 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|  19.4k|        p_stream->m_current_data = p_stream->m_stored_data;
  318|  19.4k|    }
  319|       |
  320|  23.6k|    for (;;) {
  321|       |        /* we should read less than a chunk -> read a chunk */
  322|  23.6k|        if (p_size < p_stream->m_buffer_size) {
  ------------------
  |  Branch (322:13): [True: 22.7k, False: 861]
  ------------------
  323|       |            /* we should do an actual read on the media */
  324|  22.7k|            p_stream->m_bytes_in_buffer = p_stream->m_read_fn(p_stream->m_stored_data,
  325|  22.7k|                                          p_stream->m_buffer_size, p_stream->m_user_data);
  326|       |
  327|  22.7k|            if (p_stream->m_bytes_in_buffer == (OPJ_SIZE_T) - 1) {
  ------------------
  |  Branch (327:17): [True: 7.08k, False: 15.7k]
  ------------------
  328|       |                /* end of stream */
  329|  7.08k|                opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
  ------------------
  |  |   68|  7.08k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
  330|       |
  331|  7.08k|                p_stream->m_bytes_in_buffer = 0;
  332|  7.08k|                p_stream->m_status |= OPJ_STREAM_STATUS_END;
  ------------------
  |  |   75|  7.08k|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  333|       |                /* end of stream */
  334|  7.08k|                return l_read_nb_bytes ? l_read_nb_bytes : (OPJ_SIZE_T) - 1;
  ------------------
  |  Branch (334:24): [True: 555, False: 6.52k]
  ------------------
  335|  15.7k|            } else if (p_stream->m_bytes_in_buffer < p_size) {
  ------------------
  |  Branch (335:24): [True: 191, False: 15.5k]
  ------------------
  336|       |                /* not enough data */
  337|    191|                l_read_nb_bytes += p_stream->m_bytes_in_buffer;
  338|    191|                memcpy(p_buffer, p_stream->m_current_data, p_stream->m_bytes_in_buffer);
  339|    191|                p_stream->m_current_data = p_stream->m_stored_data;
  340|    191|                p_buffer += p_stream->m_bytes_in_buffer;
  341|    191|                p_size -= p_stream->m_bytes_in_buffer;
  342|    191|                p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  343|    191|                p_stream->m_bytes_in_buffer = 0;
  344|  15.5k|            } else {
  345|  15.5k|                l_read_nb_bytes += p_size;
  346|  15.5k|                memcpy(p_buffer, p_stream->m_current_data, p_size);
  347|  15.5k|                p_stream->m_current_data += p_size;
  348|  15.5k|                p_stream->m_bytes_in_buffer -= p_size;
  349|  15.5k|                p_stream->m_byte_offset += (OPJ_OFF_T)p_size;
  350|  15.5k|                return l_read_nb_bytes;
  351|  15.5k|            }
  352|  22.7k|        } else {
  353|       |            /* direct read on the dest buffer */
  354|    861|            p_stream->m_bytes_in_buffer = p_stream->m_read_fn(p_buffer, p_size,
  355|    861|                                          p_stream->m_user_data);
  356|       |
  357|    861|            if (p_stream->m_bytes_in_buffer == (OPJ_SIZE_T) - 1) {
  ------------------
  |  Branch (357:17): [True: 67, False: 794]
  ------------------
  358|       |                /*  end of stream */
  359|     67|                opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
  ------------------
  |  |   68|     67|#define EVT_INFO    4   /**< Debug event type */
  ------------------
  360|       |
  361|     67|                p_stream->m_bytes_in_buffer = 0;
  362|     67|                p_stream->m_status |= OPJ_STREAM_STATUS_END;
  ------------------
  |  |   75|     67|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  363|       |                /* end of stream */
  364|     67|                return l_read_nb_bytes ? l_read_nb_bytes : (OPJ_SIZE_T) - 1;
  ------------------
  |  Branch (364:24): [True: 52, False: 15]
  ------------------
  365|    794|            } else if (p_stream->m_bytes_in_buffer < p_size) {
  ------------------
  |  Branch (365:24): [True: 26, False: 768]
  ------------------
  366|       |                /* not enough data */
  367|     26|                l_read_nb_bytes += p_stream->m_bytes_in_buffer;
  368|     26|                p_stream->m_current_data = p_stream->m_stored_data;
  369|     26|                p_buffer += p_stream->m_bytes_in_buffer;
  370|     26|                p_size -= p_stream->m_bytes_in_buffer;
  371|     26|                p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  372|     26|                p_stream->m_bytes_in_buffer = 0;
  373|    768|            } else {
  374|       |                /* we have read the exact size */
  375|    768|                l_read_nb_bytes += p_stream->m_bytes_in_buffer;
  376|    768|                p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  377|    768|                p_stream->m_current_data = p_stream->m_stored_data;
  378|    768|                p_stream->m_bytes_in_buffer = 0;
  379|    768|                return l_read_nb_bytes;
  380|    768|            }
  381|    861|        }
  382|  23.6k|    }
  383|  23.4k|}
opj_stream_read_skip:
  465|  6.26k|{
  466|  6.26k|    OPJ_OFF_T l_skip_nb_bytes = 0;
  467|  6.26k|    OPJ_OFF_T l_current_skip_nb_bytes = 0;
  468|       |
  469|  6.26k|    assert(p_size >= 0);
  470|       |
  471|  6.26k|    if (p_stream->m_bytes_in_buffer >= (OPJ_SIZE_T)p_size) {
  ------------------
  |  Branch (471:9): [True: 5.61k, False: 648]
  ------------------
  472|  5.61k|        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|  5.61k|        p_stream->m_bytes_in_buffer -= (OPJ_SIZE_T)p_size;
  476|  5.61k|        l_skip_nb_bytes += p_size;
  477|  5.61k|        p_stream->m_byte_offset += l_skip_nb_bytes;
  478|  5.61k|        return l_skip_nb_bytes;
  479|  5.61k|    }
  480|       |
  481|       |    /* we are now in the case when the remaining data if not sufficient */
  482|    648|    if (p_stream->m_status & OPJ_STREAM_STATUS_END) {
  ------------------
  |  |   75|    648|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  |  Branch (482:9): [True: 0, False: 648]
  ------------------
  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|    648|    if (p_stream->m_bytes_in_buffer) {
  ------------------
  |  Branch (491:9): [True: 615, False: 33]
  ------------------
  492|    615|        l_skip_nb_bytes += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  493|    615|        p_stream->m_current_data = p_stream->m_stored_data;
  494|    615|        p_size -= (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
  495|    615|        p_stream->m_bytes_in_buffer = 0;
  496|    615|    }
  497|       |
  498|    835|    while (p_size > 0) {
  ------------------
  |  Branch (498:12): [True: 648, False: 187]
  ------------------
  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|    648|        if ((OPJ_UINT64)(p_stream->m_byte_offset + l_skip_nb_bytes + p_size) >
  ------------------
  |  Branch (503:13): [True: 461, False: 187]
  ------------------
  504|    648|                p_stream->m_user_data_length) {
  505|    461|            opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
  ------------------
  |  |   68|    461|#define EVT_INFO    4   /**< Debug event type */
  ------------------
  506|       |
  507|    461|            p_stream->m_byte_offset += l_skip_nb_bytes;
  508|    461|            l_skip_nb_bytes = (OPJ_OFF_T)(p_stream->m_user_data_length -
  509|    461|                                          (OPJ_UINT64)p_stream->m_byte_offset);
  510|       |
  511|    461|            opj_stream_read_seek(p_stream, (OPJ_OFF_T)p_stream->m_user_data_length,
  512|    461|                                 p_event_mgr);
  513|    461|            p_stream->m_status |= OPJ_STREAM_STATUS_END;
  ------------------
  |  |   75|    461|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  514|       |
  515|       |            /* end if stream */
  516|    461|            return l_skip_nb_bytes ? l_skip_nb_bytes : (OPJ_OFF_T) - 1;
  ------------------
  |  Branch (516:20): [True: 51, False: 410]
  ------------------
  517|    461|        }
  518|       |
  519|       |        /* we should do an actual skip on the media */
  520|    187|        l_current_skip_nb_bytes = p_stream->m_skip_fn(p_size, p_stream->m_user_data);
  521|    187|        if (l_current_skip_nb_bytes == (OPJ_OFF_T) - 1) {
  ------------------
  |  Branch (521:13): [True: 0, False: 187]
  ------------------
  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|    187|        p_size -= l_current_skip_nb_bytes;
  530|    187|        l_skip_nb_bytes += l_current_skip_nb_bytes;
  531|    187|    }
  532|       |
  533|    187|    p_stream->m_byte_offset += l_skip_nb_bytes;
  534|       |
  535|    187|    return l_skip_nb_bytes;
  536|    648|}
opj_stream_tell:
  580|   220k|{
  581|   220k|    return p_stream->m_byte_offset;
  582|   220k|}
opj_stream_get_number_byte_left:
  585|  84.3k|{
  586|  84.3k|    assert(p_stream->m_byte_offset >= 0);
  587|  84.3k|    assert(p_stream->m_user_data_length >= (OPJ_UINT64)p_stream->m_byte_offset);
  588|  84.3k|    return p_stream->m_user_data_length ?
  ------------------
  |  Branch (588:12): [True: 84.3k, False: 0]
  ------------------
  589|  84.3k|           (OPJ_OFF_T)(p_stream->m_user_data_length) - p_stream->m_byte_offset :
  590|  84.3k|           0;
  591|  84.3k|}
opj_stream_skip:
  595|  6.26k|{
  596|  6.26k|    assert(p_size >= 0);
  597|  6.26k|    return p_stream->m_opj_skip(p_stream, p_size, p_event_mgr);
  598|  6.26k|}
opj_stream_read_seek:
  602|  1.49k|{
  603|  1.49k|    OPJ_ARG_NOT_USED(p_event_mgr);
  ------------------
  |  |  142|  1.49k|#define OPJ_ARG_NOT_USED(x) (void)(x)
  ------------------
  604|  1.49k|    p_stream->m_current_data = p_stream->m_stored_data;
  605|  1.49k|    p_stream->m_bytes_in_buffer = 0;
  606|       |
  607|  1.49k|    if (!(p_stream->m_seek_fn(p_size, p_stream->m_user_data))) {
  ------------------
  |  Branch (607:9): [True: 0, False: 1.49k]
  ------------------
  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|  1.49k|    } else {
  611|       |        /* reset stream status */
  612|  1.49k|        p_stream->m_status &= (~OPJ_STREAM_STATUS_END);
  ------------------
  |  |   75|  1.49k|#define OPJ_STREAM_STATUS_END     0x4U
  ------------------
  613|  1.49k|        p_stream->m_byte_offset = p_size;
  614|       |
  615|  1.49k|    }
  616|       |
  617|  1.49k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.49k|#define OPJ_TRUE 1
  ------------------
  618|  1.49k|}
opj_stream_seek:
  643|  1.03k|{
  644|  1.03k|    assert(p_size >= 0);
  645|  1.03k|    return p_stream->m_opj_seek(p_stream, p_size, p_event_mgr);
  646|  1.03k|}
opj_stream_has_seek:
  649|  1.04k|{
  650|  1.04k|    return p_stream->m_seek_fn != opj_stream_default_seek;
  651|  1.04k|}

opj_dwt_decode:
 1915|  13.3k|{
 1916|  13.3k|    if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (1916:9): [True: 1.89k, False: 11.4k]
  ------------------
 1917|  1.89k|        return opj_dwt_decode_tile(p_tcd->thread_pool, tilec, numres);
 1918|  11.4k|    } else {
 1919|  11.4k|        return opj_dwt_decode_partial_tile(tilec, numres);
 1920|  11.4k|    }
 1921|  13.3k|}
opj_dwt_decode_real:
 3761|  9.10k|{
 3762|  9.10k|    if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (3762:9): [True: 3.72k, False: 5.37k]
  ------------------
 3763|  3.72k|        return opj_dwt_decode_tile_97(p_tcd->thread_pool, tilec, numres);
 3764|  5.37k|    } else {
 3765|  5.37k|        return opj_dwt_decode_partial_97(tilec, numres);
 3766|  5.37k|    }
 3767|  9.10k|}
dwt.c:opj_dwt_max_resolution:
 1995|  10.1k|{
 1996|  10.1k|    OPJ_UINT32 mr   = 0;
 1997|  10.1k|    OPJ_UINT32 w;
 1998|  96.1k|    while (--i) {
  ------------------
  |  Branch (1998:12): [True: 85.9k, False: 10.1k]
  ------------------
 1999|  85.9k|        ++r;
 2000|  85.9k|        if (mr < (w = (OPJ_UINT32)(r->x1 - r->x0))) {
  ------------------
  |  Branch (2000:13): [True: 34.3k, False: 51.6k]
  ------------------
 2001|  34.3k|            mr = w ;
 2002|  34.3k|        }
 2003|  85.9k|        if (mr < (w = (OPJ_UINT32)(r->y1 - r->y0))) {
  ------------------
  |  Branch (2003:13): [True: 20.0k, False: 65.9k]
  ------------------
 2004|  20.0k|            mr = w ;
 2005|  20.0k|        }
 2006|  85.9k|    }
 2007|  10.1k|    return mr ;
 2008|  10.1k|}
dwt.c:opj_dwt_decode_tile:
 2069|  1.89k|{
 2070|  1.89k|    opj_dwt_t h;
 2071|  1.89k|    opj_dwt_t v;
 2072|       |
 2073|  1.89k|    opj_tcd_resolution_t* tr = tilec->resolutions;
 2074|       |
 2075|  1.89k|    OPJ_UINT32 rw = (OPJ_UINT32)(tr->x1 -
 2076|  1.89k|                                 tr->x0);  /* width of the resolution level computed */
 2077|  1.89k|    OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 -
 2078|  1.89k|                                 tr->y0);  /* height of the resolution level computed */
 2079|       |
 2080|  1.89k|    OPJ_UINT32 w = (OPJ_UINT32)(tilec->resolutions[tilec->minimum_num_resolutions -
 2081|  1.89k|                                                               1].x1 -
 2082|  1.89k|                                tilec->resolutions[tilec->minimum_num_resolutions - 1].x0);
 2083|  1.89k|    OPJ_SIZE_T h_mem_size;
 2084|  1.89k|    int num_threads;
 2085|       |
 2086|  1.89k|    if (numres == 1U) {
  ------------------
  |  Branch (2086:9): [True: 293, False: 1.60k]
  ------------------
 2087|    293|        return OPJ_TRUE;
  ------------------
  |  |  117|    293|#define OPJ_TRUE 1
  ------------------
 2088|    293|    }
 2089|  1.60k|    num_threads = opj_thread_pool_get_thread_count(tp);
 2090|  1.60k|    h_mem_size = opj_dwt_max_resolution(tr, numres);
 2091|       |    /* overflow check */
 2092|  1.60k|    if (h_mem_size > (SIZE_MAX / PARALLEL_COLS_53 / sizeof(OPJ_INT32))) {
  ------------------
  |  |   78|  1.60k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   74|  1.60k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
  |  Branch (2092:9): [True: 0, False: 1.60k]
  ------------------
 2093|       |        /* FIXME event manager error callback */
 2094|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2095|      0|    }
 2096|       |    /* We need PARALLEL_COLS_53 times the height of the array, */
 2097|       |    /* since for the vertical pass */
 2098|       |    /* we process PARALLEL_COLS_53 columns at a time */
 2099|  1.60k|    h_mem_size *= PARALLEL_COLS_53 * sizeof(OPJ_INT32);
  ------------------
  |  |   78|  1.60k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   74|  1.60k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
 2100|  1.60k|    h.mem = (OPJ_INT32*)opj_aligned_32_malloc(h_mem_size);
 2101|  1.60k|    if (! h.mem) {
  ------------------
  |  Branch (2101:9): [True: 0, False: 1.60k]
  ------------------
 2102|       |        /* FIXME event manager error callback */
 2103|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2104|      0|    }
 2105|       |
 2106|  1.60k|    v.mem = h.mem;
 2107|       |
 2108|  16.7k|    while (--numres) {
  ------------------
  |  Branch (2108:12): [True: 15.1k, False: 1.60k]
  ------------------
 2109|  15.1k|        OPJ_INT32 * OPJ_RESTRICT tiledp = tilec->data;
 2110|  15.1k|        OPJ_UINT32 j;
 2111|       |
 2112|  15.1k|        ++tr;
 2113|  15.1k|        h.sn = (OPJ_INT32)rw;
 2114|  15.1k|        v.sn = (OPJ_INT32)rh;
 2115|       |
 2116|  15.1k|        rw = (OPJ_UINT32)(tr->x1 - tr->x0);
 2117|  15.1k|        rh = (OPJ_UINT32)(tr->y1 - tr->y0);
 2118|       |
 2119|  15.1k|        h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
 2120|  15.1k|        h.cas = tr->x0 % 2;
 2121|       |
 2122|  15.1k|        if (num_threads <= 1 || rh <= 1) {
  ------------------
  |  Branch (2122:13): [True: 15.1k, False: 0]
  |  Branch (2122:33): [True: 0, False: 0]
  ------------------
 2123|   179k|            for (j = 0; j < rh; ++j) {
  ------------------
  |  Branch (2123:25): [True: 164k, False: 15.1k]
  ------------------
 2124|   164k|                opj_idwt53_h(&h, &tiledp[(OPJ_SIZE_T)j * w]);
 2125|   164k|            }
 2126|  15.1k|        } else {
 2127|      0|            OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
 2128|      0|            OPJ_UINT32 step_j;
 2129|       |
 2130|      0|            if (rh < num_jobs) {
  ------------------
  |  Branch (2130:17): [True: 0, False: 0]
  ------------------
 2131|      0|                num_jobs = rh;
 2132|      0|            }
 2133|      0|            step_j = (rh / num_jobs);
 2134|       |
 2135|      0|            for (j = 0; j < num_jobs; j++) {
  ------------------
  |  Branch (2135:25): [True: 0, False: 0]
  ------------------
 2136|      0|                opj_dwt_decode_h_job_t* job;
 2137|       |
 2138|      0|                job = (opj_dwt_decode_h_job_t*) opj_malloc(sizeof(opj_dwt_decode_h_job_t));
 2139|      0|                if (!job) {
  ------------------
  |  Branch (2139:21): [True: 0, False: 0]
  ------------------
 2140|       |                    /* It would be nice to fallback to single thread case, but */
 2141|       |                    /* unfortunately some jobs may be launched and have modified */
 2142|       |                    /* tiledp, so it is not practical to recover from that error */
 2143|       |                    /* FIXME event manager error callback */
 2144|      0|                    opj_thread_pool_wait_completion(tp, 0);
 2145|      0|                    opj_aligned_free(h.mem);
 2146|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2147|      0|                }
 2148|      0|                job->h = h;
 2149|      0|                job->rw = rw;
 2150|      0|                job->w = w;
 2151|      0|                job->tiledp = tiledp;
 2152|      0|                job->min_j = j * step_j;
 2153|      0|                job->max_j = (j + 1U) * step_j; /* this can overflow */
 2154|      0|                if (j == (num_jobs - 1U)) {  /* this will take care of the overflow */
  ------------------
  |  Branch (2154:21): [True: 0, False: 0]
  ------------------
 2155|      0|                    job->max_j = rh;
 2156|      0|                }
 2157|      0|                job->h.mem = (OPJ_INT32*)opj_aligned_32_malloc(h_mem_size);
 2158|      0|                if (!job->h.mem) {
  ------------------
  |  Branch (2158:21): [True: 0, False: 0]
  ------------------
 2159|       |                    /* FIXME event manager error callback */
 2160|      0|                    opj_thread_pool_wait_completion(tp, 0);
 2161|      0|                    opj_free(job);
 2162|      0|                    opj_aligned_free(h.mem);
 2163|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2164|      0|                }
 2165|      0|                opj_thread_pool_submit_job(tp, opj_dwt_decode_h_func, job);
 2166|      0|            }
 2167|      0|            opj_thread_pool_wait_completion(tp, 0);
 2168|      0|        }
 2169|       |
 2170|  15.1k|        v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
 2171|  15.1k|        v.cas = tr->y0 % 2;
 2172|       |
 2173|  15.1k|        if (num_threads <= 1 || rw <= 1) {
  ------------------
  |  Branch (2173:13): [True: 15.1k, False: 0]
  |  Branch (2173:33): [True: 0, False: 0]
  ------------------
 2174|  26.0k|            for (j = 0; j + PARALLEL_COLS_53 <= rw;
  ------------------
  |  |   78|  26.0k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   74|  26.0k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
  |  Branch (2174:25): [True: 10.9k, False: 15.1k]
  ------------------
 2175|  15.1k|                    j += PARALLEL_COLS_53) {
  ------------------
  |  |   78|  10.9k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   74|  10.9k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
 2176|  10.9k|                opj_idwt53_v(&v, &tiledp[j], (OPJ_SIZE_T)w, PARALLEL_COLS_53);
  ------------------
  |  |   78|  10.9k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   74|  10.9k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
 2177|  10.9k|            }
 2178|  15.1k|            if (j < rw) {
  ------------------
  |  Branch (2178:17): [True: 7.42k, False: 7.71k]
  ------------------
 2179|  7.42k|                opj_idwt53_v(&v, &tiledp[j], (OPJ_SIZE_T)w, (OPJ_INT32)(rw - j));
 2180|  7.42k|            }
 2181|  15.1k|        } else {
 2182|      0|            OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
 2183|      0|            OPJ_UINT32 step_j;
 2184|       |
 2185|      0|            if (rw < num_jobs) {
  ------------------
  |  Branch (2185:17): [True: 0, False: 0]
  ------------------
 2186|      0|                num_jobs = rw;
 2187|      0|            }
 2188|      0|            step_j = (rw / num_jobs);
 2189|       |
 2190|      0|            for (j = 0; j < num_jobs; j++) {
  ------------------
  |  Branch (2190:25): [True: 0, False: 0]
  ------------------
 2191|      0|                opj_dwt_decode_v_job_t* job;
 2192|       |
 2193|      0|                job = (opj_dwt_decode_v_job_t*) opj_malloc(sizeof(opj_dwt_decode_v_job_t));
 2194|      0|                if (!job) {
  ------------------
  |  Branch (2194:21): [True: 0, False: 0]
  ------------------
 2195|       |                    /* It would be nice to fallback to single thread case, but */
 2196|       |                    /* unfortunately some jobs may be launched and have modified */
 2197|       |                    /* tiledp, so it is not practical to recover from that error */
 2198|       |                    /* FIXME event manager error callback */
 2199|      0|                    opj_thread_pool_wait_completion(tp, 0);
 2200|      0|                    opj_aligned_free(v.mem);
 2201|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2202|      0|                }
 2203|      0|                job->v = v;
 2204|      0|                job->rh = rh;
 2205|      0|                job->w = w;
 2206|      0|                job->tiledp = tiledp;
 2207|      0|                job->min_j = j * step_j;
 2208|      0|                job->max_j = (j + 1U) * step_j; /* this can overflow */
 2209|      0|                if (j == (num_jobs - 1U)) {  /* this will take care of the overflow */
  ------------------
  |  Branch (2209:21): [True: 0, False: 0]
  ------------------
 2210|      0|                    job->max_j = rw;
 2211|      0|                }
 2212|      0|                job->v.mem = (OPJ_INT32*)opj_aligned_32_malloc(h_mem_size);
 2213|      0|                if (!job->v.mem) {
  ------------------
  |  Branch (2213:21): [True: 0, False: 0]
  ------------------
 2214|       |                    /* FIXME event manager error callback */
 2215|      0|                    opj_thread_pool_wait_completion(tp, 0);
 2216|      0|                    opj_free(job);
 2217|      0|                    opj_aligned_free(v.mem);
 2218|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2219|      0|                }
 2220|      0|                opj_thread_pool_submit_job(tp, opj_dwt_decode_v_func, job);
 2221|      0|            }
 2222|      0|            opj_thread_pool_wait_completion(tp, 0);
 2223|      0|        }
 2224|  15.1k|    }
 2225|  1.60k|    opj_aligned_free(h.mem);
 2226|  1.60k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.60k|#define OPJ_TRUE 1
  ------------------
 2227|  1.60k|}
dwt.c:opj_idwt53_h:
  482|   164k|{
  483|       |#ifdef STANDARD_SLOW_VERSION
  484|       |    /* For documentation purpose */
  485|       |    opj_dwt_interleave_h(dwt, tiledp);
  486|       |    opj_dwt_decode_1(dwt);
  487|       |    memcpy(tiledp, dwt->mem, (OPJ_UINT32)(dwt->sn + dwt->dn) * sizeof(OPJ_INT32));
  488|       |#else
  489|   164k|    const OPJ_INT32 sn = dwt->sn;
  490|   164k|    const OPJ_INT32 len = sn + dwt->dn;
  491|   164k|    if (dwt->cas == 0) { /* Left-most sample is on even coordinate */
  ------------------
  |  Branch (491:9): [True: 108k, False: 56.6k]
  ------------------
  492|   108k|        if (len > 1) {
  ------------------
  |  Branch (492:13): [True: 47.4k, False: 60.6k]
  ------------------
  493|  47.4k|            opj_idwt53_h_cas0(dwt->mem, sn, len, tiledp);
  494|  60.6k|        } else {
  495|       |            /* Unmodified value */
  496|  60.6k|        }
  497|   108k|    } else { /* Left-most sample is on odd coordinate */
  498|  56.6k|        if (len == 1) {
  ------------------
  |  Branch (498:13): [True: 20.4k, False: 36.1k]
  ------------------
  499|  20.4k|            tiledp[0] /= 2;
  500|  36.1k|        } else if (len == 2) {
  ------------------
  |  Branch (500:20): [True: 6.26k, False: 29.8k]
  ------------------
  501|  6.26k|            OPJ_INT32* out = dwt->mem;
  502|  6.26k|            const OPJ_INT32* in_even = &tiledp[sn];
  503|  6.26k|            const OPJ_INT32* in_odd = &tiledp[0];
  504|  6.26k|            out[1] = in_odd[0] - ((in_even[0] + 1) >> 1);
  505|  6.26k|            out[0] = in_even[0] + out[1];
  506|  6.26k|            memcpy(tiledp, dwt->mem, (OPJ_UINT32)len * sizeof(OPJ_INT32));
  507|  29.8k|        } else if (len > 2) {
  ------------------
  |  Branch (507:20): [True: 14.8k, False: 15.0k]
  ------------------
  508|  14.8k|            opj_idwt53_h_cas1(dwt->mem, sn, len, tiledp);
  509|  14.8k|        }
  510|  56.6k|    }
  511|   164k|#endif
  512|   164k|}
dwt.c:opj_idwt53_h_cas0:
  339|  47.4k|{
  340|  47.4k|    OPJ_INT32 i, j;
  341|  47.4k|    const OPJ_INT32* in_even = &tiledp[0];
  342|  47.4k|    const OPJ_INT32* in_odd = &tiledp[sn];
  343|       |
  344|       |#ifdef TWO_PASS_VERSION
  345|       |    /* For documentation purpose: performs lifting in two iterations, */
  346|       |    /* but without explicit interleaving */
  347|       |
  348|       |    assert(len > 1);
  349|       |
  350|       |    /* Even */
  351|       |    tmp[0] = in_even[0] - ((in_odd[0] + 1) >> 1);
  352|       |    for (i = 2, j = 0; i <= len - 2; i += 2, j++) {
  353|       |        tmp[i] = in_even[j + 1] - ((in_odd[j] + in_odd[j + 1] + 2) >> 2);
  354|       |    }
  355|       |    if (len & 1) { /* if len is odd */
  356|       |        tmp[len - 1] = in_even[(len - 1) / 2] - ((in_odd[(len - 2) / 2] + 1) >> 1);
  357|       |    }
  358|       |
  359|       |    /* Odd */
  360|       |    for (i = 1, j = 0; i < len - 1; i += 2, j++) {
  361|       |        tmp[i] = in_odd[j] + ((tmp[i - 1] + tmp[i + 1]) >> 1);
  362|       |    }
  363|       |    if (!(len & 1)) { /* if len is even */
  364|       |        tmp[len - 1] = in_odd[(len - 1) / 2] + tmp[len - 2];
  365|       |    }
  366|       |#else
  367|  47.4k|    OPJ_INT32 d1c, d1n, s1n, s0c, s0n;
  368|       |
  369|  47.4k|    assert(len > 1);
  370|       |
  371|       |    /* Improved version of the TWO_PASS_VERSION: */
  372|       |    /* Performs lifting in one single iteration. Saves memory */
  373|       |    /* accesses and explicit interleaving. */
  374|  47.4k|    s1n = in_even[0];
  375|  47.4k|    d1n = in_odd[0];
  376|  47.4k|    s0n = s1n - ((d1n + 1) >> 1);
  377|       |
  378|  2.48M|    for (i = 0, j = 1; i < (len - 3); i += 2, j++) {
  ------------------
  |  Branch (378:24): [True: 2.43M, False: 47.4k]
  ------------------
  379|  2.43M|        d1c = d1n;
  380|  2.43M|        s0c = s0n;
  381|       |
  382|  2.43M|        s1n = in_even[j];
  383|  2.43M|        d1n = in_odd[j];
  384|       |
  385|  2.43M|        s0n = s1n - ((d1c + d1n + 2) >> 2);
  386|       |
  387|  2.43M|        tmp[i  ] = s0c;
  388|  2.43M|        tmp[i + 1] = opj_int_add_no_overflow(d1c, opj_int_add_no_overflow(s0c,
  389|  2.43M|                                             s0n) >> 1);
  390|  2.43M|    }
  391|       |
  392|  47.4k|    tmp[i] = s0n;
  393|       |
  394|  47.4k|    if (len & 1) {
  ------------------
  |  Branch (394:9): [True: 26.1k, False: 21.2k]
  ------------------
  395|  26.1k|        tmp[len - 1] = in_even[(len - 1) / 2] - ((d1n + 1) >> 1);
  396|  26.1k|        tmp[len - 2] = d1n + ((s0n + tmp[len - 1]) >> 1);
  397|  26.1k|    } else {
  398|  21.2k|        tmp[len - 1] = d1n + s0n;
  399|  21.2k|    }
  400|  47.4k|#endif
  401|  47.4k|    memcpy(tiledp, tmp, (OPJ_UINT32)len * sizeof(OPJ_INT32));
  402|  47.4k|}
dwt.c:opj_idwt53_h_cas1:
  408|  14.8k|{
  409|  14.8k|    OPJ_INT32 i, j;
  410|  14.8k|    const OPJ_INT32* in_even = &tiledp[sn];
  411|  14.8k|    const OPJ_INT32* in_odd = &tiledp[0];
  412|       |
  413|       |#ifdef TWO_PASS_VERSION
  414|       |    /* For documentation purpose: performs lifting in two iterations, */
  415|       |    /* but without explicit interleaving */
  416|       |
  417|       |    assert(len > 2);
  418|       |
  419|       |    /* Odd */
  420|       |    for (i = 1, j = 0; i < len - 1; i += 2, j++) {
  421|       |        tmp[i] = in_odd[j] - ((in_even[j] + in_even[j + 1] + 2) >> 2);
  422|       |    }
  423|       |    if (!(len & 1)) {
  424|       |        tmp[len - 1] = in_odd[len / 2 - 1] - ((in_even[len / 2 - 1] + 1) >> 1);
  425|       |    }
  426|       |
  427|       |    /* Even */
  428|       |    tmp[0] = in_even[0] + tmp[1];
  429|       |    for (i = 2, j = 1; i < len - 1; i += 2, j++) {
  430|       |        tmp[i] = in_even[j] + ((tmp[i + 1] + tmp[i - 1]) >> 1);
  431|       |    }
  432|       |    if (len & 1) {
  433|       |        tmp[len - 1] = in_even[len / 2] + tmp[len - 2];
  434|       |    }
  435|       |#else
  436|  14.8k|    OPJ_INT32 s1, s2, dc, dn;
  437|       |
  438|  14.8k|    assert(len > 2);
  439|       |
  440|       |    /* Improved version of the TWO_PASS_VERSION: */
  441|       |    /* Performs lifting in one single iteration. Saves memory */
  442|       |    /* accesses and explicit interleaving. */
  443|       |
  444|  14.8k|    s1 = in_even[1];
  445|  14.8k|    dc = in_odd[0] - ((in_even[0] + s1 + 2) >> 2);
  446|  14.8k|    tmp[0] = in_even[0] + dc;
  447|       |
  448|   440k|    for (i = 1, j = 1; i < (len - 2 - !(len & 1)); i += 2, j++) {
  ------------------
  |  Branch (448:24): [True: 425k, False: 14.8k]
  ------------------
  449|       |
  450|   425k|        s2 = in_even[j + 1];
  451|       |
  452|   425k|        dn = in_odd[j] - ((s1 + s2 + 2) >> 2);
  453|   425k|        tmp[i  ] = dc;
  454|   425k|        tmp[i + 1] = opj_int_add_no_overflow(s1, opj_int_add_no_overflow(dn, dc) >> 1);
  455|       |
  456|   425k|        dc = dn;
  457|   425k|        s1 = s2;
  458|   425k|    }
  459|       |
  460|  14.8k|    tmp[i] = dc;
  461|       |
  462|  14.8k|    if (!(len & 1)) {
  ------------------
  |  Branch (462:9): [True: 3.82k, False: 11.0k]
  ------------------
  463|  3.82k|        dn = in_odd[len / 2 - 1] - ((s1 + 1) >> 1);
  464|  3.82k|        tmp[len - 2] = s1 + ((dn + dc) >> 1);
  465|  3.82k|        tmp[len - 1] = dn;
  466|  11.0k|    } else {
  467|  11.0k|        tmp[len - 1] = s1 + dc;
  468|  11.0k|    }
  469|  14.8k|#endif
  470|  14.8k|    memcpy(tiledp, tmp, (OPJ_UINT32)len * sizeof(OPJ_INT32));
  471|  14.8k|}
dwt.c:opj_idwt53_v:
  880|  18.3k|{
  881|       |#ifdef STANDARD_SLOW_VERSION
  882|       |    /* For documentation purpose */
  883|       |    OPJ_INT32 k, c;
  884|       |    for (c = 0; c < nb_cols; c ++) {
  885|       |        opj_dwt_interleave_v(dwt, tiledp_col + c, stride);
  886|       |        opj_dwt_decode_1(dwt);
  887|       |        for (k = 0; k < dwt->sn + dwt->dn; ++k) {
  888|       |            tiledp_col[c + k * stride] = dwt->mem[k];
  889|       |        }
  890|       |    }
  891|       |#else
  892|  18.3k|    const OPJ_INT32 sn = dwt->sn;
  893|  18.3k|    const OPJ_INT32 len = sn + dwt->dn;
  894|  18.3k|    if (dwt->cas == 0) {
  ------------------
  |  Branch (894:9): [True: 11.9k, False: 6.42k]
  ------------------
  895|       |        /* If len == 1, unmodified value */
  896|       |
  897|  11.9k|#if (defined(__SSE2__) || defined(__AVX2__))
  898|  11.9k|        if (len > 1 && nb_cols == PARALLEL_COLS_53) {
  ------------------
  |  |   78|  10.2k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   74|  10.2k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
  |  Branch (898:13): [True: 10.2k, False: 1.73k]
  |  Branch (898:24): [True: 7.42k, False: 2.77k]
  ------------------
  899|       |            /* Same as below general case, except that thanks to SSE2/AVX2 */
  900|       |            /* we can efficiently process 8/16 columns in parallel */
  901|  7.42k|            opj_idwt53_v_cas0_mcols_SSE2_OR_AVX2(dwt->mem, sn, len, tiledp_col, stride);
  902|  7.42k|            return;
  903|  7.42k|        }
  904|  4.51k|#endif
  905|  4.51k|        if (len > 1) {
  ------------------
  |  Branch (905:13): [True: 2.77k, False: 1.73k]
  ------------------
  906|  2.77k|            OPJ_INT32 c;
  907|  10.7k|            for (c = 0; c < nb_cols; c++, tiledp_col++) {
  ------------------
  |  Branch (907:25): [True: 7.94k, False: 2.77k]
  ------------------
  908|  7.94k|                opj_idwt3_v_cas0(dwt->mem, sn, len, tiledp_col, stride);
  909|  7.94k|            }
  910|  2.77k|            return;
  911|  2.77k|        }
  912|  6.42k|    } else {
  913|  6.42k|        if (len == 1) {
  ------------------
  |  Branch (913:13): [True: 885, False: 5.54k]
  ------------------
  914|    885|            OPJ_INT32 c;
  915|  5.22k|            for (c = 0; c < nb_cols; c++, tiledp_col++) {
  ------------------
  |  Branch (915:25): [True: 4.34k, False: 885]
  ------------------
  916|  4.34k|                tiledp_col[0] /= 2;
  917|  4.34k|            }
  918|    885|            return;
  919|    885|        }
  920|       |
  921|  5.54k|        if (len == 2) {
  ------------------
  |  Branch (921:13): [True: 951, False: 4.59k]
  ------------------
  922|    951|            OPJ_INT32 c;
  923|    951|            OPJ_INT32* out = dwt->mem;
  924|  7.09k|            for (c = 0; c < nb_cols; c++, tiledp_col++) {
  ------------------
  |  Branch (924:25): [True: 6.14k, False: 951]
  ------------------
  925|  6.14k|                OPJ_INT32 i;
  926|  6.14k|                const OPJ_INT32* in_even = &tiledp_col[(OPJ_SIZE_T)sn * stride];
  927|  6.14k|                const OPJ_INT32* in_odd = &tiledp_col[0];
  928|       |
  929|  6.14k|                out[1] = in_odd[0] - ((in_even[0] + 1) >> 1);
  930|  6.14k|                out[0] = in_even[0] + out[1];
  931|       |
  932|  18.4k|                for (i = 0; i < len; ++i) {
  ------------------
  |  Branch (932:29): [True: 12.2k, False: 6.14k]
  ------------------
  933|  12.2k|                    tiledp_col[(OPJ_SIZE_T)i * stride] = out[i];
  934|  12.2k|                }
  935|  6.14k|            }
  936|       |
  937|    951|            return;
  938|    951|        }
  939|       |
  940|  4.59k|#if (defined(__SSE2__) || defined(__AVX2__))
  941|  4.59k|        if (len > 2 && nb_cols == PARALLEL_COLS_53) {
  ------------------
  |  |   78|  2.48k|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   74|  2.48k|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
  |  Branch (941:13): [True: 2.48k, False: 2.10k]
  |  Branch (941:24): [True: 1.75k, False: 733]
  ------------------
  942|       |            /* Same as below general case, except that thanks to SSE2/AVX2 */
  943|       |            /* we can efficiently process 8/16 columns in parallel */
  944|  1.75k|            opj_idwt53_v_cas1_mcols_SSE2_OR_AVX2(dwt->mem, sn, len, tiledp_col, stride);
  945|  1.75k|            return;
  946|  1.75k|        }
  947|  2.83k|#endif
  948|  2.83k|        if (len > 2) {
  ------------------
  |  Branch (948:13): [True: 733, False: 2.10k]
  ------------------
  949|    733|            OPJ_INT32 c;
  950|  2.72k|            for (c = 0; c < nb_cols; c++, tiledp_col++) {
  ------------------
  |  Branch (950:25): [True: 1.98k, False: 733]
  ------------------
  951|  1.98k|                opj_idwt3_v_cas1(dwt->mem, sn, len, tiledp_col, stride);
  952|  1.98k|            }
  953|    733|            return;
  954|    733|        }
  955|  2.83k|    }
  956|  18.3k|#endif
  957|  18.3k|}
dwt.c:opj_idwt53_v_cas0_mcols_SSE2_OR_AVX2:
  568|  7.42k|{
  569|  7.42k|    const OPJ_INT32* in_even = &tiledp_col[0];
  570|  7.42k|    const OPJ_INT32* in_odd = &tiledp_col[(OPJ_SIZE_T)sn * stride];
  571|       |
  572|  7.42k|    OPJ_INT32 i;
  573|  7.42k|    OPJ_SIZE_T j;
  574|  7.42k|    VREG d1c_0, d1n_0, s1n_0, s0c_0, s0n_0;
  ------------------
  |  |  528|  7.42k|#define VREG        __m128i
  ------------------
  575|  7.42k|    VREG d1c_1, d1n_1, s1n_1, s0c_1, s0n_1;
  ------------------
  |  |  528|  7.42k|#define VREG        __m128i
  ------------------
  576|  7.42k|    const VREG two = LOAD_CST(2);
  ------------------
  |  |  529|  7.42k|#define LOAD_CST(x) _mm_set1_epi32(x)
  ------------------
  577|       |
  578|  7.42k|    assert(len > 1);
  579|       |#if __AVX2__
  580|       |    assert(PARALLEL_COLS_53 == 16);
  581|       |    assert(VREG_INT_COUNT == 8);
  582|       |#else
  583|  7.42k|    assert(PARALLEL_COLS_53 == 8);
  584|  7.42k|    assert(VREG_INT_COUNT == 4);
  585|  7.42k|#endif
  586|       |
  587|       |    /* Note: loads of input even/odd values must be done in a unaligned */
  588|       |    /* fashion. But stores in tmp can be done with aligned store, since */
  589|       |    /* the temporary buffer is properly aligned */
  590|  7.42k|    assert((OPJ_SIZE_T)tmp % (sizeof(OPJ_INT32) * VREG_INT_COUNT) == 0);
  591|       |
  592|  7.42k|    s1n_0 = LOADU(in_even + 0);
  ------------------
  |  |  531|  7.42k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  593|  7.42k|    s1n_1 = LOADU(in_even + VREG_INT_COUNT);
  ------------------
  |  |  531|  7.42k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  594|  7.42k|    d1n_0 = LOADU(in_odd);
  ------------------
  |  |  531|  7.42k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  595|  7.42k|    d1n_1 = LOADU(in_odd + VREG_INT_COUNT);
  ------------------
  |  |  531|  7.42k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  596|       |
  597|       |    /* s0n = s1n - ((d1n + 1) >> 1); <==> */
  598|       |    /* s0n = s1n - ((d1n + d1n + 2) >> 2); */
  599|  7.42k|    s0n_0 = SUB(s1n_0, SAR(ADD3(d1n_0, d1n_0, two), 2));
  ------------------
  |  |  535|  7.42k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  600|  7.42k|    s0n_1 = SUB(s1n_1, SAR(ADD3(d1n_1, d1n_1, two), 2));
  ------------------
  |  |  535|  7.42k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  601|       |
  602|   336k|    for (i = 0, j = 1; i < (len - 3); i += 2, j++) {
  ------------------
  |  Branch (602:24): [True: 329k, False: 7.42k]
  ------------------
  603|   329k|        d1c_0 = d1n_0;
  604|   329k|        s0c_0 = s0n_0;
  605|   329k|        d1c_1 = d1n_1;
  606|   329k|        s0c_1 = s0n_1;
  607|       |
  608|   329k|        s1n_0 = LOADU(in_even + j * stride);
  ------------------
  |  |  531|   329k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  609|   329k|        s1n_1 = LOADU(in_even + j * stride + VREG_INT_COUNT);
  ------------------
  |  |  531|   329k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  610|   329k|        d1n_0 = LOADU(in_odd + j * stride);
  ------------------
  |  |  531|   329k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  611|   329k|        d1n_1 = LOADU(in_odd + j * stride + VREG_INT_COUNT);
  ------------------
  |  |  531|   329k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  612|       |
  613|       |        /*s0n = s1n - ((d1c + d1n + 2) >> 2);*/
  614|   329k|        s0n_0 = SUB(s1n_0, SAR(ADD3(d1c_0, d1n_0, two), 2));
  ------------------
  |  |  535|   329k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  615|   329k|        s0n_1 = SUB(s1n_1, SAR(ADD3(d1c_1, d1n_1, two), 2));
  ------------------
  |  |  535|   329k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  616|       |
  617|   329k|        STORE(tmp + PARALLEL_COLS_53 * (i + 0), s0c_0);
  ------------------
  |  |  532|   329k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  618|   329k|        STORE(tmp + PARALLEL_COLS_53 * (i + 0) + VREG_INT_COUNT, s0c_1);
  ------------------
  |  |  532|   329k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  619|       |
  620|       |        /* d1c + ((s0c + s0n) >> 1) */
  621|   329k|        STORE(tmp + PARALLEL_COLS_53 * (i + 1) + 0,
  ------------------
  |  |  532|   329k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  622|   329k|              ADD(d1c_0, SAR(ADD(s0c_0, s0n_0), 1)));
  623|   329k|        STORE(tmp + PARALLEL_COLS_53 * (i + 1) + VREG_INT_COUNT,
  ------------------
  |  |  532|   329k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  624|   329k|              ADD(d1c_1, SAR(ADD(s0c_1, s0n_1), 1)));
  625|   329k|    }
  626|       |
  627|  7.42k|    STORE(tmp + PARALLEL_COLS_53 * (i + 0) + 0, s0n_0);
  ------------------
  |  |  532|  7.42k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  628|  7.42k|    STORE(tmp + PARALLEL_COLS_53 * (i + 0) + VREG_INT_COUNT, s0n_1);
  ------------------
  |  |  532|  7.42k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  629|       |
  630|  7.42k|    if (len & 1) {
  ------------------
  |  Branch (630:9): [True: 2.67k, False: 4.74k]
  ------------------
  631|  2.67k|        VREG tmp_len_minus_1;
  ------------------
  |  |  528|  2.67k|#define VREG        __m128i
  ------------------
  632|  2.67k|        s1n_0 = LOADU(in_even + (OPJ_SIZE_T)((len - 1) / 2) * stride);
  ------------------
  |  |  531|  2.67k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  633|       |        /* tmp_len_minus_1 = s1n - ((d1n + 1) >> 1); */
  634|  2.67k|        tmp_len_minus_1 = SUB(s1n_0, SAR(ADD3(d1n_0, d1n_0, two), 2));
  ------------------
  |  |  535|  2.67k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  635|  2.67k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1), tmp_len_minus_1);
  ------------------
  |  |  532|  2.67k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  636|       |        /* d1n + ((s0n + tmp_len_minus_1) >> 1) */
  637|  2.67k|        STORE(tmp + PARALLEL_COLS_53 * (len - 2),
  ------------------
  |  |  532|  2.67k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  638|  2.67k|              ADD(d1n_0, SAR(ADD(s0n_0, tmp_len_minus_1), 1)));
  639|       |
  640|  2.67k|        s1n_1 = LOADU(in_even + (OPJ_SIZE_T)((len - 1) / 2) * stride + VREG_INT_COUNT);
  ------------------
  |  |  531|  2.67k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  641|       |        /* tmp_len_minus_1 = s1n - ((d1n + 1) >> 1); */
  642|  2.67k|        tmp_len_minus_1 = SUB(s1n_1, SAR(ADD3(d1n_1, d1n_1, two), 2));
  ------------------
  |  |  535|  2.67k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  643|  2.67k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + VREG_INT_COUNT,
  ------------------
  |  |  532|  2.67k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  644|  2.67k|              tmp_len_minus_1);
  645|       |        /* d1n + ((s0n + tmp_len_minus_1) >> 1) */
  646|  2.67k|        STORE(tmp + PARALLEL_COLS_53 * (len - 2) + VREG_INT_COUNT,
  ------------------
  |  |  532|  2.67k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  647|  2.67k|              ADD(d1n_1, SAR(ADD(s0n_1, tmp_len_minus_1), 1)));
  648|       |
  649|       |
  650|  4.74k|    } else {
  651|  4.74k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + 0,
  ------------------
  |  |  532|  4.74k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  652|  4.74k|              ADD(d1n_0, s0n_0));
  653|  4.74k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + VREG_INT_COUNT,
  ------------------
  |  |  532|  4.74k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  654|  4.74k|              ADD(d1n_1, s0n_1));
  655|  4.74k|    }
  656|       |
  657|  7.42k|    opj_idwt53_v_final_memcpy(tiledp_col, tmp, len, stride);
  658|  7.42k|}
dwt.c:opj_idwt53_v_final_memcpy:
  545|  9.17k|{
  546|  9.17k|    OPJ_INT32 i;
  547|   716k|    for (i = 0; i < len; ++i) {
  ------------------
  |  Branch (547:17): [True: 707k, False: 9.17k]
  ------------------
  548|       |        /* A memcpy(&tiledp_col[i * stride + 0],
  549|       |                    &tmp[PARALLEL_COLS_53 * i + 0],
  550|       |                    PARALLEL_COLS_53 * sizeof(OPJ_INT32))
  551|       |           would do but would be a tiny bit slower.
  552|       |           We can take here advantage of our knowledge of alignment */
  553|   707k|        STOREU(&tiledp_col[(OPJ_SIZE_T)i * stride + 0],
  ------------------
  |  |  533|   707k|#define STOREU(x,y) _mm_storeu_si128((VREG*)(x),(y))
  ------------------
  554|   707k|               LOAD(&tmp[PARALLEL_COLS_53 * i + 0]));
  555|   707k|        STOREU(&tiledp_col[(OPJ_SIZE_T)i * stride + VREG_INT_COUNT],
  ------------------
  |  |  533|   707k|#define STOREU(x,y) _mm_storeu_si128((VREG*)(x),(y))
  ------------------
  556|   707k|               LOAD(&tmp[PARALLEL_COLS_53 * i + VREG_INT_COUNT]));
  557|   707k|    }
  558|  9.17k|}
dwt.c:opj_idwt3_v_cas0:
  780|  7.94k|{
  781|  7.94k|    OPJ_INT32 i, j;
  782|  7.94k|    OPJ_INT32 d1c, d1n, s1n, s0c, s0n;
  783|       |
  784|  7.94k|    assert(len > 1);
  785|       |
  786|       |    /* Performs lifting in one single iteration. Saves memory */
  787|       |    /* accesses and explicit interleaving. */
  788|       |
  789|  7.94k|    s1n = tiledp_col[0];
  790|  7.94k|    d1n = tiledp_col[(OPJ_SIZE_T)sn * stride];
  791|  7.94k|    s0n = s1n - ((d1n + 1) >> 1);
  792|       |
  793|   129k|    for (i = 0, j = 0; i < (len - 3); i += 2, j++) {
  ------------------
  |  Branch (793:24): [True: 122k, False: 7.94k]
  ------------------
  794|   122k|        d1c = d1n;
  795|   122k|        s0c = s0n;
  796|       |
  797|   122k|        s1n = tiledp_col[(OPJ_SIZE_T)(j + 1) * stride];
  798|   122k|        d1n = tiledp_col[(OPJ_SIZE_T)(sn + j + 1) * stride];
  799|       |
  800|   122k|        s0n = opj_int_sub_no_overflow(s1n,
  801|   122k|                                      opj_int_add_no_overflow(opj_int_add_no_overflow(d1c, d1n), 2) >> 2);
  802|       |
  803|   122k|        tmp[i  ] = s0c;
  804|   122k|        tmp[i + 1] = opj_int_add_no_overflow(d1c, opj_int_add_no_overflow(s0c,
  805|   122k|                                             s0n) >> 1);
  806|   122k|    }
  807|       |
  808|  7.94k|    tmp[i] = s0n;
  809|       |
  810|  7.94k|    if (len & 1) {
  ------------------
  |  Branch (810:9): [True: 4.21k, False: 3.72k]
  ------------------
  811|  4.21k|        tmp[len - 1] =
  812|  4.21k|            tiledp_col[(OPJ_SIZE_T)((len - 1) / 2) * stride] -
  813|  4.21k|            ((d1n + 1) >> 1);
  814|  4.21k|        tmp[len - 2] = d1n + ((s0n + tmp[len - 1]) >> 1);
  815|  4.21k|    } else {
  816|  3.72k|        tmp[len - 1] = d1n + s0n;
  817|  3.72k|    }
  818|       |
  819|   272k|    for (i = 0; i < len; ++i) {
  ------------------
  |  Branch (819:17): [True: 264k, False: 7.94k]
  ------------------
  820|   264k|        tiledp_col[(OPJ_SIZE_T)i * stride] = tmp[i];
  821|   264k|    }
  822|  7.94k|}
dwt.c:opj_idwt53_v_cas1_mcols_SSE2_OR_AVX2:
  669|  1.75k|{
  670|  1.75k|    OPJ_INT32 i;
  671|  1.75k|    OPJ_SIZE_T j;
  672|       |
  673|  1.75k|    VREG s1_0, s2_0, dc_0, dn_0;
  ------------------
  |  |  528|  1.75k|#define VREG        __m128i
  ------------------
  674|  1.75k|    VREG s1_1, s2_1, dc_1, dn_1;
  ------------------
  |  |  528|  1.75k|#define VREG        __m128i
  ------------------
  675|  1.75k|    const VREG two = LOAD_CST(2);
  ------------------
  |  |  529|  1.75k|#define LOAD_CST(x) _mm_set1_epi32(x)
  ------------------
  676|       |
  677|  1.75k|    const OPJ_INT32* in_even = &tiledp_col[(OPJ_SIZE_T)sn * stride];
  678|  1.75k|    const OPJ_INT32* in_odd = &tiledp_col[0];
  679|       |
  680|  1.75k|    assert(len > 2);
  681|       |#if __AVX2__
  682|       |    assert(PARALLEL_COLS_53 == 16);
  683|       |    assert(VREG_INT_COUNT == 8);
  684|       |#else
  685|  1.75k|    assert(PARALLEL_COLS_53 == 8);
  686|  1.75k|    assert(VREG_INT_COUNT == 4);
  687|  1.75k|#endif
  688|       |
  689|       |    /* Note: loads of input even/odd values must be done in a unaligned */
  690|       |    /* fashion. But stores in tmp can be done with aligned store, since */
  691|       |    /* the temporary buffer is properly aligned */
  692|  1.75k|    assert((OPJ_SIZE_T)tmp % (sizeof(OPJ_INT32) * VREG_INT_COUNT) == 0);
  693|       |
  694|  1.75k|    s1_0 = LOADU(in_even + stride);
  ------------------
  |  |  531|  1.75k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  695|       |    /* in_odd[0] - ((in_even[0] + s1 + 2) >> 2); */
  696|  1.75k|    dc_0 = SUB(LOADU(in_odd + 0),
  ------------------
  |  |  535|  1.75k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  697|  1.75k|               SAR(ADD3(LOADU(in_even + 0), s1_0, two), 2));
  698|  1.75k|    STORE(tmp + PARALLEL_COLS_53 * 0, ADD(LOADU(in_even + 0), dc_0));
  ------------------
  |  |  532|  1.75k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  699|       |
  700|  1.75k|    s1_1 = LOADU(in_even + stride + VREG_INT_COUNT);
  ------------------
  |  |  531|  1.75k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  701|       |    /* in_odd[0] - ((in_even[0] + s1 + 2) >> 2); */
  702|  1.75k|    dc_1 = SUB(LOADU(in_odd + VREG_INT_COUNT),
  ------------------
  |  |  535|  1.75k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  703|  1.75k|               SAR(ADD3(LOADU(in_even + VREG_INT_COUNT), s1_1, two), 2));
  704|  1.75k|    STORE(tmp + PARALLEL_COLS_53 * 0 + VREG_INT_COUNT,
  ------------------
  |  |  532|  1.75k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  705|  1.75k|          ADD(LOADU(in_even + VREG_INT_COUNT), dc_1));
  706|       |
  707|  14.2k|    for (i = 1, j = 1; i < (len - 2 - !(len & 1)); i += 2, j++) {
  ------------------
  |  Branch (707:24): [True: 12.5k, False: 1.75k]
  ------------------
  708|       |
  709|  12.5k|        s2_0 = LOADU(in_even + (j + 1) * stride);
  ------------------
  |  |  531|  12.5k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  710|  12.5k|        s2_1 = LOADU(in_even + (j + 1) * stride + VREG_INT_COUNT);
  ------------------
  |  |  531|  12.5k|#define LOADU(x)    _mm_loadu_si128((const VREG*)(x))
  ------------------
  711|       |
  712|       |        /* dn = in_odd[j * stride] - ((s1 + s2 + 2) >> 2); */
  713|  12.5k|        dn_0 = SUB(LOADU(in_odd + j * stride),
  ------------------
  |  |  535|  12.5k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  714|  12.5k|                   SAR(ADD3(s1_0, s2_0, two), 2));
  715|  12.5k|        dn_1 = SUB(LOADU(in_odd + j * stride + VREG_INT_COUNT),
  ------------------
  |  |  535|  12.5k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  716|  12.5k|                   SAR(ADD3(s1_1, s2_1, two), 2));
  717|       |
  718|  12.5k|        STORE(tmp + PARALLEL_COLS_53 * i, dc_0);
  ------------------
  |  |  532|  12.5k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  719|  12.5k|        STORE(tmp + PARALLEL_COLS_53 * i + VREG_INT_COUNT, dc_1);
  ------------------
  |  |  532|  12.5k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  720|       |
  721|       |        /* tmp[i + 1] = s1 + ((dn + dc) >> 1); */
  722|  12.5k|        STORE(tmp + PARALLEL_COLS_53 * (i + 1) + 0,
  ------------------
  |  |  532|  12.5k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  723|  12.5k|              ADD(s1_0, SAR(ADD(dn_0, dc_0), 1)));
  724|  12.5k|        STORE(tmp + PARALLEL_COLS_53 * (i + 1) + VREG_INT_COUNT,
  ------------------
  |  |  532|  12.5k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  725|  12.5k|              ADD(s1_1, SAR(ADD(dn_1, dc_1), 1)));
  726|       |
  727|  12.5k|        dc_0 = dn_0;
  728|  12.5k|        s1_0 = s2_0;
  729|  12.5k|        dc_1 = dn_1;
  730|  12.5k|        s1_1 = s2_1;
  731|  12.5k|    }
  732|  1.75k|    STORE(tmp + PARALLEL_COLS_53 * i, dc_0);
  ------------------
  |  |  532|  1.75k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  733|  1.75k|    STORE(tmp + PARALLEL_COLS_53 * i + VREG_INT_COUNT, dc_1);
  ------------------
  |  |  532|  1.75k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  734|       |
  735|  1.75k|    if (!(len & 1)) {
  ------------------
  |  Branch (735:9): [True: 1.28k, False: 469]
  ------------------
  736|       |        /*dn = in_odd[(len / 2 - 1) * stride] - ((s1 + 1) >> 1); */
  737|  1.28k|        dn_0 = SUB(LOADU(in_odd + (OPJ_SIZE_T)(len / 2 - 1) * stride),
  ------------------
  |  |  535|  1.28k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  738|  1.28k|                   SAR(ADD3(s1_0, s1_0, two), 2));
  739|  1.28k|        dn_1 = SUB(LOADU(in_odd + (OPJ_SIZE_T)(len / 2 - 1) * stride + VREG_INT_COUNT),
  ------------------
  |  |  535|  1.28k|#define SUB(x,y)    _mm_sub_epi32((x),(y))
  ------------------
  740|  1.28k|                   SAR(ADD3(s1_1, s1_1, two), 2));
  741|       |
  742|       |        /* tmp[len - 2] = s1 + ((dn + dc) >> 1); */
  743|  1.28k|        STORE(tmp + PARALLEL_COLS_53 * (len - 2) + 0,
  ------------------
  |  |  532|  1.28k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  744|  1.28k|              ADD(s1_0, SAR(ADD(dn_0, dc_0), 1)));
  745|  1.28k|        STORE(tmp + PARALLEL_COLS_53 * (len - 2) + VREG_INT_COUNT,
  ------------------
  |  |  532|  1.28k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  746|  1.28k|              ADD(s1_1, SAR(ADD(dn_1, dc_1), 1)));
  747|       |
  748|  1.28k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + 0, dn_0);
  ------------------
  |  |  532|  1.28k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  749|  1.28k|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + VREG_INT_COUNT, dn_1);
  ------------------
  |  |  532|  1.28k|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  750|  1.28k|    } else {
  751|    469|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + 0, ADD(s1_0, dc_0));
  ------------------
  |  |  532|    469|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  752|    469|        STORE(tmp + PARALLEL_COLS_53 * (len - 1) + VREG_INT_COUNT,
  ------------------
  |  |  532|    469|#define STORE(x,y)  _mm_store_si128((VREG*)(x),(y))
  ------------------
  753|    469|              ADD(s1_1, dc_1));
  754|    469|    }
  755|       |
  756|  1.75k|    opj_idwt53_v_final_memcpy(tiledp_col, tmp, len, stride);
  757|  1.75k|}
dwt.c:opj_idwt3_v_cas1:
  832|  1.98k|{
  833|  1.98k|    OPJ_INT32 i, j;
  834|  1.98k|    OPJ_INT32 s1, s2, dc, dn;
  835|  1.98k|    const OPJ_INT32* in_even = &tiledp_col[(OPJ_SIZE_T)sn * stride];
  836|  1.98k|    const OPJ_INT32* in_odd = &tiledp_col[0];
  837|       |
  838|  1.98k|    assert(len > 2);
  839|       |
  840|       |    /* Performs lifting in one single iteration. Saves memory */
  841|       |    /* accesses and explicit interleaving. */
  842|       |
  843|  1.98k|    s1 = in_even[stride];
  844|  1.98k|    dc = in_odd[0] - ((in_even[0] + s1 + 2) >> 2);
  845|  1.98k|    tmp[0] = in_even[0] + dc;
  846|  14.9k|    for (i = 1, j = 1; i < (len - 2 - !(len & 1)); i += 2, j++) {
  ------------------
  |  Branch (846:24): [True: 13.0k, False: 1.98k]
  ------------------
  847|       |
  848|  13.0k|        s2 = in_even[(OPJ_SIZE_T)(j + 1) * stride];
  849|       |
  850|  13.0k|        dn = in_odd[(OPJ_SIZE_T)j * stride] - ((s1 + s2 + 2) >> 2);
  851|  13.0k|        tmp[i  ] = dc;
  852|  13.0k|        tmp[i + 1] = s1 + ((dn + dc) >> 1);
  853|       |
  854|  13.0k|        dc = dn;
  855|  13.0k|        s1 = s2;
  856|  13.0k|    }
  857|  1.98k|    tmp[i] = dc;
  858|  1.98k|    if (!(len & 1)) {
  ------------------
  |  Branch (858:9): [True: 705, False: 1.28k]
  ------------------
  859|    705|        dn = in_odd[(OPJ_SIZE_T)(len / 2 - 1) * stride] - ((s1 + 1) >> 1);
  860|    705|        tmp[len - 2] = s1 + ((dn + dc) >> 1);
  861|    705|        tmp[len - 1] = dn;
  862|  1.28k|    } else {
  863|  1.28k|        tmp[len - 1] = s1 + dc;
  864|  1.28k|    }
  865|       |
  866|  34.6k|    for (i = 0; i < len; ++i) {
  ------------------
  |  Branch (866:17): [True: 32.6k, False: 1.98k]
  ------------------
  867|  32.6k|        tiledp_col[(OPJ_SIZE_T)i * stride] = tmp[i];
  868|  32.6k|    }
  869|  1.98k|}
dwt.c:opj_dwt_decode_partial_tile:
 2622|  11.4k|{
 2623|  11.4k|    opj_sparse_array_int32_t* sa;
 2624|  11.4k|    opj_dwt_t h;
 2625|  11.4k|    opj_dwt_t v;
 2626|  11.4k|    OPJ_UINT32 resno;
 2627|       |    /* This value matches the maximum left/right extension given in tables */
 2628|       |    /* F.2 and F.3 of the standard. */
 2629|  11.4k|    const OPJ_UINT32 filter_width = 2U;
 2630|       |
 2631|  11.4k|    opj_tcd_resolution_t* tr = tilec->resolutions;
 2632|  11.4k|    opj_tcd_resolution_t* tr_max = &(tilec->resolutions[numres - 1]);
 2633|       |
 2634|  11.4k|    OPJ_UINT32 rw = (OPJ_UINT32)(tr->x1 -
 2635|  11.4k|                                 tr->x0);  /* width of the resolution level computed */
 2636|  11.4k|    OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 -
 2637|  11.4k|                                 tr->y0);  /* height of the resolution level computed */
 2638|       |
 2639|  11.4k|    OPJ_SIZE_T h_mem_size;
 2640|       |
 2641|       |    /* Compute the intersection of the area of interest, expressed in tile coordinates */
 2642|       |    /* with the tile coordinates */
 2643|  11.4k|    OPJ_UINT32 win_tcx0 = tilec->win_x0;
 2644|  11.4k|    OPJ_UINT32 win_tcy0 = tilec->win_y0;
 2645|  11.4k|    OPJ_UINT32 win_tcx1 = tilec->win_x1;
 2646|  11.4k|    OPJ_UINT32 win_tcy1 = tilec->win_y1;
 2647|       |
 2648|  11.4k|    if (tr_max->x0 == tr_max->x1 || tr_max->y0 == tr_max->y1) {
  ------------------
  |  Branch (2648:9): [True: 163, False: 11.2k]
  |  Branch (2648:37): [True: 275, False: 11.0k]
  ------------------
 2649|    438|        return OPJ_TRUE;
  ------------------
  |  |  117|    438|#define OPJ_TRUE 1
  ------------------
 2650|    438|    }
 2651|       |
 2652|  11.0k|    sa = opj_dwt_init_sparse_array(tilec, numres);
 2653|  11.0k|    if (sa == NULL) {
  ------------------
  |  Branch (2653:9): [True: 0, False: 11.0k]
  ------------------
 2654|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2655|      0|    }
 2656|       |
 2657|  11.0k|    if (numres == 1U) {
  ------------------
  |  Branch (2657:9): [True: 7.58k, False: 3.42k]
  ------------------
 2658|  7.58k|        OPJ_BOOL ret = opj_sparse_array_int32_read(sa,
 2659|  7.58k|                       tr_max->win_x0 - (OPJ_UINT32)tr_max->x0,
 2660|  7.58k|                       tr_max->win_y0 - (OPJ_UINT32)tr_max->y0,
 2661|  7.58k|                       tr_max->win_x1 - (OPJ_UINT32)tr_max->x0,
 2662|  7.58k|                       tr_max->win_y1 - (OPJ_UINT32)tr_max->y0,
 2663|  7.58k|                       tilec->data_win,
 2664|  7.58k|                       1, tr_max->win_x1 - tr_max->win_x0,
 2665|  7.58k|                       OPJ_TRUE);
  ------------------
  |  |  117|  7.58k|#define OPJ_TRUE 1
  ------------------
 2666|  7.58k|        assert(ret);
 2667|  7.58k|        OPJ_UNUSED(ret);
  ------------------
  |  |  219|  7.58k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2668|  7.58k|        opj_sparse_array_int32_free(sa);
 2669|  7.58k|        return OPJ_TRUE;
  ------------------
  |  |  117|  7.58k|#define OPJ_TRUE 1
  ------------------
 2670|  7.58k|    }
 2671|  3.42k|    h_mem_size = opj_dwt_max_resolution(tr, numres);
 2672|       |    /* overflow check */
 2673|       |    /* in vertical pass, we process 4 columns at a time */
 2674|  3.42k|    if (h_mem_size > (SIZE_MAX / (4 * sizeof(OPJ_INT32)))) {
  ------------------
  |  Branch (2674:9): [True: 0, False: 3.42k]
  ------------------
 2675|       |        /* FIXME event manager error callback */
 2676|      0|        opj_sparse_array_int32_free(sa);
 2677|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2678|      0|    }
 2679|       |
 2680|  3.42k|    h_mem_size *= 4 * sizeof(OPJ_INT32);
 2681|  3.42k|    h.mem = (OPJ_INT32*)opj_aligned_32_malloc(h_mem_size);
 2682|  3.42k|    if (! h.mem) {
  ------------------
  |  Branch (2682:9): [True: 0, False: 3.42k]
  ------------------
 2683|       |        /* FIXME event manager error callback */
 2684|      0|        opj_sparse_array_int32_free(sa);
 2685|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2686|      0|    }
 2687|       |
 2688|  3.42k|    v.mem = h.mem;
 2689|       |
 2690|  26.0k|    for (resno = 1; resno < numres; resno ++) {
  ------------------
  |  Branch (2690:21): [True: 22.6k, False: 3.42k]
  ------------------
 2691|  22.6k|        OPJ_UINT32 i, j;
 2692|       |        /* Window of interest subband-based coordinates */
 2693|  22.6k|        OPJ_UINT32 win_ll_x0, win_ll_y0, win_ll_x1, win_ll_y1;
 2694|  22.6k|        OPJ_UINT32 win_hl_x0, win_hl_x1;
 2695|  22.6k|        OPJ_UINT32 win_lh_y0, win_lh_y1;
 2696|       |        /* Window of interest tile-resolution-based coordinates */
 2697|  22.6k|        OPJ_UINT32 win_tr_x0, win_tr_x1, win_tr_y0, win_tr_y1;
 2698|       |        /* Tile-resolution subband-based coordinates */
 2699|  22.6k|        OPJ_UINT32 tr_ll_x0, tr_ll_y0, tr_hl_x0, tr_lh_y0;
 2700|       |
 2701|  22.6k|        ++tr;
 2702|       |
 2703|  22.6k|        h.sn = (OPJ_INT32)rw;
 2704|  22.6k|        v.sn = (OPJ_INT32)rh;
 2705|       |
 2706|  22.6k|        rw = (OPJ_UINT32)(tr->x1 - tr->x0);
 2707|  22.6k|        rh = (OPJ_UINT32)(tr->y1 - tr->y0);
 2708|       |
 2709|  22.6k|        h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
 2710|  22.6k|        h.cas = tr->x0 % 2;
 2711|       |
 2712|  22.6k|        v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
 2713|  22.6k|        v.cas = tr->y0 % 2;
 2714|       |
 2715|       |        /* Get the subband coordinates for the window of interest */
 2716|       |        /* LL band */
 2717|  22.6k|        opj_dwt_get_band_coordinates(tilec, resno, 0,
 2718|  22.6k|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 2719|  22.6k|                                     &win_ll_x0, &win_ll_y0,
 2720|  22.6k|                                     &win_ll_x1, &win_ll_y1);
 2721|       |
 2722|       |        /* HL band */
 2723|  22.6k|        opj_dwt_get_band_coordinates(tilec, resno, 1,
 2724|  22.6k|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 2725|  22.6k|                                     &win_hl_x0, NULL, &win_hl_x1, NULL);
 2726|       |
 2727|       |        /* LH band */
 2728|  22.6k|        opj_dwt_get_band_coordinates(tilec, resno, 2,
 2729|  22.6k|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 2730|  22.6k|                                     NULL, &win_lh_y0, NULL, &win_lh_y1);
 2731|       |
 2732|       |        /* Beware: band index for non-LL0 resolution are 0=HL, 1=LH and 2=HH */
 2733|  22.6k|        tr_ll_x0 = (OPJ_UINT32)tr->bands[1].x0;
 2734|  22.6k|        tr_ll_y0 = (OPJ_UINT32)tr->bands[0].y0;
 2735|  22.6k|        tr_hl_x0 = (OPJ_UINT32)tr->bands[0].x0;
 2736|  22.6k|        tr_lh_y0 = (OPJ_UINT32)tr->bands[1].y0;
 2737|       |
 2738|       |        /* Subtract the origin of the bands for this tile, to the subwindow */
 2739|       |        /* of interest band coordinates, so as to get them relative to the */
 2740|       |        /* tile */
 2741|  22.6k|        win_ll_x0 = opj_uint_subs(win_ll_x0, tr_ll_x0);
 2742|  22.6k|        win_ll_y0 = opj_uint_subs(win_ll_y0, tr_ll_y0);
 2743|  22.6k|        win_ll_x1 = opj_uint_subs(win_ll_x1, tr_ll_x0);
 2744|  22.6k|        win_ll_y1 = opj_uint_subs(win_ll_y1, tr_ll_y0);
 2745|  22.6k|        win_hl_x0 = opj_uint_subs(win_hl_x0, tr_hl_x0);
 2746|  22.6k|        win_hl_x1 = opj_uint_subs(win_hl_x1, tr_hl_x0);
 2747|  22.6k|        win_lh_y0 = opj_uint_subs(win_lh_y0, tr_lh_y0);
 2748|  22.6k|        win_lh_y1 = opj_uint_subs(win_lh_y1, tr_lh_y0);
 2749|       |
 2750|  22.6k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)h.sn, &win_ll_x0, &win_ll_x1);
 2751|  22.6k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)h.dn, &win_hl_x0, &win_hl_x1);
 2752|       |
 2753|  22.6k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)v.sn, &win_ll_y0, &win_ll_y1);
 2754|  22.6k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)v.dn, &win_lh_y0, &win_lh_y1);
 2755|       |
 2756|       |        /* Compute the tile-resolution-based coordinates for the window of interest */
 2757|  22.6k|        if (h.cas == 0) {
  ------------------
  |  Branch (2757:13): [True: 17.5k, False: 5.14k]
  ------------------
 2758|  17.5k|            win_tr_x0 = opj_uint_min(2 * win_ll_x0, 2 * win_hl_x0 + 1);
 2759|  17.5k|            win_tr_x1 = opj_uint_min(opj_uint_max(2 * win_ll_x1, 2 * win_hl_x1 + 1), rw);
 2760|  17.5k|        } else {
 2761|  5.14k|            win_tr_x0 = opj_uint_min(2 * win_hl_x0, 2 * win_ll_x0 + 1);
 2762|  5.14k|            win_tr_x1 = opj_uint_min(opj_uint_max(2 * win_hl_x1, 2 * win_ll_x1 + 1), rw);
 2763|  5.14k|        }
 2764|       |
 2765|  22.6k|        if (v.cas == 0) {
  ------------------
  |  Branch (2765:13): [True: 16.2k, False: 6.38k]
  ------------------
 2766|  16.2k|            win_tr_y0 = opj_uint_min(2 * win_ll_y0, 2 * win_lh_y0 + 1);
 2767|  16.2k|            win_tr_y1 = opj_uint_min(opj_uint_max(2 * win_ll_y1, 2 * win_lh_y1 + 1), rh);
 2768|  16.2k|        } else {
 2769|  6.38k|            win_tr_y0 = opj_uint_min(2 * win_lh_y0, 2 * win_ll_y0 + 1);
 2770|  6.38k|            win_tr_y1 = opj_uint_min(opj_uint_max(2 * win_lh_y1, 2 * win_ll_y1 + 1), rh);
 2771|  6.38k|        }
 2772|       |
 2773|   172M|        for (j = 0; j < rh; ++j) {
  ------------------
  |  Branch (2773:21): [True: 172M, False: 22.6k]
  ------------------
 2774|   172M|            if ((j >= win_ll_y0 && j < win_ll_y1) ||
  ------------------
  |  Branch (2774:18): [True: 172M, False: 0]
  |  Branch (2774:36): [True: 373k, False: 171M]
  ------------------
 2775|   172M|                    (j >= win_lh_y0 + (OPJ_UINT32)v.sn && j < win_lh_y1 + (OPJ_UINT32)v.sn)) {
  ------------------
  |  Branch (2775:22): [True: 86.0M, False: 85.6M]
  |  Branch (2775:59): [True: 367k, False: 85.6M]
  ------------------
 2776|       |
 2777|       |                /* Avoids dwt.c:1584:44 (in opj_dwt_decode_partial_1): runtime error: */
 2778|       |                /* signed integer overflow: -1094795586 + -1094795586 cannot be represented in type 'int' */
 2779|       |                /* on opj_decompress -i  ../../openjpeg/MAPA.jp2 -o out.tif -d 0,0,256,256 */
 2780|       |                /* This is less extreme than memsetting the whole buffer to 0 */
 2781|       |                /* although we could potentially do better with better handling of edge conditions */
 2782|   740k|                if (win_tr_x1 >= 1 && win_tr_x1 < rw) {
  ------------------
  |  Branch (2782:21): [True: 736k, False: 4.82k]
  |  Branch (2782:39): [True: 604k, False: 131k]
  ------------------
 2783|   604k|                    h.mem[win_tr_x1 - 1] = 0;
 2784|   604k|                }
 2785|   740k|                if (win_tr_x1 < rw) {
  ------------------
  |  Branch (2785:21): [True: 604k, False: 135k]
  ------------------
 2786|   604k|                    h.mem[win_tr_x1] = 0;
 2787|   604k|                }
 2788|       |
 2789|   740k|                opj_dwt_interleave_partial_h(h.mem,
 2790|   740k|                                             h.cas,
 2791|   740k|                                             sa,
 2792|   740k|                                             j,
 2793|   740k|                                             (OPJ_UINT32)h.sn,
 2794|   740k|                                             win_ll_x0,
 2795|   740k|                                             win_ll_x1,
 2796|   740k|                                             win_hl_x0,
 2797|   740k|                                             win_hl_x1);
 2798|   740k|                opj_dwt_decode_partial_1(h.mem, h.dn, h.sn, h.cas,
 2799|   740k|                                         (OPJ_INT32)win_ll_x0,
 2800|   740k|                                         (OPJ_INT32)win_ll_x1,
 2801|   740k|                                         (OPJ_INT32)win_hl_x0,
 2802|   740k|                                         (OPJ_INT32)win_hl_x1);
 2803|   740k|                if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (2803:21): [True: 0, False: 740k]
  ------------------
 2804|   740k|                                                  win_tr_x0, j,
 2805|   740k|                                                  win_tr_x1, j + 1,
 2806|   740k|                                                  h.mem + win_tr_x0,
 2807|   740k|                                                  1, 0, OPJ_TRUE)) {
  ------------------
  |  |  117|   740k|#define OPJ_TRUE 1
  ------------------
 2808|       |                    /* FIXME event manager error callback */
 2809|      0|                    opj_sparse_array_int32_free(sa);
 2810|      0|                    opj_aligned_free(h.mem);
 2811|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2812|      0|                }
 2813|   740k|            }
 2814|   172M|        }
 2815|       |
 2816|   230k|        for (i = win_tr_x0; i < win_tr_x1;) {
  ------------------
  |  Branch (2816:29): [True: 208k, False: 22.6k]
  ------------------
 2817|   208k|            OPJ_UINT32 nb_cols = opj_uint_min(4U, win_tr_x1 - i);
 2818|   208k|            opj_dwt_interleave_partial_v(v.mem,
 2819|   208k|                                         v.cas,
 2820|   208k|                                         sa,
 2821|   208k|                                         i,
 2822|   208k|                                         nb_cols,
 2823|   208k|                                         (OPJ_UINT32)v.sn,
 2824|   208k|                                         win_ll_y0,
 2825|   208k|                                         win_ll_y1,
 2826|   208k|                                         win_lh_y0,
 2827|   208k|                                         win_lh_y1);
 2828|   208k|            opj_dwt_decode_partial_1_parallel(v.mem, nb_cols, v.dn, v.sn, v.cas,
 2829|   208k|                                              (OPJ_INT32)win_ll_y0,
 2830|   208k|                                              (OPJ_INT32)win_ll_y1,
 2831|   208k|                                              (OPJ_INT32)win_lh_y0,
 2832|   208k|                                              (OPJ_INT32)win_lh_y1);
 2833|   208k|            if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (2833:17): [True: 0, False: 208k]
  ------------------
 2834|   208k|                                              i, win_tr_y0,
 2835|   208k|                                              i + nb_cols, win_tr_y1,
 2836|   208k|                                              v.mem + 4 * win_tr_y0,
 2837|   208k|                                              1, 4, OPJ_TRUE)) {
  ------------------
  |  |  117|   208k|#define OPJ_TRUE 1
  ------------------
 2838|       |                /* FIXME event manager error callback */
 2839|      0|                opj_sparse_array_int32_free(sa);
 2840|      0|                opj_aligned_free(h.mem);
 2841|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2842|      0|            }
 2843|       |
 2844|   208k|            i += nb_cols;
 2845|   208k|        }
 2846|  22.6k|    }
 2847|  3.42k|    opj_aligned_free(h.mem);
 2848|       |
 2849|  3.42k|    {
 2850|  3.42k|        OPJ_BOOL ret = opj_sparse_array_int32_read(sa,
 2851|  3.42k|                       tr_max->win_x0 - (OPJ_UINT32)tr_max->x0,
 2852|  3.42k|                       tr_max->win_y0 - (OPJ_UINT32)tr_max->y0,
 2853|  3.42k|                       tr_max->win_x1 - (OPJ_UINT32)tr_max->x0,
 2854|  3.42k|                       tr_max->win_y1 - (OPJ_UINT32)tr_max->y0,
 2855|  3.42k|                       tilec->data_win,
 2856|  3.42k|                       1, tr_max->win_x1 - tr_max->win_x0,
 2857|  3.42k|                       OPJ_TRUE);
  ------------------
  |  |  117|  3.42k|#define OPJ_TRUE 1
  ------------------
 2858|  3.42k|        assert(ret);
 2859|  3.42k|        OPJ_UNUSED(ret);
  ------------------
  |  |  219|  3.42k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2860|  3.42k|    }
 2861|  3.42k|    opj_sparse_array_int32_free(sa);
 2862|  3.42k|    return OPJ_TRUE;
  ------------------
  |  |  117|  3.42k|#define OPJ_TRUE 1
  ------------------
 2863|  3.42k|}
dwt.c:opj_dwt_init_sparse_array:
 2566|  16.0k|{
 2567|  16.0k|    opj_tcd_resolution_t* tr_max = &(tilec->resolutions[numres - 1]);
 2568|  16.0k|    OPJ_UINT32 w = (OPJ_UINT32)(tr_max->x1 - tr_max->x0);
 2569|  16.0k|    OPJ_UINT32 h = (OPJ_UINT32)(tr_max->y1 - tr_max->y0);
 2570|  16.0k|    OPJ_UINT32 resno, bandno, precno, cblkno;
 2571|  16.0k|    opj_sparse_array_int32_t* sa = opj_sparse_array_int32_create(
 2572|  16.0k|                                       w, h, opj_uint_min(w, 64), opj_uint_min(h, 64));
 2573|  16.0k|    if (sa == NULL) {
  ------------------
  |  Branch (2573:9): [True: 0, False: 16.0k]
  ------------------
 2574|      0|        return NULL;
 2575|      0|    }
 2576|       |
 2577|  82.9k|    for (resno = 0; resno < numres; ++resno) {
  ------------------
  |  Branch (2577:21): [True: 66.8k, False: 16.0k]
  ------------------
 2578|  66.8k|        opj_tcd_resolution_t* res = &tilec->resolutions[resno];
 2579|       |
 2580|   235k|        for (bandno = 0; bandno < res->numbands; ++bandno) {
  ------------------
  |  Branch (2580:26): [True: 168k, False: 66.8k]
  ------------------
 2581|   168k|            opj_tcd_band_t* band = &res->bands[bandno];
 2582|       |
 2583|   613k|            for (precno = 0; precno < res->pw * res->ph; ++precno) {
  ------------------
  |  Branch (2583:30): [True: 445k, False: 168k]
  ------------------
 2584|   445k|                opj_tcd_precinct_t* precinct = &band->precincts[precno];
 2585|  58.2M|                for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) {
  ------------------
  |  Branch (2585:34): [True: 57.8M, False: 445k]
  ------------------
 2586|  57.8M|                    opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno];
 2587|  57.8M|                    if (cblk->decoded_data != NULL) {
  ------------------
  |  Branch (2587:25): [True: 768k, False: 57.0M]
  ------------------
 2588|   768k|                        OPJ_UINT32 x = (OPJ_UINT32)(cblk->x0 - band->x0);
 2589|   768k|                        OPJ_UINT32 y = (OPJ_UINT32)(cblk->y0 - band->y0);
 2590|   768k|                        OPJ_UINT32 cblk_w = (OPJ_UINT32)(cblk->x1 - cblk->x0);
 2591|   768k|                        OPJ_UINT32 cblk_h = (OPJ_UINT32)(cblk->y1 - cblk->y0);
 2592|       |
 2593|   768k|                        if (band->bandno & 1) {
  ------------------
  |  Branch (2593:29): [True: 296k, False: 471k]
  ------------------
 2594|   296k|                            opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
 2595|   296k|                            x += (OPJ_UINT32)(pres->x1 - pres->x0);
 2596|   296k|                        }
 2597|   768k|                        if (band->bandno & 2) {
  ------------------
  |  Branch (2597:29): [True: 299k, False: 468k]
  ------------------
 2598|   299k|                            opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
 2599|   299k|                            y += (OPJ_UINT32)(pres->y1 - pres->y0);
 2600|   299k|                        }
 2601|       |
 2602|   768k|                        if (!opj_sparse_array_int32_write(sa, x, y,
  ------------------
  |  Branch (2602:29): [True: 0, False: 768k]
  ------------------
 2603|   768k|                                                          x + cblk_w, y + cblk_h,
 2604|   768k|                                                          cblk->decoded_data,
 2605|   768k|                                                          1, cblk_w, OPJ_TRUE)) {
  ------------------
  |  |  117|   768k|#define OPJ_TRUE 1
  ------------------
 2606|      0|                            opj_sparse_array_int32_free(sa);
 2607|      0|                            return NULL;
 2608|      0|                        }
 2609|   768k|                    }
 2610|  57.8M|                }
 2611|   445k|            }
 2612|   168k|        }
 2613|  66.8k|    }
 2614|       |
 2615|  16.0k|    return sa;
 2616|  16.0k|}
dwt.c:opj_dwt_get_band_coordinates:
 2521|   152k|{
 2522|       |    /* Compute number of decomposition for this band. See table F-1 */
 2523|   152k|    OPJ_UINT32 nb = (resno == 0) ?
  ------------------
  |  Branch (2523:21): [True: 0, False: 152k]
  ------------------
 2524|      0|                    tilec->numresolutions - 1 :
 2525|   152k|                    tilec->numresolutions - resno;
 2526|       |    /* Map above tile-based coordinates to sub-band-based coordinates per */
 2527|       |    /* equation B-15 of the standard */
 2528|   152k|    OPJ_UINT32 x0b = bandno & 1;
 2529|   152k|    OPJ_UINT32 y0b = bandno >> 1;
 2530|   152k|    if (tbx0) {
  ------------------
  |  Branch (2530:9): [True: 101k, False: 50.8k]
  ------------------
 2531|   101k|        *tbx0 = (nb == 0) ? tcx0 :
  ------------------
  |  Branch (2531:17): [True: 0, False: 101k]
  ------------------
 2532|   101k|                (tcx0 <= (1U << (nb - 1)) * x0b) ? 0 :
  ------------------
  |  Branch (2532:17): [True: 59.3k, False: 42.3k]
  ------------------
 2533|   101k|                opj_uint_ceildivpow2(tcx0 - (1U << (nb - 1)) * x0b, nb);
 2534|   101k|    }
 2535|   152k|    if (tby0) {
  ------------------
  |  Branch (2535:9): [True: 101k, False: 50.8k]
  ------------------
 2536|   101k|        *tby0 = (nb == 0) ? tcy0 :
  ------------------
  |  Branch (2536:17): [True: 0, False: 101k]
  ------------------
 2537|   101k|                (tcy0 <= (1U << (nb - 1)) * y0b) ? 0 :
  ------------------
  |  Branch (2537:17): [True: 63.3k, False: 38.3k]
  ------------------
 2538|   101k|                opj_uint_ceildivpow2(tcy0 - (1U << (nb - 1)) * y0b, nb);
 2539|   101k|    }
 2540|   152k|    if (tbx1) {
  ------------------
  |  Branch (2540:9): [True: 101k, False: 50.8k]
  ------------------
 2541|   101k|        *tbx1 = (nb == 0) ? tcx1 :
  ------------------
  |  Branch (2541:17): [True: 0, False: 101k]
  ------------------
 2542|   101k|                (tcx1 <= (1U << (nb - 1)) * x0b) ? 0 :
  ------------------
  |  Branch (2542:17): [True: 20.3k, False: 81.3k]
  ------------------
 2543|   101k|                opj_uint_ceildivpow2(tcx1 - (1U << (nb - 1)) * x0b, nb);
 2544|   101k|    }
 2545|   152k|    if (tby1) {
  ------------------
  |  Branch (2545:9): [True: 101k, False: 50.8k]
  ------------------
 2546|   101k|        *tby1 = (nb == 0) ? tcy1 :
  ------------------
  |  Branch (2546:17): [True: 0, False: 101k]
  ------------------
 2547|   101k|                (tcy1 <= (1U << (nb - 1)) * y0b) ? 0 :
  ------------------
  |  Branch (2547:17): [True: 18.6k, False: 83.0k]
  ------------------
 2548|   101k|                opj_uint_ceildivpow2(tcy1 - (1U << (nb - 1)) * y0b, nb);
 2549|   101k|    }
 2550|   152k|}
dwt.c:opj_dwt_segment_grow:
 2556|   203k|{
 2557|   203k|    *start = opj_uint_subs(*start, filter_width);
 2558|   203k|    *end = opj_uint_adds(*end, filter_width);
 2559|   203k|    *end = opj_uint_min(*end, max_size);
 2560|   203k|}
dwt.c:opj_dwt_interleave_partial_h:
 2238|   740k|{
 2239|   740k|    OPJ_BOOL ret;
 2240|   740k|    ret = opj_sparse_array_int32_read(sa,
 2241|   740k|                                      win_l_x0, sa_line,
 2242|   740k|                                      win_l_x1, sa_line + 1,
 2243|   740k|                                      dest + cas + 2 * win_l_x0,
 2244|   740k|                                      2, 0, OPJ_TRUE);
  ------------------
  |  |  117|   740k|#define OPJ_TRUE 1
  ------------------
 2245|   740k|    assert(ret);
 2246|   740k|    ret = opj_sparse_array_int32_read(sa,
 2247|   740k|                                      sn + win_h_x0, sa_line,
 2248|   740k|                                      sn + win_h_x1, sa_line + 1,
 2249|   740k|                                      dest + 1 - cas + 2 * win_h_x0,
 2250|   740k|                                      2, 0, OPJ_TRUE);
  ------------------
  |  |  117|   740k|#define OPJ_TRUE 1
  ------------------
 2251|   740k|    assert(ret);
 2252|   740k|    OPJ_UNUSED(ret);
  ------------------
  |  |  219|   740k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2253|   740k|}
dwt.c:opj_dwt_decode_partial_1:
 2289|   740k|{
 2290|   740k|    OPJ_INT32 i;
 2291|       |
 2292|   740k|    if (!cas) {
  ------------------
  |  Branch (2292:9): [True: 714k, False: 26.6k]
  ------------------
 2293|   714k|        if ((dn > 0) || (sn > 1)) { /* NEW :  CASE ONE ELEMENT */
  ------------------
  |  Branch (2293:13): [True: 691k, False: 22.9k]
  |  Branch (2293:25): [True: 0, False: 22.9k]
  ------------------
 2294|       |
 2295|       |            /* Naive version is :
 2296|       |            for (i = win_l_x0; i < i_max; i++) {
 2297|       |                OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
 2298|       |            }
 2299|       |            for (i = win_h_x0; i < win_h_x1; i++) {
 2300|       |                OPJ_D(i) += (OPJ_S_(i) + OPJ_S_(i + 1)) >> 1;
 2301|       |            }
 2302|       |            but the compiler doesn't manage to unroll it to avoid bound
 2303|       |            checking in OPJ_S_ and OPJ_D_ macros
 2304|       |            */
 2305|       |
 2306|   691k|            i = win_l_x0;
 2307|   691k|            if (i < win_l_x1) {
  ------------------
  |  Branch (2307:17): [True: 691k, False: 0]
  ------------------
 2308|   691k|                OPJ_INT32 i_max;
 2309|       |
 2310|       |                /* Left-most case */
 2311|   691k|                OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
  ------------------
  |  |  184|   691k|#define OPJ_S(i) a[(i)*2]
  ------------------
                              OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
  ------------------
  |  |  187|   691k|#define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  185|   691k|#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)))
  |  |  ------------------
  |  |  |  |  185|      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)))
  |  |  ------------------
  |  |  |  |  185|      0|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |  |  Branch (187:20): [True: 691k, False: 0]
  |  |  |  Branch (187:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                              OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
  ------------------
  |  |  187|   691k|#define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  185|      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)))
  |  |  ------------------
  |  |  |  |  185|      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)))
  |  |  ------------------
  |  |  |  |  185|   691k|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |  |  Branch (187:20): [True: 0, False: 691k]
  |  |  |  Branch (187:36): [True: 0, False: 691k]
  |  |  ------------------
  ------------------
 2312|   691k|                i ++;
 2313|       |
 2314|   691k|                i_max = win_l_x1;
 2315|   691k|                if (i_max > dn) {
  ------------------
  |  Branch (2315:21): [True: 22.9k, False: 668k]
  ------------------
 2316|  22.9k|                    i_max = dn;
 2317|  22.9k|                }
 2318|  79.0M|                for (; i < i_max; i++) {
  ------------------
  |  Branch (2318:24): [True: 78.3M, False: 691k]
  ------------------
 2319|       |                    /* No bound checking */
 2320|  78.3M|                    OPJ_S(i) -= (OPJ_D(i - 1) + OPJ_D(i) + 2) >> 2;
  ------------------
  |  |  184|  78.3M|#define OPJ_S(i) a[(i)*2]
  ------------------
                                  OPJ_S(i) -= (OPJ_D(i - 1) + OPJ_D(i) + 2) >> 2;
  ------------------
  |  |  185|  78.3M|#define OPJ_D(i) a[(1+(i)*2)]
  ------------------
                                  OPJ_S(i) -= (OPJ_D(i - 1) + OPJ_D(i) + 2) >> 2;
  ------------------
  |  |  185|  78.3M|#define OPJ_D(i) a[(1+(i)*2)]
  ------------------
 2321|  78.3M|                }
 2322|   714k|                for (; i < win_l_x1; i++) {
  ------------------
  |  Branch (2322:24): [True: 22.9k, False: 691k]
  ------------------
 2323|       |                    /* Right-most case */
 2324|  22.9k|                    OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
  ------------------
  |  |  184|  22.9k|#define OPJ_S(i) a[(i)*2]
  ------------------
                                  OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
  ------------------
  |  |  187|  22.9k|#define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  185|      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)))
  |  |  ------------------
  |  |  |  |  185|      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)))
  |  |  ------------------
  |  |  |  |  185|  22.9k|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |  |  Branch (187:20): [True: 0, False: 22.9k]
  |  |  |  Branch (187:36): [True: 0, False: 22.9k]
  |  |  ------------------
  ------------------
                                  OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
  ------------------
  |  |  187|  22.9k|#define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  185|      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)))
  |  |  ------------------
  |  |  |  |  185|  22.9k|#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)))
  |  |  ------------------
  |  |  |  |  185|      0|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |  |  Branch (187:20): [True: 0, False: 22.9k]
  |  |  |  Branch (187:36): [True: 22.9k, False: 0]
  |  |  ------------------
  ------------------
 2325|  22.9k|                }
 2326|   691k|            }
 2327|       |
 2328|   691k|            i = win_h_x0;
 2329|   691k|            if (i < win_h_x1) {
  ------------------
  |  Branch (2329:17): [True: 691k, False: 0]
  ------------------
 2330|   691k|                OPJ_INT32 i_max = win_h_x1;
 2331|   691k|                if (i_max >= sn) {
  ------------------
  |  Branch (2331:21): [True: 72.2k, False: 618k]
  ------------------
 2332|  72.2k|                    i_max = sn - 1;
 2333|  72.2k|                }
 2334|  79.4M|                for (; i < i_max; i++) {
  ------------------
  |  Branch (2334:24): [True: 78.7M, False: 691k]
  ------------------
 2335|       |                    /* No bound checking */
 2336|  78.7M|                    OPJ_D(i) += (OPJ_S(i) + OPJ_S(i + 1)) >> 1;
  ------------------
  |  |  185|  78.7M|#define OPJ_D(i) a[(1+(i)*2)]
  ------------------
                                  OPJ_D(i) += (OPJ_S(i) + OPJ_S(i + 1)) >> 1;
  ------------------
  |  |  184|  78.7M|#define OPJ_S(i) a[(i)*2]
  ------------------
                                  OPJ_D(i) += (OPJ_S(i) + OPJ_S(i + 1)) >> 1;
  ------------------
  |  |  184|  78.7M|#define OPJ_S(i) a[(i)*2]
  ------------------
 2337|  78.7M|                }
 2338|   763k|                for (; i < win_h_x1; i++) {
  ------------------
  |  Branch (2338:24): [True: 72.2k, False: 691k]
  ------------------
 2339|       |                    /* Right-most case */
 2340|  72.2k|                    OPJ_D(i) += (OPJ_S_(i) + OPJ_S_(i + 1)) >> 1;
  ------------------
  |  |  185|  72.2k|#define OPJ_D(i) a[(1+(i)*2)]
  ------------------
                                  OPJ_D(i) += (OPJ_S_(i) + OPJ_S_(i + 1)) >> 1;
  ------------------
  |  |  186|  72.2k|#define OPJ_S_(i) ((i)<0?OPJ_S(0):((i)>=sn?OPJ_S(sn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  184|      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)))
  |  |  ------------------
  |  |  |  |  184|      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)))
  |  |  ------------------
  |  |  |  |  184|  72.2k|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |  |  Branch (186:20): [True: 0, False: 72.2k]
  |  |  |  Branch (186:36): [True: 0, False: 72.2k]
  |  |  ------------------
  ------------------
                                  OPJ_D(i) += (OPJ_S_(i) + OPJ_S_(i + 1)) >> 1;
  ------------------
  |  |  186|  72.2k|#define OPJ_S_(i) ((i)<0?OPJ_S(0):((i)>=sn?OPJ_S(sn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  184|      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)))
  |  |  ------------------
  |  |  |  |  184|  72.2k|#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)))
  |  |  ------------------
  |  |  |  |  184|      0|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |  |  Branch (186:20): [True: 0, False: 72.2k]
  |  |  |  Branch (186:36): [True: 72.2k, False: 0]
  |  |  ------------------
  ------------------
 2341|  72.2k|                }
 2342|   691k|            }
 2343|   691k|        }
 2344|   714k|    } else {
 2345|  26.6k|        if (!sn  && dn == 1) {        /* NEW :  CASE ONE ELEMENT */
  ------------------
  |  Branch (2345:13): [True: 9.48k, False: 17.2k]
  |  Branch (2345:21): [True: 5.56k, False: 3.91k]
  ------------------
 2346|  5.56k|            OPJ_S(0) /= 2;
  ------------------
  |  |  184|  5.56k|#define OPJ_S(i) a[(i)*2]
  ------------------
 2347|  21.1k|        } else {
 2348|   914k|            for (i = win_l_x0; i < win_l_x1; i++) {
  ------------------
  |  Branch (2348:32): [True: 893k, False: 21.1k]
  ------------------
 2349|   893k|                OPJ_D(i) = opj_int_sub_no_overflow(OPJ_D(i),
  ------------------
  |  |  185|   893k|#define OPJ_D(i) a[(1+(i)*2)]
  ------------------
                              OPJ_D(i) = opj_int_sub_no_overflow(OPJ_D(i),
  ------------------
  |  |  185|   893k|#define OPJ_D(i) a[(1+(i)*2)]
  ------------------
 2350|   893k|                                                   opj_int_add_no_overflow(opj_int_add_no_overflow(OPJ_SS_(i), OPJ_SS_(i + 1)),
  ------------------
  |  |  189|   893k|#define OPJ_SS_(i) ((i)<0?OPJ_S(0):((i)>=dn?OPJ_S(dn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  184|      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)))
  |  |  ------------------
  |  |  |  |  184|      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)))
  |  |  ------------------
  |  |  |  |  184|   893k|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |  |  Branch (189:21): [True: 0, False: 893k]
  |  |  |  Branch (189:37): [True: 0, False: 893k]
  |  |  ------------------
  ------------------
                                                                 opj_int_add_no_overflow(opj_int_add_no_overflow(OPJ_SS_(i), OPJ_SS_(i + 1)),
  ------------------
  |  |  189|   893k|#define OPJ_SS_(i) ((i)<0?OPJ_S(0):((i)>=dn?OPJ_S(dn-1):OPJ_S(i)))
  |  |  ------------------
  |  |  |  |  184|      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)))
  |  |  ------------------
  |  |  |  |  184|  1.61k|#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)))
  |  |  ------------------
  |  |  |  |  184|   891k|#define OPJ_S(i) a[(i)*2]
  |  |  ------------------
  |  |  |  Branch (189:21): [True: 0, False: 893k]
  |  |  |  Branch (189:37): [True: 1.61k, False: 891k]
  |  |  ------------------
  ------------------
 2351|   893k|                                                           2) >> 2);
 2352|   893k|            }
 2353|   922k|            for (i = win_h_x0; i < win_h_x1; i++) {
  ------------------
  |  Branch (2353:32): [True: 901k, False: 21.1k]
  ------------------
 2354|   901k|                OPJ_S(i) = opj_int_add_no_overflow(OPJ_S(i),
  ------------------
  |  |  184|   901k|#define OPJ_S(i) a[(i)*2]
  ------------------
                              OPJ_S(i) = opj_int_add_no_overflow(OPJ_S(i),
  ------------------
  |  |  184|   901k|#define OPJ_S(i) a[(i)*2]
  ------------------
 2355|   901k|                                                   opj_int_add_no_overflow(OPJ_DD_(i), OPJ_DD_(i - 1)) >> 1);
  ------------------
  |  |  190|   901k|#define OPJ_DD_(i) ((i)<0?OPJ_D(0):((i)>=sn?OPJ_D(sn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  185|      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)))
  |  |  ------------------
  |  |  |  |  185|  2.71k|#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)))
  |  |  ------------------
  |  |  |  |  185|   898k|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |  |  Branch (190:21): [True: 0, False: 901k]
  |  |  |  Branch (190:37): [True: 2.71k, False: 898k]
  |  |  ------------------
  ------------------
                                                                 opj_int_add_no_overflow(OPJ_DD_(i), OPJ_DD_(i - 1)) >> 1);
  ------------------
  |  |  190|   901k|#define OPJ_DD_(i) ((i)<0?OPJ_D(0):((i)>=sn?OPJ_D(sn-1):OPJ_D(i)))
  |  |  ------------------
  |  |  |  |  185|  17.2k|#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)))
  |  |  ------------------
  |  |  |  |  185|      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)))
  |  |  ------------------
  |  |  |  |  185|   884k|#define OPJ_D(i) a[(1+(i)*2)]
  |  |  ------------------
  |  |  |  Branch (190:21): [True: 17.2k, False: 884k]
  |  |  |  Branch (190:37): [True: 0, False: 884k]
  |  |  ------------------
  ------------------
 2356|   901k|            }
 2357|  21.1k|        }
 2358|  26.6k|    }
 2359|   740k|}
dwt.c:opj_dwt_interleave_partial_v:
 2266|   208k|{
 2267|   208k|    OPJ_BOOL ret;
 2268|   208k|    ret  = opj_sparse_array_int32_read(sa,
 2269|   208k|                                       sa_col, win_l_y0,
 2270|   208k|                                       sa_col + nb_cols, win_l_y1,
 2271|   208k|                                       dest + cas * 4 + 2 * 4 * win_l_y0,
 2272|   208k|                                       1, 2 * 4, OPJ_TRUE);
  ------------------
  |  |  117|   208k|#define OPJ_TRUE 1
  ------------------
 2273|   208k|    assert(ret);
 2274|   208k|    ret = opj_sparse_array_int32_read(sa,
 2275|   208k|                                      sa_col, sn + win_h_y0,
 2276|   208k|                                      sa_col + nb_cols, sn + win_h_y1,
 2277|   208k|                                      dest + (1 - cas) * 4 + 2 * 4 * win_h_y0,
 2278|   208k|                                      1, 2 * 4, OPJ_TRUE);
  ------------------
  |  |  117|   208k|#define OPJ_TRUE 1
  ------------------
 2279|   208k|    assert(ret);
 2280|   208k|    OPJ_UNUSED(ret);
  ------------------
  |  |  219|   208k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2281|   208k|}
dwt.c:opj_dwt_decode_partial_1_parallel:
 2376|   208k|{
 2377|   208k|    OPJ_INT32 i;
 2378|   208k|    OPJ_UINT32 off;
 2379|       |
 2380|   208k|    (void)nb_cols;
 2381|       |
 2382|   208k|    if (!cas) {
  ------------------
  |  Branch (2382:9): [True: 186k, False: 21.5k]
  ------------------
 2383|   186k|        if ((dn > 0) || (sn > 1)) { /* NEW :  CASE ONE ELEMENT */
  ------------------
  |  Branch (2383:13): [True: 177k, False: 9.25k]
  |  Branch (2383:25): [True: 0, False: 9.25k]
  ------------------
 2384|       |
 2385|       |            /* Naive version is :
 2386|       |            for (i = win_l_x0; i < i_max; i++) {
 2387|       |                OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2;
 2388|       |            }
 2389|       |            for (i = win_h_x0; i < win_h_x1; i++) {
 2390|       |                OPJ_D(i) += (OPJ_S_(i) + OPJ_S_(i + 1)) >> 1;
 2391|       |            }
 2392|       |            but the compiler doesn't manage to unroll it to avoid bound
 2393|       |            checking in OPJ_S_ and OPJ_D_ macros
 2394|       |            */
 2395|       |
 2396|   177k|            i = win_l_x0;
 2397|   177k|            if (i < win_l_x1) {
  ------------------
  |  Branch (2397:17): [True: 177k, False: 0]
  ------------------
 2398|   177k|                OPJ_INT32 i_max;
 2399|       |
 2400|       |                /* Left-most case */
 2401|   887k|                for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2401:31): [True: 709k, False: 177k]
  ------------------
 2402|   709k|                    OPJ_S_off(i, off) -= (OPJ_D__off(i - 1, off) + OPJ_D__off(i, off) + 2) >> 2;
  ------------------
  |  | 2361|   709k|#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;
  ------------------
  |  | 2364|   709k|#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)))
  |  |  ------------------
  |  |  |  | 2362|   709k|#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)))
  |  |  ------------------
  |  |  |  | 2362|      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)))
  |  |  ------------------
  |  |  |  | 2362|      0|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |  |  Branch (2364:28): [True: 709k, False: 0]
  |  |  |  Branch (2364:52): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                  OPJ_S_off(i, off) -= (OPJ_D__off(i - 1, off) + OPJ_D__off(i, off) + 2) >> 2;
  ------------------
  |  | 2364|   709k|#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)))
  |  |  ------------------
  |  |  |  | 2362|      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)))
  |  |  ------------------
  |  |  |  | 2362|      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)))
  |  |  ------------------
  |  |  |  | 2362|   709k|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |  |  Branch (2364:28): [True: 0, False: 709k]
  |  |  |  Branch (2364:52): [True: 0, False: 709k]
  |  |  ------------------
  ------------------
 2403|   709k|                }
 2404|   177k|                i ++;
 2405|       |
 2406|   177k|                i_max = win_l_x1;
 2407|   177k|                if (i_max > dn) {
  ------------------
  |  Branch (2407:21): [True: 11.3k, False: 166k]
  ------------------
 2408|  11.3k|                    i_max = dn;
 2409|  11.3k|                }
 2410|       |
 2411|   177k|#ifdef __SSE2__
 2412|   177k|                if (i + 1 < i_max) {
  ------------------
  |  Branch (2412:21): [True: 171k, False: 6.28k]
  ------------------
 2413|   171k|                    const __m128i two = _mm_set1_epi32(2);
 2414|   171k|                    __m128i Dm1 = _mm_load_si128((__m128i * const)(a + 4 + (i - 1) * 8));
 2415|  9.97M|                    for (; i + 1 < i_max; i += 2) {
  ------------------
  |  Branch (2415:28): [True: 9.80M, False: 171k]
  ------------------
 2416|       |                        /* No bound checking */
 2417|  9.80M|                        __m128i S = _mm_load_si128((__m128i * const)(a + i * 8));
 2418|  9.80M|                        __m128i D = _mm_load_si128((__m128i * const)(a + 4 + i * 8));
 2419|  9.80M|                        __m128i S1 = _mm_load_si128((__m128i * const)(a + (i + 1) * 8));
 2420|  9.80M|                        __m128i D1 = _mm_load_si128((__m128i * const)(a + 4 + (i + 1) * 8));
 2421|  9.80M|                        S = _mm_sub_epi32(S,
 2422|  9.80M|                                          _mm_srai_epi32(_mm_add_epi32(_mm_add_epi32(Dm1, D), two), 2));
 2423|  9.80M|                        S1 = _mm_sub_epi32(S1,
 2424|  9.80M|                                           _mm_srai_epi32(_mm_add_epi32(_mm_add_epi32(D, D1), two), 2));
 2425|  9.80M|                        _mm_store_si128((__m128i*)(a + i * 8), S);
 2426|  9.80M|                        _mm_store_si128((__m128i*)(a + (i + 1) * 8), S1);
 2427|  9.80M|                        Dm1 = D1;
 2428|  9.80M|                    }
 2429|   171k|                }
 2430|   177k|#endif
 2431|       |
 2432|   301k|                for (; i < i_max; i++) {
  ------------------
  |  Branch (2432:24): [True: 124k, False: 177k]
  ------------------
 2433|       |                    /* No bound checking */
 2434|   621k|                    for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2434:35): [True: 497k, False: 124k]
  ------------------
 2435|   497k|                        OPJ_S_off(i, off) -= (OPJ_D_off(i - 1, off) + OPJ_D_off(i, off) + 2) >> 2;
  ------------------
  |  | 2361|   497k|#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;
  ------------------
  |  | 2362|   497k|#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;
  ------------------
  |  | 2362|   497k|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  ------------------
 2436|   497k|                    }
 2437|   124k|                }
 2438|   188k|                for (; i < win_l_x1; i++) {
  ------------------
  |  Branch (2438:24): [True: 11.3k, False: 177k]
  ------------------
 2439|       |                    /* Right-most case */
 2440|  56.8k|                    for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2440:35): [True: 45.4k, False: 11.3k]
  ------------------
 2441|  45.4k|                        OPJ_S_off(i, off) -= (OPJ_D__off(i - 1, off) + OPJ_D__off(i, off) + 2) >> 2;
  ------------------
  |  | 2361|  45.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;
  ------------------
  |  | 2364|  45.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)))
  |  |  ------------------
  |  |  |  | 2362|      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)))
  |  |  ------------------
  |  |  |  | 2362|      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)))
  |  |  ------------------
  |  |  |  | 2362|  45.4k|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |  |  Branch (2364:28): [True: 0, False: 45.4k]
  |  |  |  Branch (2364:52): [True: 0, False: 45.4k]
  |  |  ------------------
  ------------------
                                      OPJ_S_off(i, off) -= (OPJ_D__off(i - 1, off) + OPJ_D__off(i, off) + 2) >> 2;
  ------------------
  |  | 2364|  45.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)))
  |  |  ------------------
  |  |  |  | 2362|      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)))
  |  |  ------------------
  |  |  |  | 2362|  45.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)))
  |  |  ------------------
  |  |  |  | 2362|      0|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |  |  Branch (2364:28): [True: 0, False: 45.4k]
  |  |  |  Branch (2364:52): [True: 45.4k, False: 0]
  |  |  ------------------
  ------------------
 2442|  45.4k|                    }
 2443|  11.3k|                }
 2444|   177k|            }
 2445|       |
 2446|   177k|            i = win_h_x0;
 2447|   177k|            if (i < win_h_x1) {
  ------------------
  |  Branch (2447:17): [True: 177k, False: 0]
  ------------------
 2448|   177k|                OPJ_INT32 i_max = win_h_x1;
 2449|   177k|                if (i_max >= sn) {
  ------------------
  |  Branch (2449:21): [True: 15.9k, False: 161k]
  ------------------
 2450|  15.9k|                    i_max = sn - 1;
 2451|  15.9k|                }
 2452|       |
 2453|   177k|#ifdef __SSE2__
 2454|   177k|                if (i + 1 < i_max) {
  ------------------
  |  Branch (2454:21): [True: 172k, False: 5.47k]
  ------------------
 2455|   172k|                    __m128i S =  _mm_load_si128((__m128i * const)(a + i * 8));
 2456|  10.0M|                    for (; i + 1 < i_max; i += 2) {
  ------------------
  |  Branch (2456:28): [True: 9.88M, False: 172k]
  ------------------
 2457|       |                        /* No bound checking */
 2458|  9.88M|                        __m128i D = _mm_load_si128((__m128i * const)(a + 4 + i * 8));
 2459|  9.88M|                        __m128i S1 = _mm_load_si128((__m128i * const)(a + (i + 1) * 8));
 2460|  9.88M|                        __m128i D1 = _mm_load_si128((__m128i * const)(a + 4 + (i + 1) * 8));
 2461|  9.88M|                        __m128i S2 = _mm_load_si128((__m128i * const)(a + (i + 2) * 8));
 2462|  9.88M|                        D = _mm_add_epi32(D, _mm_srai_epi32(_mm_add_epi32(S, S1), 1));
 2463|  9.88M|                        D1 = _mm_add_epi32(D1, _mm_srai_epi32(_mm_add_epi32(S1, S2), 1));
 2464|  9.88M|                        _mm_store_si128((__m128i*)(a + 4 + i * 8), D);
 2465|  9.88M|                        _mm_store_si128((__m128i*)(a + 4 + (i + 1) * 8), D1);
 2466|  9.88M|                        S = S2;
 2467|  9.88M|                    }
 2468|   172k|                }
 2469|   177k|#endif
 2470|       |
 2471|   249k|                for (; i < i_max; i++) {
  ------------------
  |  Branch (2471:24): [True: 72.5k, False: 177k]
  ------------------
 2472|       |                    /* No bound checking */
 2473|   362k|                    for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2473:35): [True: 290k, False: 72.5k]
  ------------------
 2474|   290k|                        OPJ_D_off(i, off) += (OPJ_S_off(i, off) + OPJ_S_off(i + 1, off)) >> 1;
  ------------------
  |  | 2362|   290k|#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;
  ------------------
  |  | 2361|   290k|#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;
  ------------------
  |  | 2361|   290k|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  ------------------
 2475|   290k|                    }
 2476|  72.5k|                }
 2477|   193k|                for (; i < win_h_x1; i++) {
  ------------------
  |  Branch (2477:24): [True: 15.9k, False: 177k]
  ------------------
 2478|       |                    /* Right-most case */
 2479|  79.5k|                    for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2479:35): [True: 63.6k, False: 15.9k]
  ------------------
 2480|  63.6k|                        OPJ_D_off(i, off) += (OPJ_S__off(i, off) + OPJ_S__off(i + 1, off)) >> 1;
  ------------------
  |  | 2362|  63.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;
  ------------------
  |  | 2363|  63.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)))
  |  |  ------------------
  |  |  |  | 2361|      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)))
  |  |  ------------------
  |  |  |  | 2361|      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)))
  |  |  ------------------
  |  |  |  | 2361|  63.6k|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |  |  Branch (2363:28): [True: 0, False: 63.6k]
  |  |  |  Branch (2363:52): [True: 0, False: 63.6k]
  |  |  ------------------
  ------------------
                                      OPJ_D_off(i, off) += (OPJ_S__off(i, off) + OPJ_S__off(i + 1, off)) >> 1;
  ------------------
  |  | 2363|  63.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)))
  |  |  ------------------
  |  |  |  | 2361|      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)))
  |  |  ------------------
  |  |  |  | 2361|  63.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)))
  |  |  ------------------
  |  |  |  | 2361|      0|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |  |  Branch (2363:28): [True: 0, False: 63.6k]
  |  |  |  Branch (2363:52): [True: 63.6k, False: 0]
  |  |  ------------------
  ------------------
 2481|  63.6k|                    }
 2482|  15.9k|                }
 2483|   177k|            }
 2484|   177k|        }
 2485|   186k|    } else {
 2486|  21.5k|        if (!sn  && dn == 1) {        /* NEW :  CASE ONE ELEMENT */
  ------------------
  |  Branch (2486:13): [True: 7.23k, False: 14.2k]
  |  Branch (2486:21): [True: 1.98k, False: 5.25k]
  ------------------
 2487|  9.92k|            for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2487:27): [True: 7.93k, False: 1.98k]
  ------------------
 2488|  7.93k|                OPJ_S_off(0, off) /= 2;
  ------------------
  |  | 2361|  7.93k|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  ------------------
 2489|  7.93k|            }
 2490|  19.5k|        } else {
 2491|   312k|            for (i = win_l_x0; i < win_l_x1; i++) {
  ------------------
  |  Branch (2491:32): [True: 292k, False: 19.5k]
  ------------------
 2492|  1.46M|                for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2492:31): [True: 1.17M, False: 292k]
  ------------------
 2493|  1.17M|                    OPJ_D_off(i, off) = opj_int_sub_no_overflow(
  ------------------
  |  | 2362|  1.17M|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  ------------------
 2494|  1.17M|                                            OPJ_D_off(i, off),
  ------------------
  |  | 2362|  1.17M|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  ------------------
 2495|  1.17M|                                            opj_int_add_no_overflow(
 2496|  1.17M|                                                opj_int_add_no_overflow(OPJ_SS__off(i, off), OPJ_SS__off(i + 1, off)), 2) >> 2);
  ------------------
  |  | 2365|  1.17M|#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)))
  |  |  ------------------
  |  |  |  | 2361|      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)))
  |  |  ------------------
  |  |  |  | 2361|      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)))
  |  |  ------------------
  |  |  |  | 2361|  1.17M|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |  |  Branch (2365:29): [True: 0, False: 1.17M]
  |  |  |  Branch (2365:53): [True: 0, False: 1.17M]
  |  |  ------------------
  ------------------
                                                              opj_int_add_no_overflow(OPJ_SS__off(i, off), OPJ_SS__off(i + 1, off)), 2) >> 2);
  ------------------
  |  | 2365|  1.17M|#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)))
  |  |  ------------------
  |  |  |  | 2361|      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)))
  |  |  ------------------
  |  |  |  | 2361|  22.0k|#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)))
  |  |  ------------------
  |  |  |  | 2361|  1.14M|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  |  |  ------------------
  |  |  |  Branch (2365:29): [True: 0, False: 1.17M]
  |  |  |  Branch (2365:53): [True: 22.0k, False: 1.14M]
  |  |  ------------------
  ------------------
 2497|  1.17M|                }
 2498|   292k|            }
 2499|   320k|            for (i = win_h_x0; i < win_h_x1; i++) {
  ------------------
  |  Branch (2499:32): [True: 301k, False: 19.5k]
  ------------------
 2500|  1.50M|                for (off = 0; off < 4; off++) {
  ------------------
  |  Branch (2500:31): [True: 1.20M, False: 301k]
  ------------------
 2501|  1.20M|                    OPJ_S_off(i, off) = opj_int_add_no_overflow(
  ------------------
  |  | 2361|  1.20M|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  ------------------
 2502|  1.20M|                                            OPJ_S_off(i, off),
  ------------------
  |  | 2361|  1.20M|#define OPJ_S_off(i,off) a[(OPJ_UINT32)(i)*2*4+off]
  ------------------
 2503|  1.20M|                                            opj_int_add_no_overflow(OPJ_DD__off(i, off), OPJ_DD__off(i - 1, off)) >> 1);
  ------------------
  |  | 2366|  1.20M|#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)))
  |  |  ------------------
  |  |  |  | 2362|      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)))
  |  |  ------------------
  |  |  |  | 2362|  29.5k|#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)))
  |  |  ------------------
  |  |  |  | 2362|  1.17M|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |  |  Branch (2366:29): [True: 0, False: 1.20M]
  |  |  |  Branch (2366:53): [True: 29.5k, False: 1.17M]
  |  |  ------------------
  ------------------
                                                          opj_int_add_no_overflow(OPJ_DD__off(i, off), OPJ_DD__off(i - 1, off)) >> 1);
  ------------------
  |  | 2366|  1.20M|#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)))
  |  |  ------------------
  |  |  |  | 2362|  57.1k|#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)))
  |  |  ------------------
  |  |  |  | 2362|      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)))
  |  |  ------------------
  |  |  |  | 2362|  1.14M|#define OPJ_D_off(i,off) a[(1+(OPJ_UINT32)(i)*2)*4+off]
  |  |  ------------------
  |  |  |  Branch (2366:29): [True: 57.1k, False: 1.14M]
  |  |  |  Branch (2366:53): [True: 0, False: 1.14M]
  |  |  ------------------
  ------------------
 2504|  1.20M|                }
 2505|   301k|            }
 2506|  19.5k|        }
 2507|  21.5k|    }
 2508|   208k|}
dwt.c:opj_dwt_decode_tile_97:
 3304|  3.72k|{
 3305|  3.72k|    opj_v8dwt_t h;
 3306|  3.72k|    opj_v8dwt_t v;
 3307|       |
 3308|  3.72k|    opj_tcd_resolution_t* res = tilec->resolutions;
 3309|       |
 3310|  3.72k|    OPJ_UINT32 rw = (OPJ_UINT32)(res->x1 -
 3311|  3.72k|                                 res->x0);    /* width of the resolution level computed */
 3312|  3.72k|    OPJ_UINT32 rh = (OPJ_UINT32)(res->y1 -
 3313|  3.72k|                                 res->y0);    /* height of the resolution level computed */
 3314|       |
 3315|  3.72k|    OPJ_UINT32 w = (OPJ_UINT32)(tilec->resolutions[tilec->minimum_num_resolutions -
 3316|  3.72k|                                                               1].x1 -
 3317|  3.72k|                                tilec->resolutions[tilec->minimum_num_resolutions - 1].x0);
 3318|       |
 3319|  3.72k|    OPJ_SIZE_T l_data_size;
 3320|  3.72k|    const int num_threads = opj_thread_pool_get_thread_count(tp);
 3321|       |
 3322|  3.72k|    if (numres == 1) {
  ------------------
  |  Branch (3322:9): [True: 1.83k, False: 1.89k]
  ------------------
 3323|  1.83k|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.83k|#define OPJ_TRUE 1
  ------------------
 3324|  1.83k|    }
 3325|       |
 3326|  1.89k|    l_data_size = opj_dwt_max_resolution(res, numres);
 3327|       |    /* overflow check */
 3328|  1.89k|    if (l_data_size > (SIZE_MAX / sizeof(opj_v8_t))) {
  ------------------
  |  Branch (3328:9): [True: 0, False: 1.89k]
  ------------------
 3329|       |        /* FIXME event manager error callback */
 3330|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3331|      0|    }
 3332|  1.89k|    h.wavelet = (opj_v8_t*) opj_aligned_malloc(l_data_size * sizeof(opj_v8_t));
 3333|  1.89k|    if (!h.wavelet) {
  ------------------
  |  Branch (3333:9): [True: 0, False: 1.89k]
  ------------------
 3334|       |        /* FIXME event manager error callback */
 3335|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3336|      0|    }
 3337|  1.89k|    v.wavelet = h.wavelet;
 3338|       |
 3339|  21.8k|    while (--numres) {
  ------------------
  |  Branch (3339:12): [True: 20.0k, False: 1.89k]
  ------------------
 3340|  20.0k|        OPJ_FLOAT32 * OPJ_RESTRICT aj = (OPJ_FLOAT32*) tilec->data;
 3341|  20.0k|        OPJ_UINT32 j;
 3342|       |
 3343|  20.0k|        h.sn = (OPJ_INT32)rw;
 3344|  20.0k|        v.sn = (OPJ_INT32)rh;
 3345|       |
 3346|  20.0k|        ++res;
 3347|       |
 3348|  20.0k|        rw = (OPJ_UINT32)(res->x1 -
 3349|  20.0k|                          res->x0);   /* width of the resolution level computed */
 3350|  20.0k|        rh = (OPJ_UINT32)(res->y1 -
 3351|  20.0k|                          res->y0);   /* height of the resolution level computed */
 3352|       |
 3353|  20.0k|        h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
 3354|  20.0k|        h.cas = res->x0 % 2;
 3355|       |
 3356|  20.0k|        h.win_l_x0 = 0;
 3357|  20.0k|        h.win_l_x1 = (OPJ_UINT32)h.sn;
 3358|  20.0k|        h.win_h_x0 = 0;
 3359|  20.0k|        h.win_h_x1 = (OPJ_UINT32)h.dn;
 3360|       |
 3361|  20.0k|        if (num_threads <= 1 || rh < 2 * NB_ELTS_V8) {
  ------------------
  |  |   90|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3361:13): [True: 20.0k, False: 0]
  |  Branch (3361:33): [True: 0, False: 0]
  ------------------
 3362|  44.5k|            for (j = 0; j + (NB_ELTS_V8 - 1) < rh; j += NB_ELTS_V8) {
  ------------------
  |  |   90|  44.5k|#define NB_ELTS_V8  8
  ------------------
                          for (j = 0; j + (NB_ELTS_V8 - 1) < rh; j += NB_ELTS_V8) {
  ------------------
  |  |   90|  24.5k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3362:25): [True: 24.5k, False: 20.0k]
  ------------------
 3363|  24.5k|                OPJ_UINT32 k;
 3364|  24.5k|                opj_v8dwt_interleave_h(&h, aj, w, NB_ELTS_V8);
  ------------------
  |  |   90|  24.5k|#define NB_ELTS_V8  8
  ------------------
 3365|  24.5k|                opj_v8dwt_decode(&h);
 3366|       |
 3367|       |                /* To be adapted if NB_ELTS_V8 changes */
 3368|  3.88M|                for (k = 0; k < rw; k++) {
  ------------------
  |  Branch (3368:29): [True: 3.85M, False: 24.5k]
  ------------------
 3369|  3.85M|                    aj[k      ] = h.wavelet[k].f[0];
 3370|  3.85M|                    aj[k + (OPJ_SIZE_T)w  ] = h.wavelet[k].f[1];
 3371|  3.85M|                    aj[k + (OPJ_SIZE_T)w * 2] = h.wavelet[k].f[2];
 3372|  3.85M|                    aj[k + (OPJ_SIZE_T)w * 3] = h.wavelet[k].f[3];
 3373|  3.85M|                }
 3374|  3.88M|                for (k = 0; k < rw; k++) {
  ------------------
  |  Branch (3374:29): [True: 3.85M, False: 24.5k]
  ------------------
 3375|  3.85M|                    aj[k + (OPJ_SIZE_T)w * 4] = h.wavelet[k].f[4];
 3376|  3.85M|                    aj[k + (OPJ_SIZE_T)w * 5] = h.wavelet[k].f[5];
 3377|  3.85M|                    aj[k + (OPJ_SIZE_T)w * 6] = h.wavelet[k].f[6];
 3378|  3.85M|                    aj[k + (OPJ_SIZE_T)w * 7] = h.wavelet[k].f[7];
 3379|  3.85M|                }
 3380|       |
 3381|  24.5k|                aj += w * NB_ELTS_V8;
  ------------------
  |  |   90|  24.5k|#define NB_ELTS_V8  8
  ------------------
 3382|  24.5k|            }
 3383|  20.0k|        } else {
 3384|      0|            OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
 3385|      0|            OPJ_UINT32 step_j;
 3386|       |
 3387|      0|            if ((rh / NB_ELTS_V8) < num_jobs) {
  ------------------
  |  |   90|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3387:17): [True: 0, False: 0]
  ------------------
 3388|      0|                num_jobs = rh / NB_ELTS_V8;
  ------------------
  |  |   90|      0|#define NB_ELTS_V8  8
  ------------------
 3389|      0|            }
 3390|      0|            step_j = ((rh / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
  ------------------
  |  |   90|      0|#define NB_ELTS_V8  8
  ------------------
                          step_j = ((rh / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
  ------------------
  |  |   90|      0|#define NB_ELTS_V8  8
  ------------------
 3391|      0|            for (j = 0; j < num_jobs; j++) {
  ------------------
  |  Branch (3391:25): [True: 0, False: 0]
  ------------------
 3392|      0|                opj_dwt97_decode_h_job_t* job;
 3393|       |
 3394|      0|                job = (opj_dwt97_decode_h_job_t*) opj_malloc(sizeof(opj_dwt97_decode_h_job_t));
 3395|      0|                if (!job) {
  ------------------
  |  Branch (3395:21): [True: 0, False: 0]
  ------------------
 3396|      0|                    opj_thread_pool_wait_completion(tp, 0);
 3397|      0|                    opj_aligned_free(h.wavelet);
 3398|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3399|      0|                }
 3400|      0|                job->h.wavelet = (opj_v8_t*)opj_aligned_malloc(l_data_size * sizeof(opj_v8_t));
 3401|      0|                if (!job->h.wavelet) {
  ------------------
  |  Branch (3401:21): [True: 0, False: 0]
  ------------------
 3402|      0|                    opj_thread_pool_wait_completion(tp, 0);
 3403|      0|                    opj_free(job);
 3404|      0|                    opj_aligned_free(h.wavelet);
 3405|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3406|      0|                }
 3407|      0|                job->h.dn = h.dn;
 3408|      0|                job->h.sn = h.sn;
 3409|      0|                job->h.cas = h.cas;
 3410|      0|                job->h.win_l_x0 = h.win_l_x0;
 3411|      0|                job->h.win_l_x1 = h.win_l_x1;
 3412|      0|                job->h.win_h_x0 = h.win_h_x0;
 3413|      0|                job->h.win_h_x1 = h.win_h_x1;
 3414|      0|                job->rw = rw;
 3415|      0|                job->w = w;
 3416|      0|                job->aj = aj;
 3417|      0|                job->nb_rows = (j + 1 == num_jobs) ? (rh & (OPJ_UINT32)~
  ------------------
  |  Branch (3417:32): [True: 0, False: 0]
  ------------------
 3418|      0|                                                      (NB_ELTS_V8 - 1)) - j * step_j : step_j;
  ------------------
  |  |   90|      0|#define NB_ELTS_V8  8
  ------------------
 3419|      0|                aj += w * job->nb_rows;
 3420|      0|                opj_thread_pool_submit_job(tp, opj_dwt97_decode_h_func, job);
 3421|      0|            }
 3422|      0|            opj_thread_pool_wait_completion(tp, 0);
 3423|      0|            j = rh & (OPJ_UINT32)~(NB_ELTS_V8 - 1);
  ------------------
  |  |   90|      0|#define NB_ELTS_V8  8
  ------------------
 3424|      0|        }
 3425|       |
 3426|  20.0k|        if (j < rh) {
  ------------------
  |  Branch (3426:13): [True: 12.3k, False: 7.62k]
  ------------------
 3427|  12.3k|            OPJ_UINT32 k;
 3428|  12.3k|            opj_v8dwt_interleave_h(&h, aj, w, rh - j);
 3429|  12.3k|            opj_v8dwt_decode(&h);
 3430|   239k|            for (k = 0; k < rw; k++) {
  ------------------
  |  Branch (3430:25): [True: 226k, False: 12.3k]
  ------------------
 3431|   226k|                OPJ_UINT32 l;
 3432|   874k|                for (l = 0; l < rh - j; l++) {
  ------------------
  |  Branch (3432:29): [True: 647k, False: 226k]
  ------------------
 3433|   647k|                    aj[k + (OPJ_SIZE_T)w  * l ] = h.wavelet[k].f[l];
 3434|   647k|                }
 3435|   226k|            }
 3436|  12.3k|        }
 3437|       |
 3438|  20.0k|        v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
 3439|  20.0k|        v.cas = res->y0 % 2;
 3440|  20.0k|        v.win_l_x0 = 0;
 3441|  20.0k|        v.win_l_x1 = (OPJ_UINT32)v.sn;
 3442|  20.0k|        v.win_h_x0 = 0;
 3443|  20.0k|        v.win_h_x1 = (OPJ_UINT32)v.dn;
 3444|       |
 3445|  20.0k|        aj = (OPJ_FLOAT32*) tilec->data;
 3446|  20.0k|        if (num_threads <= 1 || rw < 2 * NB_ELTS_V8) {
  ------------------
  |  |   90|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3446:13): [True: 20.0k, False: 0]
  |  Branch (3446:33): [True: 0, False: 0]
  ------------------
 3447|  48.7k|            for (j = rw; j > (NB_ELTS_V8 - 1); j -= NB_ELTS_V8) {
  ------------------
  |  |   90|  48.7k|#define NB_ELTS_V8  8
  ------------------
                          for (j = rw; j > (NB_ELTS_V8 - 1); j -= NB_ELTS_V8) {
  ------------------
  |  |   90|  28.7k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3447:26): [True: 28.7k, False: 20.0k]
  ------------------
 3448|  28.7k|                OPJ_UINT32 k;
 3449|       |
 3450|  28.7k|                opj_v8dwt_interleave_v(&v, aj, w, NB_ELTS_V8);
  ------------------
  |  |   90|  28.7k|#define NB_ELTS_V8  8
  ------------------
 3451|  28.7k|                opj_v8dwt_decode(&v);
 3452|       |
 3453|  3.90M|                for (k = 0; k < rh; ++k) {
  ------------------
  |  Branch (3453:29): [True: 3.87M, False: 28.7k]
  ------------------
 3454|  3.87M|                    memcpy(&aj[k * (OPJ_SIZE_T)w], &v.wavelet[k], NB_ELTS_V8 * sizeof(OPJ_FLOAT32));
  ------------------
  |  |   90|  3.87M|#define NB_ELTS_V8  8
  ------------------
 3455|  3.87M|                }
 3456|  28.7k|                aj += NB_ELTS_V8;
  ------------------
  |  |   90|  28.7k|#define NB_ELTS_V8  8
  ------------------
 3457|  28.7k|            }
 3458|  20.0k|        } else {
 3459|       |            /* "bench_dwt -I" shows that scaling is poor, likely due to RAM
 3460|       |                transfer being the limiting factor. So limit the number of
 3461|       |                threads.
 3462|       |             */
 3463|      0|            OPJ_UINT32 num_jobs = opj_uint_max((OPJ_UINT32)num_threads / 2, 2U);
 3464|      0|            OPJ_UINT32 step_j;
 3465|       |
 3466|      0|            if ((rw / NB_ELTS_V8) < num_jobs) {
  ------------------
  |  |   90|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3466:17): [True: 0, False: 0]
  ------------------
 3467|      0|                num_jobs = rw / NB_ELTS_V8;
  ------------------
  |  |   90|      0|#define NB_ELTS_V8  8
  ------------------
 3468|      0|            }
 3469|      0|            step_j = ((rw / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
  ------------------
  |  |   90|      0|#define NB_ELTS_V8  8
  ------------------
                          step_j = ((rw / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
  ------------------
  |  |   90|      0|#define NB_ELTS_V8  8
  ------------------
 3470|      0|            for (j = 0; j < num_jobs; j++) {
  ------------------
  |  Branch (3470:25): [True: 0, False: 0]
  ------------------
 3471|      0|                opj_dwt97_decode_v_job_t* job;
 3472|       |
 3473|      0|                job = (opj_dwt97_decode_v_job_t*) opj_malloc(sizeof(opj_dwt97_decode_v_job_t));
 3474|      0|                if (!job) {
  ------------------
  |  Branch (3474:21): [True: 0, False: 0]
  ------------------
 3475|      0|                    opj_thread_pool_wait_completion(tp, 0);
 3476|      0|                    opj_aligned_free(h.wavelet);
 3477|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3478|      0|                }
 3479|      0|                job->v.wavelet = (opj_v8_t*)opj_aligned_malloc(l_data_size * sizeof(opj_v8_t));
 3480|      0|                if (!job->v.wavelet) {
  ------------------
  |  Branch (3480:21): [True: 0, False: 0]
  ------------------
 3481|      0|                    opj_thread_pool_wait_completion(tp, 0);
 3482|      0|                    opj_free(job);
 3483|      0|                    opj_aligned_free(h.wavelet);
 3484|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3485|      0|                }
 3486|      0|                job->v.dn = v.dn;
 3487|      0|                job->v.sn = v.sn;
 3488|      0|                job->v.cas = v.cas;
 3489|      0|                job->v.win_l_x0 = v.win_l_x0;
 3490|      0|                job->v.win_l_x1 = v.win_l_x1;
 3491|      0|                job->v.win_h_x0 = v.win_h_x0;
 3492|      0|                job->v.win_h_x1 = v.win_h_x1;
 3493|      0|                job->rh = rh;
 3494|      0|                job->w = w;
 3495|      0|                job->aj = aj;
 3496|      0|                job->nb_columns = (j + 1 == num_jobs) ? (rw & (OPJ_UINT32)~
  ------------------
  |  Branch (3496:35): [True: 0, False: 0]
  ------------------
 3497|      0|                                  (NB_ELTS_V8 - 1)) - j * step_j : step_j;
  ------------------
  |  |   90|      0|#define NB_ELTS_V8  8
  ------------------
 3498|      0|                aj += job->nb_columns;
 3499|      0|                opj_thread_pool_submit_job(tp, opj_dwt97_decode_v_func, job);
 3500|      0|            }
 3501|      0|            opj_thread_pool_wait_completion(tp, 0);
 3502|      0|        }
 3503|       |
 3504|  20.0k|        if (rw & (NB_ELTS_V8 - 1)) {
  ------------------
  |  |   90|  20.0k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3504:13): [True: 10.3k, False: 9.68k]
  ------------------
 3505|  10.3k|            OPJ_UINT32 k;
 3506|       |
 3507|  10.3k|            j = rw & (NB_ELTS_V8 - 1);
  ------------------
  |  |   90|  10.3k|#define NB_ELTS_V8  8
  ------------------
 3508|       |
 3509|  10.3k|            opj_v8dwt_interleave_v(&v, aj, w, j);
 3510|  10.3k|            opj_v8dwt_decode(&v);
 3511|       |
 3512|   191k|            for (k = 0; k < rh; ++k) {
  ------------------
  |  Branch (3512:25): [True: 181k, False: 10.3k]
  ------------------
 3513|   181k|                memcpy(&aj[k * (OPJ_SIZE_T)w], &v.wavelet[k],
 3514|   181k|                       (OPJ_SIZE_T)j * sizeof(OPJ_FLOAT32));
 3515|   181k|            }
 3516|  10.3k|        }
 3517|  20.0k|    }
 3518|       |
 3519|  1.89k|    opj_aligned_free(h.wavelet);
 3520|  1.89k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.89k|#define OPJ_TRUE 1
  ------------------
 3521|  1.89k|}
dwt.c:opj_v8dwt_interleave_h:
 2869|  36.8k|{
 2870|  36.8k|    OPJ_FLOAT32* OPJ_RESTRICT bi = (OPJ_FLOAT32*)(dwt->wavelet + dwt->cas);
 2871|  36.8k|    OPJ_UINT32 i, k;
 2872|  36.8k|    OPJ_UINT32 x0 = dwt->win_l_x0;
 2873|  36.8k|    OPJ_UINT32 x1 = dwt->win_l_x1;
 2874|       |
 2875|   110k|    for (k = 0; k < 2; ++k) {
  ------------------
  |  Branch (2875:17): [True: 73.7k, False: 36.8k]
  ------------------
 2876|  73.7k|        if (remaining_height >= NB_ELTS_V8 && ((OPJ_SIZE_T) a & 0x0f) == 0 &&
  ------------------
  |  |   90|   147k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (2876:13): [True: 49.0k, False: 24.7k]
  |  Branch (2876:47): [True: 31.7k, False: 17.2k]
  ------------------
 2877|  73.7k|                ((OPJ_SIZE_T) bi & 0x0f) == 0) {
  ------------------
  |  Branch (2877:17): [True: 31.7k, False: 0]
  ------------------
 2878|       |            /* Fast code path */
 2879|  2.58M|            for (i = x0; i < x1; ++i) {
  ------------------
  |  Branch (2879:26): [True: 2.54M, False: 31.7k]
  ------------------
 2880|  2.54M|                OPJ_UINT32 j = i;
 2881|  2.54M|                OPJ_FLOAT32* OPJ_RESTRICT dst = bi + i * 2 * NB_ELTS_V8;
  ------------------
  |  |   90|  2.54M|#define NB_ELTS_V8  8
  ------------------
 2882|  2.54M|                dst[0] = a[j];
 2883|  2.54M|                j += width;
 2884|  2.54M|                dst[1] = a[j];
 2885|  2.54M|                j += width;
 2886|  2.54M|                dst[2] = a[j];
 2887|  2.54M|                j += width;
 2888|  2.54M|                dst[3] = a[j];
 2889|  2.54M|                j += width;
 2890|  2.54M|                dst[4] = a[j];
 2891|  2.54M|                j += width;
 2892|  2.54M|                dst[5] = a[j];
 2893|  2.54M|                j += width;
 2894|  2.54M|                dst[6] = a[j];
 2895|  2.54M|                j += width;
 2896|  2.54M|                dst[7] = a[j];
 2897|  2.54M|            }
 2898|  42.0k|        } else {
 2899|       |            /* Slow code path */
 2900|  1.57M|            for (i = x0; i < x1; ++i) {
  ------------------
  |  Branch (2900:26): [True: 1.53M, False: 42.0k]
  ------------------
 2901|  1.53M|                OPJ_UINT32 j = i;
 2902|  1.53M|                OPJ_FLOAT32* OPJ_RESTRICT dst = bi + i * 2 * NB_ELTS_V8;
  ------------------
  |  |   90|  1.53M|#define NB_ELTS_V8  8
  ------------------
 2903|  1.53M|                dst[0] = a[j];
 2904|  1.53M|                j += width;
 2905|  1.53M|                if (remaining_height == 1) {
  ------------------
  |  Branch (2905:21): [True: 97.3k, False: 1.43M]
  ------------------
 2906|  97.3k|                    continue;
 2907|  97.3k|                }
 2908|  1.43M|                dst[1] = a[j];
 2909|  1.43M|                j += width;
 2910|  1.43M|                if (remaining_height == 2) {
  ------------------
  |  Branch (2910:21): [True: 19.8k, False: 1.41M]
  ------------------
 2911|  19.8k|                    continue;
 2912|  19.8k|                }
 2913|  1.41M|                dst[2] = a[j];
 2914|  1.41M|                j += width;
 2915|  1.41M|                if (remaining_height == 3) {
  ------------------
  |  Branch (2915:21): [True: 34.8k, False: 1.38M]
  ------------------
 2916|  34.8k|                    continue;
 2917|  34.8k|                }
 2918|  1.38M|                dst[3] = a[j];
 2919|  1.38M|                j += width;
 2920|  1.38M|                if (remaining_height == 4) {
  ------------------
  |  Branch (2920:21): [True: 14.8k, False: 1.36M]
  ------------------
 2921|  14.8k|                    continue;
 2922|  14.8k|                }
 2923|  1.36M|                dst[4] = a[j];
 2924|  1.36M|                j += width;
 2925|  1.36M|                if (remaining_height == 5) {
  ------------------
  |  Branch (2925:21): [True: 22.3k, False: 1.34M]
  ------------------
 2926|  22.3k|                    continue;
 2927|  22.3k|                }
 2928|  1.34M|                dst[5] = a[j];
 2929|  1.34M|                j += width;
 2930|  1.34M|                if (remaining_height == 6) {
  ------------------
  |  Branch (2930:21): [True: 28.2k, False: 1.31M]
  ------------------
 2931|  28.2k|                    continue;
 2932|  28.2k|                }
 2933|  1.31M|                dst[6] = a[j];
 2934|  1.31M|                j += width;
 2935|  1.31M|                if (remaining_height == 7) {
  ------------------
  |  Branch (2935:21): [True: 9.28k, False: 1.30M]
  ------------------
 2936|  9.28k|                    continue;
 2937|  9.28k|                }
 2938|  1.30M|                dst[7] = a[j];
 2939|  1.30M|            }
 2940|  42.0k|        }
 2941|       |
 2942|  73.7k|        bi = (OPJ_FLOAT32*)(dwt->wavelet + 1 - dwt->cas);
 2943|  73.7k|        a += dwt->sn;
 2944|  73.7k|        x0 = dwt->win_h_x0;
 2945|  73.7k|        x1 = dwt->win_h_x1;
 2946|  73.7k|    }
 2947|  36.8k|}
dwt.c:opj_v8dwt_decode:
 3142|   367k|{
 3143|   367k|    OPJ_INT32 a, b;
 3144|       |    /* BUG_WEIRD_TWO_INVK (look for this identifier in tcd.c) */
 3145|       |    /* Historic value for 2 / opj_invK */
 3146|       |    /* Normally, we should use invK, but if we do so, we have failures in the */
 3147|       |    /* conformance test, due to MSE and peak errors significantly higher than */
 3148|       |    /* accepted value */
 3149|       |    /* Due to using two_invK instead of invK, we have to compensate in tcd.c */
 3150|       |    /* the computation of the stepsize for the non LL subbands */
 3151|   367k|    const float two_invK = 1.625732422f;
 3152|   367k|    if (dwt->cas == 0) {
  ------------------
  |  Branch (3152:9): [True: 330k, False: 36.3k]
  ------------------
 3153|   330k|        if (!((dwt->dn > 0) || (dwt->sn > 1))) {
  ------------------
  |  Branch (3153:15): [True: 299k, False: 30.8k]
  |  Branch (3153:32): [True: 0, False: 30.8k]
  ------------------
 3154|  30.8k|            return;
 3155|  30.8k|        }
 3156|   299k|        a = 0;
 3157|   299k|        b = 1;
 3158|   299k|    } else {
 3159|  36.3k|        if (!((dwt->sn > 0) || (dwt->dn > 1))) {
  ------------------
  |  Branch (3159:15): [True: 14.1k, False: 22.2k]
  |  Branch (3159:32): [True: 0, False: 22.2k]
  ------------------
 3160|  22.2k|            return;
 3161|  22.2k|        }
 3162|  14.1k|        a = 1;
 3163|  14.1k|        b = 0;
 3164|  14.1k|    }
 3165|   314k|#ifdef __SSE__
 3166|   314k|    opj_v8dwt_decode_step1_sse(dwt->wavelet + a, dwt->win_l_x0, dwt->win_l_x1,
 3167|   314k|                               _mm_set1_ps(opj_K));
 3168|   314k|    opj_v8dwt_decode_step1_sse(dwt->wavelet + b, dwt->win_h_x0, dwt->win_h_x1,
 3169|   314k|                               _mm_set1_ps(two_invK));
 3170|   314k|    opj_v8dwt_decode_step2_sse(dwt->wavelet + b, dwt->wavelet + a + 1,
 3171|   314k|                               dwt->win_l_x0, dwt->win_l_x1,
 3172|   314k|                               (OPJ_UINT32)opj_int_min(dwt->sn, dwt->dn - a),
 3173|   314k|                               _mm_set1_ps(-opj_dwt_delta));
 3174|   314k|    opj_v8dwt_decode_step2_sse(dwt->wavelet + a, dwt->wavelet + b + 1,
 3175|   314k|                               dwt->win_h_x0, dwt->win_h_x1,
 3176|   314k|                               (OPJ_UINT32)opj_int_min(dwt->dn, dwt->sn - b),
 3177|   314k|                               _mm_set1_ps(-opj_dwt_gamma));
 3178|   314k|    opj_v8dwt_decode_step2_sse(dwt->wavelet + b, dwt->wavelet + a + 1,
 3179|   314k|                               dwt->win_l_x0, dwt->win_l_x1,
 3180|   314k|                               (OPJ_UINT32)opj_int_min(dwt->sn, dwt->dn - a),
 3181|   314k|                               _mm_set1_ps(-opj_dwt_beta));
 3182|   314k|    opj_v8dwt_decode_step2_sse(dwt->wavelet + a, dwt->wavelet + b + 1,
 3183|   314k|                               dwt->win_h_x0, dwt->win_h_x1,
 3184|   314k|                               (OPJ_UINT32)opj_int_min(dwt->dn, dwt->sn - b),
 3185|   314k|                               _mm_set1_ps(-opj_dwt_alpha));
 3186|       |#else
 3187|       |    opj_v8dwt_decode_step1(dwt->wavelet + a, dwt->win_l_x0, dwt->win_l_x1,
 3188|       |                           opj_K);
 3189|       |    opj_v8dwt_decode_step1(dwt->wavelet + b, dwt->win_h_x0, dwt->win_h_x1,
 3190|       |                           two_invK);
 3191|       |    opj_v8dwt_decode_step2(dwt->wavelet + b, dwt->wavelet + a + 1,
 3192|       |                           dwt->win_l_x0, dwt->win_l_x1,
 3193|       |                           (OPJ_UINT32)opj_int_min(dwt->sn, dwt->dn - a),
 3194|       |                           -opj_dwt_delta);
 3195|       |    opj_v8dwt_decode_step2(dwt->wavelet + a, dwt->wavelet + b + 1,
 3196|       |                           dwt->win_h_x0, dwt->win_h_x1,
 3197|       |                           (OPJ_UINT32)opj_int_min(dwt->dn, dwt->sn - b),
 3198|       |                           -opj_dwt_gamma);
 3199|       |    opj_v8dwt_decode_step2(dwt->wavelet + b, dwt->wavelet + a + 1,
 3200|       |                           dwt->win_l_x0, dwt->win_l_x1,
 3201|       |                           (OPJ_UINT32)opj_int_min(dwt->sn, dwt->dn - a),
 3202|       |                           -opj_dwt_beta);
 3203|       |    opj_v8dwt_decode_step2(dwt->wavelet + a, dwt->wavelet + b + 1,
 3204|       |                           dwt->win_h_x0, dwt->win_h_x1,
 3205|       |                           (OPJ_UINT32)opj_int_min(dwt->dn, dwt->sn - b),
 3206|       |                           -opj_dwt_alpha);
 3207|       |#endif
 3208|   314k|}
dwt.c:opj_v8dwt_decode_step1_sse:
 3024|   628k|{
 3025|   628k|    __m128* OPJ_RESTRICT vw = (__m128*) w;
 3026|   628k|    OPJ_UINT32 i = start;
 3027|       |    /* To be adapted if NB_ELTS_V8 changes */
 3028|   628k|    vw += 4 * start;
 3029|       |    /* Note: attempt at loop unrolling x2 doesn't help */
 3030|  59.6M|    for (; i < end; ++i, vw += 4) {
  ------------------
  |  Branch (3030:12): [True: 59.0M, False: 628k]
  ------------------
 3031|  59.0M|        vw[0] = _mm_mul_ps(vw[0], c);
 3032|  59.0M|        vw[1] = _mm_mul_ps(vw[1], c);
 3033|  59.0M|    }
 3034|   628k|}
dwt.c:opj_v8dwt_decode_step2_sse:
 3041|  1.25M|{
 3042|  1.25M|    __m128* OPJ_RESTRICT vl = (__m128*) l;
 3043|  1.25M|    __m128* OPJ_RESTRICT vw = (__m128*) w;
 3044|       |    /* To be adapted if NB_ELTS_V8 changes */
 3045|  1.25M|    OPJ_UINT32 i;
 3046|  1.25M|    OPJ_UINT32 imax = opj_uint_min(end, m);
 3047|  1.25M|    if (start == 0) {
  ------------------
  |  Branch (3047:9): [True: 1.25M, False: 0]
  ------------------
 3048|  1.25M|        if (imax >= 1) {
  ------------------
  |  Branch (3048:13): [True: 1.23M, False: 24.7k]
  ------------------
 3049|  1.23M|            vw[-2] = _mm_add_ps(vw[-2], _mm_mul_ps(_mm_add_ps(vl[0], vw[0]), c));
 3050|  1.23M|            vw[-1] = _mm_add_ps(vw[-1], _mm_mul_ps(_mm_add_ps(vl[1], vw[1]), c));
 3051|  1.23M|            vw += 4;
 3052|  1.23M|            start = 1;
 3053|  1.23M|        }
 3054|  1.25M|    } else {
 3055|      0|        vw += start * 4;
 3056|      0|    }
 3057|       |
 3058|  1.25M|    i = start;
 3059|       |    /* Note: attempt at loop unrolling x2 doesn't help */
 3060|   117M|    for (; i < imax; ++i) {
  ------------------
  |  Branch (3060:12): [True: 116M, False: 1.25M]
  ------------------
 3061|   116M|        vw[-2] = _mm_add_ps(vw[-2], _mm_mul_ps(_mm_add_ps(vw[-4], vw[0]), c));
 3062|   116M|        vw[-1] = _mm_add_ps(vw[-1], _mm_mul_ps(_mm_add_ps(vw[-3], vw[1]), c));
 3063|   116M|        vw += 4;
 3064|   116M|    }
 3065|  1.25M|    if (m < end) {
  ------------------
  |  Branch (3065:9): [True: 352k, False: 904k]
  ------------------
 3066|   352k|        assert(m + 1 == end);
 3067|   352k|        c = _mm_add_ps(c, c);
 3068|   352k|        vw[-2] = _mm_add_ps(vw[-2], _mm_mul_ps(c, vw[-4]));
 3069|   352k|        vw[-1] = _mm_add_ps(vw[-1], _mm_mul_ps(c, vw[-3]));
 3070|   352k|    }
 3071|  1.25M|}
dwt.c:opj_v8dwt_interleave_v:
 2979|  39.0k|{
 2980|  39.0k|    opj_v8_t* OPJ_RESTRICT bi = dwt->wavelet + dwt->cas;
 2981|  39.0k|    OPJ_UINT32 i;
 2982|       |
 2983|  2.07M|    for (i = dwt->win_l_x0; i < dwt->win_l_x1; ++i) {
  ------------------
  |  Branch (2983:29): [True: 2.03M, False: 39.0k]
  ------------------
 2984|  2.03M|        memcpy(&bi[i * 2], &a[i * (OPJ_SIZE_T)width],
 2985|  2.03M|               (OPJ_SIZE_T)nb_elts_read * sizeof(OPJ_FLOAT32));
 2986|  2.03M|    }
 2987|       |
 2988|  39.0k|    a += (OPJ_UINT32)dwt->sn * (OPJ_SIZE_T)width;
 2989|  39.0k|    bi = dwt->wavelet + 1 - dwt->cas;
 2990|       |
 2991|  2.05M|    for (i = dwt->win_h_x0; i < dwt->win_h_x1; ++i) {
  ------------------
  |  Branch (2991:29): [True: 2.01M, False: 39.0k]
  ------------------
 2992|  2.01M|        memcpy(&bi[i * 2], &a[i * (OPJ_SIZE_T)width],
 2993|  2.01M|               (OPJ_SIZE_T)nb_elts_read * sizeof(OPJ_FLOAT32));
 2994|  2.01M|    }
 2995|  39.0k|}
dwt.c:opj_dwt_decode_partial_97:
 3526|  5.37k|{
 3527|  5.37k|    opj_sparse_array_int32_t* sa;
 3528|  5.37k|    opj_v8dwt_t h;
 3529|  5.37k|    opj_v8dwt_t v;
 3530|  5.37k|    OPJ_UINT32 resno;
 3531|       |    /* This value matches the maximum left/right extension given in tables */
 3532|       |    /* F.2 and F.3 of the standard. Note: in opj_tcd_is_subband_area_of_interest() */
 3533|       |    /* we currently use 3. */
 3534|  5.37k|    const OPJ_UINT32 filter_width = 4U;
 3535|       |
 3536|  5.37k|    opj_tcd_resolution_t* tr = tilec->resolutions;
 3537|  5.37k|    opj_tcd_resolution_t* tr_max = &(tilec->resolutions[numres - 1]);
 3538|       |
 3539|  5.37k|    OPJ_UINT32 rw = (OPJ_UINT32)(tr->x1 -
 3540|  5.37k|                                 tr->x0);    /* width of the resolution level computed */
 3541|  5.37k|    OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 -
 3542|  5.37k|                                 tr->y0);    /* height of the resolution level computed */
 3543|       |
 3544|  5.37k|    OPJ_SIZE_T l_data_size;
 3545|       |
 3546|       |    /* Compute the intersection of the area of interest, expressed in tile coordinates */
 3547|       |    /* with the tile coordinates */
 3548|  5.37k|    OPJ_UINT32 win_tcx0 = tilec->win_x0;
 3549|  5.37k|    OPJ_UINT32 win_tcy0 = tilec->win_y0;
 3550|  5.37k|    OPJ_UINT32 win_tcx1 = tilec->win_x1;
 3551|  5.37k|    OPJ_UINT32 win_tcy1 = tilec->win_y1;
 3552|       |
 3553|  5.37k|    if (tr_max->x0 == tr_max->x1 || tr_max->y0 == tr_max->y1) {
  ------------------
  |  Branch (3553:9): [True: 188, False: 5.18k]
  |  Branch (3553:37): [True: 167, False: 5.02k]
  ------------------
 3554|    355|        return OPJ_TRUE;
  ------------------
  |  |  117|    355|#define OPJ_TRUE 1
  ------------------
 3555|    355|    }
 3556|       |
 3557|  5.02k|    sa = opj_dwt_init_sparse_array(tilec, numres);
 3558|  5.02k|    if (sa == NULL) {
  ------------------
  |  Branch (3558:9): [True: 0, False: 5.02k]
  ------------------
 3559|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3560|      0|    }
 3561|       |
 3562|  5.02k|    if (numres == 1U) {
  ------------------
  |  Branch (3562:9): [True: 1.74k, False: 3.27k]
  ------------------
 3563|  1.74k|        OPJ_BOOL ret = opj_sparse_array_int32_read(sa,
 3564|  1.74k|                       tr_max->win_x0 - (OPJ_UINT32)tr_max->x0,
 3565|  1.74k|                       tr_max->win_y0 - (OPJ_UINT32)tr_max->y0,
 3566|  1.74k|                       tr_max->win_x1 - (OPJ_UINT32)tr_max->x0,
 3567|  1.74k|                       tr_max->win_y1 - (OPJ_UINT32)tr_max->y0,
 3568|  1.74k|                       tilec->data_win,
 3569|  1.74k|                       1, tr_max->win_x1 - tr_max->win_x0,
 3570|  1.74k|                       OPJ_TRUE);
  ------------------
  |  |  117|  1.74k|#define OPJ_TRUE 1
  ------------------
 3571|  1.74k|        assert(ret);
 3572|  1.74k|        OPJ_UNUSED(ret);
  ------------------
  |  |  219|  1.74k|#define OPJ_UNUSED(x) (void)x
  ------------------
 3573|  1.74k|        opj_sparse_array_int32_free(sa);
 3574|  1.74k|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.74k|#define OPJ_TRUE 1
  ------------------
 3575|  1.74k|    }
 3576|       |
 3577|  3.27k|    l_data_size = opj_dwt_max_resolution(tr, numres);
 3578|       |    /* overflow check */
 3579|  3.27k|    if (l_data_size > (SIZE_MAX / sizeof(opj_v8_t))) {
  ------------------
  |  Branch (3579:9): [True: 0, False: 3.27k]
  ------------------
 3580|       |        /* FIXME event manager error callback */
 3581|      0|        opj_sparse_array_int32_free(sa);
 3582|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3583|      0|    }
 3584|  3.27k|    h.wavelet = (opj_v8_t*) opj_aligned_malloc(l_data_size * sizeof(opj_v8_t));
 3585|  3.27k|    if (!h.wavelet) {
  ------------------
  |  Branch (3585:9): [True: 0, False: 3.27k]
  ------------------
 3586|       |        /* FIXME event manager error callback */
 3587|      0|        opj_sparse_array_int32_free(sa);
 3588|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3589|      0|    }
 3590|  3.27k|    v.wavelet = h.wavelet;
 3591|       |
 3592|  31.4k|    for (resno = 1; resno < numres; resno ++) {
  ------------------
  |  Branch (3592:21): [True: 28.1k, False: 3.27k]
  ------------------
 3593|  28.1k|        OPJ_UINT32 j;
 3594|       |        /* Window of interest subband-based coordinates */
 3595|  28.1k|        OPJ_UINT32 win_ll_x0, win_ll_y0, win_ll_x1, win_ll_y1;
 3596|  28.1k|        OPJ_UINT32 win_hl_x0, win_hl_x1;
 3597|  28.1k|        OPJ_UINT32 win_lh_y0, win_lh_y1;
 3598|       |        /* Window of interest tile-resolution-based coordinates */
 3599|  28.1k|        OPJ_UINT32 win_tr_x0, win_tr_x1, win_tr_y0, win_tr_y1;
 3600|       |        /* Tile-resolution subband-based coordinates */
 3601|  28.1k|        OPJ_UINT32 tr_ll_x0, tr_ll_y0, tr_hl_x0, tr_lh_y0;
 3602|       |
 3603|  28.1k|        ++tr;
 3604|       |
 3605|  28.1k|        h.sn = (OPJ_INT32)rw;
 3606|  28.1k|        v.sn = (OPJ_INT32)rh;
 3607|       |
 3608|  28.1k|        rw = (OPJ_UINT32)(tr->x1 - tr->x0);
 3609|  28.1k|        rh = (OPJ_UINT32)(tr->y1 - tr->y0);
 3610|       |
 3611|  28.1k|        h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
 3612|  28.1k|        h.cas = tr->x0 % 2;
 3613|       |
 3614|  28.1k|        v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
 3615|  28.1k|        v.cas = tr->y0 % 2;
 3616|       |
 3617|       |        /* Get the subband coordinates for the window of interest */
 3618|       |        /* LL band */
 3619|  28.1k|        opj_dwt_get_band_coordinates(tilec, resno, 0,
 3620|  28.1k|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 3621|  28.1k|                                     &win_ll_x0, &win_ll_y0,
 3622|  28.1k|                                     &win_ll_x1, &win_ll_y1);
 3623|       |
 3624|       |        /* HL band */
 3625|  28.1k|        opj_dwt_get_band_coordinates(tilec, resno, 1,
 3626|  28.1k|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 3627|  28.1k|                                     &win_hl_x0, NULL, &win_hl_x1, NULL);
 3628|       |
 3629|       |        /* LH band */
 3630|  28.1k|        opj_dwt_get_band_coordinates(tilec, resno, 2,
 3631|  28.1k|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 3632|  28.1k|                                     NULL, &win_lh_y0, NULL, &win_lh_y1);
 3633|       |
 3634|       |        /* Beware: band index for non-LL0 resolution are 0=HL, 1=LH and 2=HH */
 3635|  28.1k|        tr_ll_x0 = (OPJ_UINT32)tr->bands[1].x0;
 3636|  28.1k|        tr_ll_y0 = (OPJ_UINT32)tr->bands[0].y0;
 3637|  28.1k|        tr_hl_x0 = (OPJ_UINT32)tr->bands[0].x0;
 3638|  28.1k|        tr_lh_y0 = (OPJ_UINT32)tr->bands[1].y0;
 3639|       |
 3640|       |        /* Subtract the origin of the bands for this tile, to the subwindow */
 3641|       |        /* of interest band coordinates, so as to get them relative to the */
 3642|       |        /* tile */
 3643|  28.1k|        win_ll_x0 = opj_uint_subs(win_ll_x0, tr_ll_x0);
 3644|  28.1k|        win_ll_y0 = opj_uint_subs(win_ll_y0, tr_ll_y0);
 3645|  28.1k|        win_ll_x1 = opj_uint_subs(win_ll_x1, tr_ll_x0);
 3646|  28.1k|        win_ll_y1 = opj_uint_subs(win_ll_y1, tr_ll_y0);
 3647|  28.1k|        win_hl_x0 = opj_uint_subs(win_hl_x0, tr_hl_x0);
 3648|  28.1k|        win_hl_x1 = opj_uint_subs(win_hl_x1, tr_hl_x0);
 3649|  28.1k|        win_lh_y0 = opj_uint_subs(win_lh_y0, tr_lh_y0);
 3650|  28.1k|        win_lh_y1 = opj_uint_subs(win_lh_y1, tr_lh_y0);
 3651|       |
 3652|  28.1k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)h.sn, &win_ll_x0, &win_ll_x1);
 3653|  28.1k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)h.dn, &win_hl_x0, &win_hl_x1);
 3654|       |
 3655|  28.1k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)v.sn, &win_ll_y0, &win_ll_y1);
 3656|  28.1k|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)v.dn, &win_lh_y0, &win_lh_y1);
 3657|       |
 3658|       |        /* Compute the tile-resolution-based coordinates for the window of interest */
 3659|  28.1k|        if (h.cas == 0) {
  ------------------
  |  Branch (3659:13): [True: 16.9k, False: 11.2k]
  ------------------
 3660|  16.9k|            win_tr_x0 = opj_uint_min(2 * win_ll_x0, 2 * win_hl_x0 + 1);
 3661|  16.9k|            win_tr_x1 = opj_uint_min(opj_uint_max(2 * win_ll_x1, 2 * win_hl_x1 + 1), rw);
 3662|  16.9k|        } else {
 3663|  11.2k|            win_tr_x0 = opj_uint_min(2 * win_hl_x0, 2 * win_ll_x0 + 1);
 3664|  11.2k|            win_tr_x1 = opj_uint_min(opj_uint_max(2 * win_hl_x1, 2 * win_ll_x1 + 1), rw);
 3665|  11.2k|        }
 3666|       |
 3667|  28.1k|        if (v.cas == 0) {
  ------------------
  |  Branch (3667:13): [True: 20.9k, False: 7.23k]
  ------------------
 3668|  20.9k|            win_tr_y0 = opj_uint_min(2 * win_ll_y0, 2 * win_lh_y0 + 1);
 3669|  20.9k|            win_tr_y1 = opj_uint_min(opj_uint_max(2 * win_ll_y1, 2 * win_lh_y1 + 1), rh);
 3670|  20.9k|        } else {
 3671|  7.23k|            win_tr_y0 = opj_uint_min(2 * win_lh_y0, 2 * win_ll_y0 + 1);
 3672|  7.23k|            win_tr_y1 = opj_uint_min(opj_uint_max(2 * win_lh_y1, 2 * win_ll_y1 + 1), rh);
 3673|  7.23k|        }
 3674|       |
 3675|  28.1k|        h.win_l_x0 = win_ll_x0;
 3676|  28.1k|        h.win_l_x1 = win_ll_x1;
 3677|  28.1k|        h.win_h_x0 = win_hl_x0;
 3678|  28.1k|        h.win_h_x1 = win_hl_x1;
 3679|  65.4M|        for (j = 0; j + (NB_ELTS_V8 - 1) < rh; j += NB_ELTS_V8) {
  ------------------
  |  |   90|  65.4M|#define NB_ELTS_V8  8
  ------------------
                      for (j = 0; j + (NB_ELTS_V8 - 1) < rh; j += NB_ELTS_V8) {
  ------------------
  |  |   90|  65.4M|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3679:21): [True: 65.4M, False: 28.1k]
  ------------------
 3680|  65.4M|            if ((j + (NB_ELTS_V8 - 1) >= win_ll_y0 && j < win_ll_y1) ||
  ------------------
  |  |   90|  65.4M|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3680:18): [True: 65.4M, False: 0]
  |  Branch (3680:55): [True: 78.8k, False: 65.3M]
  ------------------
 3681|  65.4M|                    (j + (NB_ELTS_V8 - 1) >= win_lh_y0 + (OPJ_UINT32)v.sn &&
  ------------------
  |  |   90|  65.3M|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3681:22): [True: 32.7M, False: 32.6M]
  ------------------
 3682|  65.3M|                     j < win_lh_y1 + (OPJ_UINT32)v.sn)) {
  ------------------
  |  Branch (3682:22): [True: 77.6k, False: 32.6M]
  ------------------
 3683|   156k|                opj_v8dwt_interleave_partial_h(&h, sa, j, opj_uint_min(NB_ELTS_V8, rh - j));
  ------------------
  |  |   90|   156k|#define NB_ELTS_V8  8
  ------------------
 3684|   156k|                opj_v8dwt_decode(&h);
 3685|   156k|                if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (3685:21): [True: 0, False: 156k]
  ------------------
 3686|   156k|                                                  win_tr_x0, j,
 3687|   156k|                                                  win_tr_x1, j + NB_ELTS_V8,
  ------------------
  |  |   90|   156k|#define NB_ELTS_V8  8
  ------------------
 3688|   156k|                                                  (OPJ_INT32*)&h.wavelet[win_tr_x0].f[0],
 3689|   156k|                                                  NB_ELTS_V8, 1, OPJ_TRUE)) {
  ------------------
  |  |   90|   156k|#define NB_ELTS_V8  8
  ------------------
                                                                NB_ELTS_V8, 1, OPJ_TRUE)) {
  ------------------
  |  |  117|   156k|#define OPJ_TRUE 1
  ------------------
 3690|       |                    /* FIXME event manager error callback */
 3691|      0|                    opj_sparse_array_int32_free(sa);
 3692|      0|                    opj_aligned_free(h.wavelet);
 3693|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3694|      0|                }
 3695|   156k|            }
 3696|  65.4M|        }
 3697|       |
 3698|  28.1k|        if (j < rh &&
  ------------------
  |  Branch (3698:13): [True: 19.9k, False: 8.27k]
  ------------------
 3699|  28.1k|                ((j + (NB_ELTS_V8 - 1) >= win_ll_y0 && j < win_ll_y1) ||
  ------------------
  |  |   90|  19.9k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3699:19): [True: 19.9k, False: 0]
  |  Branch (3699:56): [True: 11.9k, False: 7.95k]
  ------------------
 3700|  19.9k|                 (j + (NB_ELTS_V8 - 1) >= win_lh_y0 + (OPJ_UINT32)v.sn &&
  ------------------
  |  |   90|  7.95k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3700:19): [True: 7.95k, False: 0]
  ------------------
 3701|  15.1k|                  j < win_lh_y1 + (OPJ_UINT32)v.sn))) {
  ------------------
  |  Branch (3701:19): [True: 3.16k, False: 4.78k]
  ------------------
 3702|  15.1k|            opj_v8dwt_interleave_partial_h(&h, sa, j, rh - j);
 3703|  15.1k|            opj_v8dwt_decode(&h);
 3704|  15.1k|            if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (3704:17): [True: 0, False: 15.1k]
  ------------------
 3705|  15.1k|                                              win_tr_x0, j,
 3706|  15.1k|                                              win_tr_x1, rh,
 3707|  15.1k|                                              (OPJ_INT32*)&h.wavelet[win_tr_x0].f[0],
 3708|  15.1k|                                              NB_ELTS_V8, 1, OPJ_TRUE)) {
  ------------------
  |  |   90|  15.1k|#define NB_ELTS_V8  8
  ------------------
                                                            NB_ELTS_V8, 1, OPJ_TRUE)) {
  ------------------
  |  |  117|  15.1k|#define OPJ_TRUE 1
  ------------------
 3709|       |                /* FIXME event manager error callback */
 3710|      0|                opj_sparse_array_int32_free(sa);
 3711|      0|                opj_aligned_free(h.wavelet);
 3712|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3713|      0|            }
 3714|  15.1k|        }
 3715|       |
 3716|  28.1k|        v.win_l_x0 = win_ll_y0;
 3717|  28.1k|        v.win_l_x1 = win_ll_y1;
 3718|  28.1k|        v.win_h_x0 = win_lh_y0;
 3719|  28.1k|        v.win_h_x1 = win_lh_y1;
 3720|   147k|        for (j = win_tr_x0; j < win_tr_x1; j += NB_ELTS_V8) {
  ------------------
  |  |   90|   119k|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3720:29): [True: 119k, False: 28.1k]
  ------------------
 3721|   119k|            OPJ_UINT32 nb_elts = opj_uint_min(NB_ELTS_V8, win_tr_x1 - j);
  ------------------
  |  |   90|   119k|#define NB_ELTS_V8  8
  ------------------
 3722|       |
 3723|   119k|            opj_v8dwt_interleave_partial_v(&v, sa, j, nb_elts);
 3724|   119k|            opj_v8dwt_decode(&v);
 3725|       |
 3726|   119k|            if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (3726:17): [True: 0, False: 119k]
  ------------------
 3727|   119k|                                              j, win_tr_y0,
 3728|   119k|                                              j + nb_elts, win_tr_y1,
 3729|   119k|                                              (OPJ_INT32*)&h.wavelet[win_tr_y0].f[0],
 3730|   119k|                                              1, NB_ELTS_V8, OPJ_TRUE)) {
  ------------------
  |  |   90|   119k|#define NB_ELTS_V8  8
  ------------------
                                                            1, NB_ELTS_V8, OPJ_TRUE)) {
  ------------------
  |  |  117|   119k|#define OPJ_TRUE 1
  ------------------
 3731|       |                /* FIXME event manager error callback */
 3732|      0|                opj_sparse_array_int32_free(sa);
 3733|      0|                opj_aligned_free(h.wavelet);
 3734|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3735|      0|            }
 3736|   119k|        }
 3737|  28.1k|    }
 3738|       |
 3739|  3.27k|    {
 3740|  3.27k|        OPJ_BOOL ret = opj_sparse_array_int32_read(sa,
 3741|  3.27k|                       tr_max->win_x0 - (OPJ_UINT32)tr_max->x0,
 3742|  3.27k|                       tr_max->win_y0 - (OPJ_UINT32)tr_max->y0,
 3743|  3.27k|                       tr_max->win_x1 - (OPJ_UINT32)tr_max->x0,
 3744|  3.27k|                       tr_max->win_y1 - (OPJ_UINT32)tr_max->y0,
 3745|  3.27k|                       tilec->data_win,
 3746|  3.27k|                       1, tr_max->win_x1 - tr_max->win_x0,
 3747|  3.27k|                       OPJ_TRUE);
  ------------------
  |  |  117|  3.27k|#define OPJ_TRUE 1
  ------------------
 3748|  3.27k|        assert(ret);
 3749|  3.27k|        OPJ_UNUSED(ret);
  ------------------
  |  |  219|  3.27k|#define OPJ_UNUSED(x) (void)x
  ------------------
 3750|  3.27k|    }
 3751|  3.27k|    opj_sparse_array_int32_free(sa);
 3752|       |
 3753|  3.27k|    opj_aligned_free(h.wavelet);
 3754|  3.27k|    return OPJ_TRUE;
  ------------------
  |  |  117|  3.27k|#define OPJ_TRUE 1
  ------------------
 3755|  3.27k|}
dwt.c:opj_v8dwt_interleave_partial_h:
 2953|   171k|{
 2954|   171k|    OPJ_UINT32 i;
 2955|  1.45M|    for (i = 0; i < remaining_height; i++) {
  ------------------
  |  Branch (2955:17): [True: 1.28M, False: 171k]
  ------------------
 2956|  1.28M|        OPJ_BOOL ret;
 2957|  1.28M|        ret = opj_sparse_array_int32_read(sa,
 2958|  1.28M|                                          dwt->win_l_x0, sa_line + i,
 2959|  1.28M|                                          dwt->win_l_x1, sa_line + i + 1,
 2960|       |                                          /* Nasty cast from float* to int32* */
 2961|  1.28M|                                          (OPJ_INT32*)(dwt->wavelet + dwt->cas + 2 * dwt->win_l_x0) + i,
 2962|  1.28M|                                          2 * NB_ELTS_V8, 0, OPJ_TRUE);
  ------------------
  |  |   90|  1.28M|#define NB_ELTS_V8  8
  ------------------
                                                        2 * NB_ELTS_V8, 0, OPJ_TRUE);
  ------------------
  |  |  117|  1.28M|#define OPJ_TRUE 1
  ------------------
 2963|  1.28M|        assert(ret);
 2964|  1.28M|        ret = opj_sparse_array_int32_read(sa,
 2965|  1.28M|                                          (OPJ_UINT32)dwt->sn + dwt->win_h_x0, sa_line + i,
 2966|  1.28M|                                          (OPJ_UINT32)dwt->sn + dwt->win_h_x1, sa_line + i + 1,
 2967|       |                                          /* Nasty cast from float* to int32* */
 2968|  1.28M|                                          (OPJ_INT32*)(dwt->wavelet + 1 - dwt->cas + 2 * dwt->win_h_x0) + i,
 2969|  1.28M|                                          2 * NB_ELTS_V8, 0, OPJ_TRUE);
  ------------------
  |  |   90|  1.28M|#define NB_ELTS_V8  8
  ------------------
                                                        2 * NB_ELTS_V8, 0, OPJ_TRUE);
  ------------------
  |  |  117|  1.28M|#define OPJ_TRUE 1
  ------------------
 2970|  1.28M|        assert(ret);
 2971|  1.28M|        OPJ_UNUSED(ret);
  ------------------
  |  |  219|  1.28M|#define OPJ_UNUSED(x) (void)x
  ------------------
 2972|  1.28M|    }
 2973|   171k|}
dwt.c:opj_v8dwt_interleave_partial_v:
 3001|   119k|{
 3002|   119k|    OPJ_BOOL ret;
 3003|   119k|    ret = opj_sparse_array_int32_read(sa,
 3004|   119k|                                      sa_col, dwt->win_l_x0,
 3005|   119k|                                      sa_col + nb_elts_read, dwt->win_l_x1,
 3006|   119k|                                      (OPJ_INT32*)(dwt->wavelet + dwt->cas + 2 * dwt->win_l_x0),
 3007|   119k|                                      1, 2 * NB_ELTS_V8, OPJ_TRUE);
  ------------------
  |  |   90|   119k|#define NB_ELTS_V8  8
  ------------------
                                                    1, 2 * NB_ELTS_V8, OPJ_TRUE);
  ------------------
  |  |  117|   119k|#define OPJ_TRUE 1
  ------------------
 3008|   119k|    assert(ret);
 3009|   119k|    ret = opj_sparse_array_int32_read(sa,
 3010|   119k|                                      sa_col, (OPJ_UINT32)dwt->sn + dwt->win_h_x0,
 3011|   119k|                                      sa_col + nb_elts_read, (OPJ_UINT32)dwt->sn + dwt->win_h_x1,
 3012|   119k|                                      (OPJ_INT32*)(dwt->wavelet + 1 - dwt->cas + 2 * dwt->win_h_x0),
 3013|   119k|                                      1, 2 * NB_ELTS_V8, OPJ_TRUE);
  ------------------
  |  |   90|   119k|#define NB_ELTS_V8  8
  ------------------
                                                    1, 2 * NB_ELTS_V8, OPJ_TRUE);
  ------------------
  |  |  117|   119k|#define OPJ_TRUE 1
  ------------------
 3014|   119k|    assert(ret);
 3015|   119k|    OPJ_UNUSED(ret);
  ------------------
  |  |  219|   119k|#define OPJ_UNUSED(x) (void)x
  ------------------
 3016|   119k|}

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

opj_procedure_list_create:
   40|  36.9k|{
   41|       |    /* memory allocation */
   42|  36.9k|    opj_procedure_list_t * l_validation = (opj_procedure_list_t *) opj_calloc(1,
   43|  36.9k|                                          sizeof(opj_procedure_list_t));
   44|  36.9k|    if (! l_validation) {
  ------------------
  |  Branch (44:9): [True: 0, False: 36.9k]
  ------------------
   45|      0|        return 00;
   46|      0|    }
   47|       |    /* initialization */
   48|  36.9k|    l_validation->m_nb_max_procedures = OPJ_VALIDATION_SIZE;
  ------------------
  |  |   37|  36.9k|#define OPJ_VALIDATION_SIZE 10
  ------------------
   49|  36.9k|    l_validation->m_procedures = (opj_procedure*)opj_calloc(OPJ_VALIDATION_SIZE,
  ------------------
  |  |   37|  36.9k|#define OPJ_VALIDATION_SIZE 10
  ------------------
   50|  36.9k|                                 sizeof(opj_procedure));
   51|  36.9k|    if (! l_validation->m_procedures) {
  ------------------
  |  Branch (51:9): [True: 0, False: 36.9k]
  ------------------
   52|      0|        opj_free(l_validation);
   53|      0|        return 00;
   54|      0|    }
   55|  36.9k|    return l_validation;
   56|  36.9k|}
opj_procedure_list_destroy:
   59|  36.9k|{
   60|  36.9k|    if (! p_list) {
  ------------------
  |  Branch (60:9): [True: 0, False: 36.9k]
  ------------------
   61|      0|        return;
   62|      0|    }
   63|       |    /* initialization */
   64|  36.9k|    if (p_list->m_procedures) {
  ------------------
  |  Branch (64:9): [True: 36.9k, False: 0]
  ------------------
   65|  36.9k|        opj_free(p_list->m_procedures);
   66|  36.9k|    }
   67|  36.9k|    opj_free(p_list);
   68|  36.9k|}
opj_procedure_list_add_procedure:
   72|  55.1k|{
   73|       |
   74|  55.1k|    assert(p_manager != NULL);
   75|       |
   76|  55.1k|    if (p_validation_list->m_nb_max_procedures ==
  ------------------
  |  Branch (76:9): [True: 0, False: 55.1k]
  ------------------
   77|  55.1k|            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|  55.1k|    p_validation_list->m_procedures[p_validation_list->m_nb_procedures] =
   96|  55.1k|        p_procedure;
   97|  55.1k|    ++p_validation_list->m_nb_procedures;
   98|       |
   99|  55.1k|    return OPJ_TRUE;
  ------------------
  |  |  117|  55.1k|#define OPJ_TRUE 1
  ------------------
  100|  55.1k|}
opj_procedure_list_get_nb_procedures:
  104|  48.3k|{
  105|  48.3k|    return p_validation_list->m_nb_procedures;
  106|  48.3k|}
opj_procedure_list_get_first_procedure:
  110|  48.3k|{
  111|  48.3k|    return p_validation_list->m_procedures;
  112|  48.3k|}
opj_procedure_list_clear:
  115|  48.3k|{
  116|  48.3k|    p_validation_list->m_nb_procedures = 0;
  117|  48.3k|}

opj_t1_ht_decode_cblk:
 1127|  29.5k|{
 1128|  29.5k|    OPJ_BYTE* cblkdata = NULL;
 1129|  29.5k|    OPJ_UINT8* coded_data;
 1130|  29.5k|    OPJ_UINT32* decoded_data;
 1131|  29.5k|    OPJ_UINT32 zero_bplanes;
 1132|  29.5k|    OPJ_UINT32 num_passes;
 1133|  29.5k|    OPJ_UINT32 lengths1;
 1134|  29.5k|    OPJ_UINT32 lengths2;
 1135|  29.5k|    OPJ_INT32 width;
 1136|  29.5k|    OPJ_INT32 height;
 1137|  29.5k|    OPJ_INT32 stride;
 1138|  29.5k|    OPJ_UINT32 *pflags, *sigma1, *sigma2, *mbr1, *mbr2, *sip, sip_shift;
 1139|  29.5k|    OPJ_UINT32 p;
 1140|  29.5k|    OPJ_UINT32 zero_bplanes_p1;
 1141|  29.5k|    int lcup, scup;
 1142|  29.5k|    dec_mel_t mel;
 1143|  29.5k|    rev_struct_t vlc;
 1144|  29.5k|    frwd_struct_t magsgn;
 1145|  29.5k|    frwd_struct_t sigprop;
 1146|  29.5k|    rev_struct_t magref;
 1147|  29.5k|    OPJ_UINT8 *lsp, *line_state;
 1148|  29.5k|    int run;
 1149|  29.5k|    OPJ_UINT32 vlc_val;              // fetched data from VLC bitstream
 1150|  29.5k|    OPJ_UINT32 qinf[2];
 1151|  29.5k|    OPJ_UINT32 c_q;
 1152|  29.5k|    OPJ_UINT32* sp;
 1153|  29.5k|    OPJ_INT32 x, y; // loop indices
 1154|  29.5k|    OPJ_BOOL stripe_causal = (cblksty & J2K_CCP_CBLKSTY_VSC) != 0;
  ------------------
  |  |   61|  29.5k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
 1155|  29.5k|    OPJ_UINT32 cblk_len = 0;
 1156|       |
 1157|  29.5k|    (void)(orient);      // stops unused parameter message
 1158|  29.5k|    (void)(check_pterm); // stops unused parameter message
 1159|       |
 1160|       |    // We ignor orient, because the same decoder is used for all subbands
 1161|       |    // We also ignore check_pterm, because I am not sure how it applies
 1162|  29.5k|    if (roishift != 0) {
  ------------------
  |  Branch (1162:9): [True: 1, False: 29.5k]
  ------------------
 1163|      1|        if (p_manager_mutex) {
  ------------------
  |  Branch (1163:13): [True: 1, False: 0]
  ------------------
 1164|      1|            opj_mutex_lock(p_manager_mutex);
 1165|      1|        }
 1166|      1|        opj_event_msg(p_manager, EVT_ERROR, "We do not support ROI in decoding "
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1167|      1|                      "HT codeblocks\n");
 1168|      1|        if (p_manager_mutex) {
  ------------------
  |  Branch (1168:13): [True: 1, False: 0]
  ------------------
 1169|      1|            opj_mutex_unlock(p_manager_mutex);
 1170|      1|        }
 1171|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 1172|      1|    }
 1173|       |
 1174|  29.5k|    if (!opj_t1_allocate_buffers(
  ------------------
  |  Branch (1174:9): [True: 0, False: 29.5k]
  ------------------
 1175|  29.5k|                t1,
 1176|  29.5k|                (OPJ_UINT32)(cblk->x1 - cblk->x0),
 1177|  29.5k|                (OPJ_UINT32)(cblk->y1 - cblk->y0))) {
 1178|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1179|      0|    }
 1180|       |
 1181|  29.5k|    if (cblk->Mb == 0) {
  ------------------
  |  Branch (1181:9): [True: 28.4k, False: 1.03k]
  ------------------
 1182|  28.4k|        return OPJ_TRUE;
  ------------------
  |  |  117|  28.4k|#define OPJ_TRUE 1
  ------------------
 1183|  28.4k|    }
 1184|       |
 1185|       |    /* numbps = Mb + 1 - zero_bplanes, Mb = Kmax, zero_bplanes = missing_msbs */
 1186|  1.03k|    zero_bplanes = (cblk->Mb + 1) - cblk->numbps;
 1187|       |
 1188|       |    /* Compute whole codeblock length from chunk lengths */
 1189|  1.03k|    cblk_len = 0;
 1190|  1.03k|    {
 1191|  1.03k|        OPJ_UINT32 i;
 1192|  51.0k|        for (i = 0; i < cblk->numchunks; i++) {
  ------------------
  |  Branch (1192:21): [True: 49.9k, False: 1.03k]
  ------------------
 1193|  49.9k|            cblk_len += cblk->chunks[i].len;
 1194|  49.9k|        }
 1195|  1.03k|    }
 1196|       |
 1197|  1.03k|    if (cblk->numchunks > 1 || t1->mustuse_cblkdatabuffer) {
  ------------------
  |  Branch (1197:9): [True: 899, False: 138]
  |  Branch (1197:32): [True: 0, False: 138]
  ------------------
 1198|    899|        OPJ_UINT32 i;
 1199|       |
 1200|       |        /* Allocate temporary memory if needed */
 1201|    899|        if (cblk_len > t1->cblkdatabuffersize) {
  ------------------
  |  Branch (1201:13): [True: 608, False: 291]
  ------------------
 1202|    608|            cblkdata = (OPJ_BYTE*)opj_realloc(
 1203|    608|                           t1->cblkdatabuffer, cblk_len);
 1204|    608|            if (cblkdata == NULL) {
  ------------------
  |  Branch (1204:17): [True: 0, False: 608]
  ------------------
 1205|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1206|      0|            }
 1207|    608|            t1->cblkdatabuffer = cblkdata;
 1208|    608|            t1->cblkdatabuffersize = cblk_len;
 1209|    608|        }
 1210|       |
 1211|       |        /* Concatenate all chunks */
 1212|    899|        cblkdata = t1->cblkdatabuffer;
 1213|    899|        cblk_len = 0;
 1214|  50.7k|        for (i = 0; i < cblk->numchunks; i++) {
  ------------------
  |  Branch (1214:21): [True: 49.8k, False: 899]
  ------------------
 1215|  49.8k|            memcpy(cblkdata + cblk_len, cblk->chunks[i].data, cblk->chunks[i].len);
 1216|  49.8k|            cblk_len += cblk->chunks[i].len;
 1217|  49.8k|        }
 1218|    899|    } else if (cblk->numchunks == 1) {
  ------------------
  |  Branch (1218:16): [True: 138, False: 0]
  ------------------
 1219|    138|        cblkdata = cblk->chunks[0].data;
 1220|    138|    } else {
 1221|       |        /* Not sure if that can happen in practice, but avoid Coverity to */
 1222|       |        /* think we will dereference a null cblkdta pointer */
 1223|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1224|      0|    }
 1225|       |
 1226|       |    // OPJ_BYTE* coded_data is a pointer to bitstream
 1227|  1.03k|    coded_data = cblkdata;
 1228|       |    // OPJ_UINT32* decoded_data is a pointer to decoded codeblock data buf.
 1229|  1.03k|    decoded_data = (OPJ_UINT32*)t1->data;
 1230|       |    // OPJ_UINT32 num_passes is the number of passes: 1 if CUP only, 2 for
 1231|       |    // CUP+SPP, and 3 for CUP+SPP+MRP
 1232|  1.03k|    num_passes = cblk->numsegs > 0 ? cblk->segs[0].real_num_passes : 0;
  ------------------
  |  Branch (1232:18): [True: 1.03k, False: 0]
  ------------------
 1233|  1.03k|    num_passes += cblk->numsegs > 1 ? cblk->segs[1].real_num_passes : 0;
  ------------------
  |  Branch (1233:19): [True: 893, False: 144]
  ------------------
 1234|       |    // OPJ_UINT32 lengths1 is the length of cleanup pass
 1235|  1.03k|    lengths1 = num_passes > 0 ? cblk->segs[0].len : 0;
  ------------------
  |  Branch (1235:16): [True: 1.03k, False: 0]
  ------------------
 1236|       |    // OPJ_UINT32 lengths2 is the length of refinement passes (either SPP only or SPP+MRP)
 1237|  1.03k|    lengths2 = num_passes > 1 ? cblk->segs[1].len : 0;
  ------------------
  |  Branch (1237:16): [True: 899, False: 138]
  ------------------
 1238|       |    // OPJ_INT32 width is the decoded codeblock width
 1239|  1.03k|    width = cblk->x1 - cblk->x0;
 1240|       |    // OPJ_INT32 height is the decoded codeblock height
 1241|  1.03k|    height = cblk->y1 - cblk->y0;
 1242|       |    // OPJ_INT32 stride is the decoded codeblock buffer stride
 1243|  1.03k|    stride = width;
 1244|       |
 1245|       |    /*  sigma1 and sigma2 contains significant (i.e., non-zero) pixel
 1246|       |     *  locations.  The buffers are used interchangeably, because we need
 1247|       |     *  more than 4 rows of significance information at a given time.
 1248|       |     *  Each 32 bits contain significance information for 4 rows of 8
 1249|       |     *  columns each.  If we denote 32 bits by 0xaaaaaaaa, the each "a" is
 1250|       |     *  called a nibble and has significance information for 4 rows.
 1251|       |     *  The least significant nibble has information for the first column,
 1252|       |     *  and so on. The nibble's LSB is for the first row, and so on.
 1253|       |     *  Since, at most, we can have 1024 columns in a quad, we need 128
 1254|       |     *  entries; we added 1 for convenience when propagation of signifcance
 1255|       |     *  goes outside the structure
 1256|       |     *  To work in OpenJPEG these buffers has been expanded to 132.
 1257|       |     */
 1258|       |    // OPJ_UINT32 *pflags, *sigma1, *sigma2, *mbr1, *mbr2, *sip, sip_shift;
 1259|  1.03k|    pflags = (OPJ_UINT32 *)t1->flags;
 1260|  1.03k|    sigma1 = pflags;
 1261|  1.03k|    sigma2 = sigma1 + 132;
 1262|       |    // mbr arrangement is similar to sigma; mbr contains locations
 1263|       |    // that become significant during significance propagation pass
 1264|  1.03k|    mbr1 = sigma2 + 132;
 1265|  1.03k|    mbr2 = mbr1 + 132;
 1266|       |    //a pointer to sigma
 1267|  1.03k|    sip = sigma1;  //pointers to arrays to be used interchangeably
 1268|  1.03k|    sip_shift = 0; //the amount of shift needed for sigma
 1269|       |
 1270|  1.03k|    if (num_passes > 1 && lengths2 == 0) {
  ------------------
  |  Branch (1270:9): [True: 899, False: 138]
  |  Branch (1270:27): [True: 179, False: 720]
  ------------------
 1271|    179|        if (p_manager_mutex) {
  ------------------
  |  Branch (1271:13): [True: 179, False: 0]
  ------------------
 1272|    179|            opj_mutex_lock(p_manager_mutex);
 1273|    179|        }
 1274|    179|        opj_event_msg(p_manager, EVT_WARNING, "A malformed codeblock that has "
  ------------------
  |  |   67|    179|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1275|    179|                      "more than one coding pass, but zero length for "
 1276|    179|                      "2nd and potentially the 3rd pass in an HT codeblock.\n");
 1277|    179|        if (p_manager_mutex) {
  ------------------
  |  Branch (1277:13): [True: 179, False: 0]
  ------------------
 1278|    179|            opj_mutex_unlock(p_manager_mutex);
 1279|    179|        }
 1280|    179|        num_passes = 1;
 1281|    179|    }
 1282|  1.03k|    if (num_passes > 3) {
  ------------------
  |  Branch (1282:9): [True: 61, False: 976]
  ------------------
 1283|     61|        if (p_manager_mutex) {
  ------------------
  |  Branch (1283:13): [True: 61, False: 0]
  ------------------
 1284|     61|            opj_mutex_lock(p_manager_mutex);
 1285|     61|        }
 1286|     61|        opj_event_msg(p_manager, EVT_ERROR, "We do not support more than 3 "
  ------------------
  |  |   66|     61|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1287|     61|                      "coding passes in an HT codeblock; This codeblocks has "
 1288|     61|                      "%d passes.\n", num_passes);
 1289|     61|        if (p_manager_mutex) {
  ------------------
  |  Branch (1289:13): [True: 61, False: 0]
  ------------------
 1290|     61|            opj_mutex_unlock(p_manager_mutex);
 1291|     61|        }
 1292|     61|        return OPJ_FALSE;
  ------------------
  |  |  118|     61|#define OPJ_FALSE 0
  ------------------
 1293|     61|    }
 1294|       |
 1295|    976|    if (cblk->Mb > 30) {
  ------------------
  |  Branch (1295:9): [True: 8, False: 968]
  ------------------
 1296|       |        /* This check is better moved to opj_t2_read_packet_header() in t2.c
 1297|       |           We do not have enough precision to decode any passes
 1298|       |           The design of openjpeg assumes that the bits of a 32-bit integer are
 1299|       |           assigned as follows:
 1300|       |           bit 31 is for sign
 1301|       |           bits 30-1 are for magnitude
 1302|       |           bit 0 is for the center of the quantization bin
 1303|       |           Therefore we can only do values of cblk->Mb <= 30
 1304|       |         */
 1305|      8|        if (p_manager_mutex) {
  ------------------
  |  Branch (1305:13): [True: 8, False: 0]
  ------------------
 1306|      8|            opj_mutex_lock(p_manager_mutex);
 1307|      8|        }
 1308|      8|        opj_event_msg(p_manager, EVT_ERROR, "32 bits are not enough to "
  ------------------
  |  |   66|      8|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1309|      8|                      "decode this codeblock, since the number of "
 1310|      8|                      "bitplane, %d, is larger than 30.\n", cblk->Mb);
 1311|      8|        if (p_manager_mutex) {
  ------------------
  |  Branch (1311:13): [True: 8, False: 0]
  ------------------
 1312|      8|            opj_mutex_unlock(p_manager_mutex);
 1313|      8|        }
 1314|      8|        return OPJ_FALSE;
  ------------------
  |  |  118|      8|#define OPJ_FALSE 0
  ------------------
 1315|      8|    }
 1316|    968|    if (zero_bplanes > cblk->Mb) {
  ------------------
  |  Branch (1316:9): [True: 18, False: 950]
  ------------------
 1317|       |        /* This check is better moved to opj_t2_read_packet_header() in t2.c,
 1318|       |           in the line "l_cblk->numbps = (OPJ_UINT32)l_band->numbps + 1 - i;"
 1319|       |           where i is the zero bitplanes, and should be no larger than cblk->Mb
 1320|       |           We cannot have more zero bitplanes than there are planes. */
 1321|     18|        if (p_manager_mutex) {
  ------------------
  |  Branch (1321:13): [True: 18, False: 0]
  ------------------
 1322|     18|            opj_mutex_lock(p_manager_mutex);
 1323|     18|        }
 1324|     18|        opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|     18|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1325|     18|                      "Decoding this codeblock is stopped. There are "
 1326|     18|                      "%d zero bitplanes in %d bitplanes.\n",
 1327|     18|                      zero_bplanes, cblk->Mb);
 1328|       |
 1329|     18|        if (p_manager_mutex) {
  ------------------
  |  Branch (1329:13): [True: 18, False: 0]
  ------------------
 1330|     18|            opj_mutex_unlock(p_manager_mutex);
 1331|     18|        }
 1332|     18|        return OPJ_FALSE;
  ------------------
  |  |  118|     18|#define OPJ_FALSE 0
  ------------------
 1333|    950|    } else if (zero_bplanes == cblk->Mb && num_passes > 1) {
  ------------------
  |  Branch (1333:16): [True: 24, False: 926]
  |  Branch (1333:44): [True: 18, False: 6]
  ------------------
 1334|       |        /* When the number of zero bitplanes is equal to the number of bitplanes,
 1335|       |           only the cleanup pass makes sense*/
 1336|     18|        if (only_cleanup_pass_is_decoded == OPJ_FALSE) {
  ------------------
  |  |  118|     18|#define OPJ_FALSE 0
  ------------------
  |  Branch (1336:13): [True: 1, False: 17]
  ------------------
 1337|      1|            if (p_manager_mutex) {
  ------------------
  |  Branch (1337:17): [True: 1, False: 0]
  ------------------
 1338|      1|                opj_mutex_lock(p_manager_mutex);
 1339|      1|            }
 1340|       |            /* We have a second check to prevent the possibility of an overrun condition,
 1341|       |               in the very unlikely event of a second thread discovering that
 1342|       |               only_cleanup_pass_is_decoded is false before the first thread changing
 1343|       |               the condition. */
 1344|      1|            if (only_cleanup_pass_is_decoded == OPJ_FALSE) {
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
  |  Branch (1344:17): [True: 1, False: 0]
  ------------------
 1345|      1|                only_cleanup_pass_is_decoded = OPJ_TRUE;
  ------------------
  |  |  117|      1|#define OPJ_TRUE 1
  ------------------
 1346|      1|                opj_event_msg(p_manager, EVT_WARNING, "Malformed HT codeblock. "
  ------------------
  |  |   67|      1|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1347|      1|                              "When the number of zero planes bitplanes is "
 1348|      1|                              "equal to the number of bitplanes, only the cleanup "
 1349|      1|                              "pass makes sense, but we have %d passes in this "
 1350|      1|                              "codeblock. Therefore, only the cleanup pass will be "
 1351|      1|                              "decoded. This message will not be displayed again.\n",
 1352|      1|                              num_passes);
 1353|      1|            }
 1354|      1|            if (p_manager_mutex) {
  ------------------
  |  Branch (1354:17): [True: 1, False: 0]
  ------------------
 1355|      1|                opj_mutex_unlock(p_manager_mutex);
 1356|      1|            }
 1357|      1|        }
 1358|     18|        num_passes = 1;
 1359|     18|    }
 1360|       |
 1361|       |    /* OPJ_UINT32 */
 1362|    950|    p = cblk->numbps;
 1363|       |
 1364|       |    // OPJ_UINT32 zero planes plus 1
 1365|    950|    zero_bplanes_p1 = zero_bplanes + 1;
 1366|       |
 1367|    950|    if (lengths1 < 2 || (OPJ_UINT32)lengths1 > cblk_len ||
  ------------------
  |  Branch (1367:9): [True: 79, False: 871]
  |  Branch (1367:25): [True: 0, False: 871]
  ------------------
 1368|    950|            (OPJ_UINT32)(lengths1 + lengths2) > cblk_len) {
  ------------------
  |  Branch (1368:13): [True: 0, False: 871]
  ------------------
 1369|     79|        if (p_manager_mutex) {
  ------------------
  |  Branch (1369:13): [True: 79, False: 0]
  ------------------
 1370|     79|            opj_mutex_lock(p_manager_mutex);
 1371|     79|        }
 1372|     79|        opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|     79|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1373|     79|                      "Invalid codeblock length values.\n");
 1374|       |
 1375|     79|        if (p_manager_mutex) {
  ------------------
  |  Branch (1375:13): [True: 79, False: 0]
  ------------------
 1376|     79|            opj_mutex_unlock(p_manager_mutex);
 1377|     79|        }
 1378|     79|        return OPJ_FALSE;
  ------------------
  |  |  118|     79|#define OPJ_FALSE 0
  ------------------
 1379|     79|    }
 1380|       |    // read scup and fix the bytes there
 1381|    871|    lcup = (int)lengths1;  // length of CUP
 1382|       |    //scup is the length of MEL + VLC
 1383|    871|    scup = (((int)coded_data[lcup - 1]) << 4) + (coded_data[lcup - 2] & 0xF);
 1384|    871|    if (scup < 2 || scup > lcup || scup > 4079) { //something is wrong
  ------------------
  |  Branch (1384:9): [True: 7, False: 864]
  |  Branch (1384:21): [True: 69, False: 795]
  |  Branch (1384:36): [True: 1, False: 794]
  ------------------
 1385|       |        /* The standard stipulates 2 <= Scup <= min(Lcup, 4079) */
 1386|     77|        if (p_manager_mutex) {
  ------------------
  |  Branch (1386:13): [True: 77, False: 0]
  ------------------
 1387|     77|            opj_mutex_lock(p_manager_mutex);
 1388|     77|        }
 1389|     77|        opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|     77|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1390|     77|                      "One of the following condition is not met: "
 1391|     77|                      "2 <= Scup <= min(Lcup, 4079)\n");
 1392|       |
 1393|     77|        if (p_manager_mutex) {
  ------------------
  |  Branch (1393:13): [True: 77, False: 0]
  ------------------
 1394|     77|            opj_mutex_unlock(p_manager_mutex);
 1395|     77|        }
 1396|     77|        return OPJ_FALSE;
  ------------------
  |  |  118|     77|#define OPJ_FALSE 0
  ------------------
 1397|     77|    }
 1398|       |
 1399|       |    // init structures
 1400|    794|    if (mel_init(&mel, coded_data, lcup, scup) == OPJ_FALSE) {
  ------------------
  |  |  118|    794|#define OPJ_FALSE 0
  ------------------
  |  Branch (1400:9): [True: 3, False: 791]
  ------------------
 1401|      3|        if (p_manager_mutex) {
  ------------------
  |  Branch (1401:13): [True: 3, False: 0]
  ------------------
 1402|      3|            opj_mutex_lock(p_manager_mutex);
 1403|      3|        }
 1404|      3|        opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1405|      3|                      "Incorrect MEL segment sequence.\n");
 1406|      3|        if (p_manager_mutex) {
  ------------------
  |  Branch (1406:13): [True: 3, False: 0]
  ------------------
 1407|      3|            opj_mutex_unlock(p_manager_mutex);
 1408|      3|        }
 1409|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 1410|      3|    }
 1411|    791|    rev_init(&vlc, coded_data, lcup, scup);
 1412|    791|    frwd_init(&magsgn, coded_data, lcup - scup, 0xFF);
 1413|    791|    if (num_passes > 1) { // needs to be tested
  ------------------
  |  Branch (1413:9): [True: 601, False: 190]
  ------------------
 1414|    601|        frwd_init(&sigprop, coded_data + lengths1, (int)lengths2, 0);
 1415|    601|    }
 1416|    791|    if (num_passes > 2) {
  ------------------
  |  Branch (1416:9): [True: 290, False: 501]
  ------------------
 1417|    290|        rev_init_mrp(&magref, coded_data, (int)lengths1, (int)lengths2);
 1418|    290|    }
 1419|       |
 1420|       |    /** State storage
 1421|       |      *  One byte per quad; for 1024 columns, or 512 quads, we need
 1422|       |      *  512 bytes. We are using 2 extra bytes one on the left and one on
 1423|       |      *  the right for convenience.
 1424|       |      *
 1425|       |      *  The MSB bit in each byte is (\sigma^nw | \sigma^n), and the 7 LSBs
 1426|       |      *  contain max(E^nw | E^n)
 1427|       |      */
 1428|       |
 1429|       |    // 514 is enough for a block width of 1024, +2 extra
 1430|       |    // here expanded to 528
 1431|    791|    line_state = (OPJ_UINT8 *)(mbr2 + 132);
 1432|       |
 1433|       |    //initial 2 lines
 1434|       |    /////////////////
 1435|    791|    lsp = line_state;              // point to line state
 1436|    791|    lsp[0] = 0;                    // for initial row of quad, we set to 0
 1437|    791|    run = mel_get_run(&mel);    // decode runs of events from MEL bitstrm
 1438|       |    // data represented as runs of 0 events
 1439|       |    // See mel_decode description
 1440|    791|    qinf[0] = qinf[1] = 0;      // quad info decoded from VLC bitstream
 1441|    791|    c_q = 0;                    // context for quad q
 1442|    791|    sp = decoded_data;          // decoded codeblock samples
 1443|       |    // vlc_val;                 // fetched data from VLC bitstream
 1444|       |
 1445|  17.1k|    for (x = 0; x < width; x += 4) { // one iteration per quad pair
  ------------------
  |  Branch (1445:17): [True: 16.4k, False: 703]
  ------------------
 1446|  16.4k|        OPJ_UINT32 U_q[2]; // u values for the quad pair
 1447|  16.4k|        OPJ_UINT32 uvlc_mode;
 1448|  16.4k|        OPJ_UINT32 consumed_bits;
 1449|  16.4k|        OPJ_UINT32 m_n, v_n;
 1450|  16.4k|        OPJ_UINT32 ms_val;
 1451|  16.4k|        OPJ_UINT32 locs;
 1452|       |
 1453|       |        // decode VLC
 1454|       |        /////////////
 1455|       |
 1456|       |        //first quad
 1457|       |        // Get the head of the VLC bitstream. One fetch is enough for two
 1458|       |        // quads, since the largest VLC code is 7 bits, and maximum number of
 1459|       |        // bits used for u is 8.  Therefore for two quads we need 30 bits
 1460|       |        // (if we include unstuffing, then 32 bits are enough, since we have
 1461|       |        // a maximum of one stuffing per two bytes)
 1462|  16.4k|        vlc_val = rev_fetch(&vlc);
 1463|       |
 1464|       |        //decode VLC using the context c_q and the head of the VLC bitstream
 1465|  16.4k|        qinf[0] = vlc_tbl0[(c_q << 7) | (vlc_val & 0x7F) ];
 1466|       |
 1467|  16.4k|        if (c_q == 0) { // if zero context, we need to use one MEL event
  ------------------
  |  Branch (1467:13): [True: 9.53k, False: 6.94k]
  ------------------
 1468|  9.53k|            run -= 2; //the number of 0 events is multiplied by 2, so subtract 2
 1469|       |
 1470|       |            // Is the run terminated in 1? if so, use decoded VLC code,
 1471|       |            // otherwise, discard decoded data, since we will decoded again
 1472|       |            // using a different context
 1473|  9.53k|            qinf[0] = (run == -1) ? qinf[0] : 0;
  ------------------
  |  Branch (1473:23): [True: 3.08k, False: 6.45k]
  ------------------
 1474|       |
 1475|       |            // is run -1 or -2? this means a run has been consumed
 1476|  9.53k|            if (run < 0) {
  ------------------
  |  Branch (1476:17): [True: 5.05k, False: 4.48k]
  ------------------
 1477|  5.05k|                run = mel_get_run(&mel);    // get another run
 1478|  5.05k|            }
 1479|  9.53k|        }
 1480|       |
 1481|       |        // prepare context for the next quad; eqn. 1 in ITU T.814
 1482|  16.4k|        c_q = ((qinf[0] & 0x10) >> 4) | ((qinf[0] & 0xE0) >> 5);
 1483|       |
 1484|       |        //remove data from vlc stream (0 bits are removed if qinf is not used)
 1485|  16.4k|        vlc_val = rev_advance(&vlc, qinf[0] & 0x7);
 1486|       |
 1487|       |        //update sigma
 1488|       |        // The update depends on the value of x; consider one OPJ_UINT32
 1489|       |        // if x is 0, 8, 16 and so on, then this line update c locations
 1490|       |        //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1491|       |        //                         LSB   c c 0 0 0 0 0 0
 1492|       |        //                               c c 0 0 0 0 0 0
 1493|       |        //                               0 0 0 0 0 0 0 0
 1494|       |        //                               0 0 0 0 0 0 0 0
 1495|       |        // if x is 4, 12, 20, then this line update locations c
 1496|       |        //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1497|       |        //                         LSB   0 0 0 0 c c 0 0
 1498|       |        //                               0 0 0 0 c c 0 0
 1499|       |        //                               0 0 0 0 0 0 0 0
 1500|       |        //                               0 0 0 0 0 0 0 0
 1501|  16.4k|        *sip |= (((qinf[0] & 0x30) >> 4) | ((qinf[0] & 0xC0) >> 2)) << sip_shift;
 1502|       |
 1503|       |        //second quad
 1504|  16.4k|        qinf[1] = 0;
 1505|  16.4k|        if (x + 2 < width) { // do not run if codeblock is narrower
  ------------------
  |  Branch (1505:13): [True: 16.1k, False: 366]
  ------------------
 1506|       |            //decode VLC using the context c_q and the head of the VLC bitstream
 1507|  16.1k|            qinf[1] = vlc_tbl0[(c_q << 7) | (vlc_val & 0x7F)];
 1508|       |
 1509|       |            // if context is zero, use one MEL event
 1510|  16.1k|            if (c_q == 0) { //zero context
  ------------------
  |  Branch (1510:17): [True: 8.83k, False: 7.27k]
  ------------------
 1511|  8.83k|                run -= 2; //subtract 2, since events number if multiplied by 2
 1512|       |
 1513|       |                // if event is 0, discard decoded qinf
 1514|  8.83k|                qinf[1] = (run == -1) ? qinf[1] : 0;
  ------------------
  |  Branch (1514:27): [True: 2.58k, False: 6.25k]
  ------------------
 1515|       |
 1516|  8.83k|                if (run < 0) { // have we consumed all events in a run
  ------------------
  |  Branch (1516:21): [True: 4.00k, False: 4.83k]
  ------------------
 1517|  4.00k|                    run = mel_get_run(&mel);    // if yes, then get another run
 1518|  4.00k|                }
 1519|  8.83k|            }
 1520|       |
 1521|       |            //prepare context for the next quad, eqn. 1 in ITU T.814
 1522|  16.1k|            c_q = ((qinf[1] & 0x10) >> 4) | ((qinf[1] & 0xE0) >> 5);
 1523|       |
 1524|       |            //remove data from vlc stream, if qinf is not used, cwdlen is 0
 1525|  16.1k|            vlc_val = rev_advance(&vlc, qinf[1] & 0x7);
 1526|  16.1k|        }
 1527|       |
 1528|       |        //update sigma
 1529|       |        // The update depends on the value of x; consider one OPJ_UINT32
 1530|       |        // if x is 0, 8, 16 and so on, then this line update c locations
 1531|       |        //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1532|       |        //                         LSB   0 0 c c 0 0 0 0
 1533|       |        //                               0 0 c c 0 0 0 0
 1534|       |        //                               0 0 0 0 0 0 0 0
 1535|       |        //                               0 0 0 0 0 0 0 0
 1536|       |        // if x is 4, 12, 20, then this line update locations c
 1537|       |        //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1538|       |        //                         LSB   0 0 0 0 0 0 c c
 1539|       |        //                               0 0 0 0 0 0 c c
 1540|       |        //                               0 0 0 0 0 0 0 0
 1541|       |        //                               0 0 0 0 0 0 0 0
 1542|  16.4k|        *sip |= (((qinf[1] & 0x30) | ((qinf[1] & 0xC0) << 2))) << (4 + sip_shift);
 1543|       |
 1544|  16.4k|        sip += x & 0x7 ? 1 : 0; // move sigma pointer to next entry
  ------------------
  |  Branch (1544:16): [True: 8.03k, False: 8.44k]
  ------------------
 1545|  16.4k|        sip_shift ^= 0x10;      // increment/decrement sip_shift by 16
 1546|       |
 1547|       |        // retrieve u
 1548|       |        /////////////
 1549|       |
 1550|       |        // uvlc_mode is made up of u_offset bits from the quad pair
 1551|  16.4k|        uvlc_mode = ((qinf[0] & 0x8) >> 3) | ((qinf[1] & 0x8) >> 2);
 1552|  16.4k|        if (uvlc_mode == 3) { // if both u_offset are set, get an event from
  ------------------
  |  Branch (1552:13): [True: 3.20k, False: 13.2k]
  ------------------
 1553|       |            // the MEL run of events
 1554|  3.20k|            run -= 2; //subtract 2, since events number if multiplied by 2
 1555|  3.20k|            uvlc_mode += (run == -1) ? 1 : 0; //increment uvlc_mode if event is 1
  ------------------
  |  Branch (1555:26): [True: 1.18k, False: 2.01k]
  ------------------
 1556|  3.20k|            if (run < 0) { // if run is consumed (run is -1 or -2), get another run
  ------------------
  |  Branch (1556:17): [True: 1.80k, False: 1.39k]
  ------------------
 1557|  1.80k|                run = mel_get_run(&mel);
 1558|  1.80k|            }
 1559|  3.20k|        }
 1560|       |        //decode uvlc_mode to get u for both quads
 1561|  16.4k|        consumed_bits = decode_init_uvlc(vlc_val, uvlc_mode, U_q);
 1562|  16.4k|        if (U_q[0] > zero_bplanes_p1 || U_q[1] > zero_bplanes_p1) {
  ------------------
  |  Branch (1562:13): [True: 53, False: 16.4k]
  |  Branch (1562:41): [True: 16, False: 16.4k]
  ------------------
 1563|     69|            if (p_manager_mutex) {
  ------------------
  |  Branch (1563:17): [True: 69, False: 0]
  ------------------
 1564|     69|                opj_mutex_lock(p_manager_mutex);
 1565|     69|            }
 1566|     69|            opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. Decoding "
  ------------------
  |  |   66|     69|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1567|     69|                          "this codeblock is stopped. U_q is larger than zero "
 1568|     69|                          "bitplanes + 1 \n");
 1569|     69|            if (p_manager_mutex) {
  ------------------
  |  Branch (1569:17): [True: 69, False: 0]
  ------------------
 1570|     69|                opj_mutex_unlock(p_manager_mutex);
 1571|     69|            }
 1572|     69|            return OPJ_FALSE;
  ------------------
  |  |  118|     69|#define OPJ_FALSE 0
  ------------------
 1573|     69|        }
 1574|       |
 1575|       |        //consume u bits in the VLC code
 1576|  16.4k|        vlc_val = rev_advance(&vlc, consumed_bits);
 1577|       |
 1578|       |        //decode magsgn and update line_state
 1579|       |        /////////////////////////////////////
 1580|       |
 1581|       |        //We obtain a mask for the samples locations that needs evaluation
 1582|  16.4k|        locs = 0xFF;
 1583|  16.4k|        if (x + 4 > width) {
  ------------------
  |  Branch (1583:13): [True: 425, False: 15.9k]
  ------------------
 1584|    425|            locs >>= (x + 4 - width) << 1;    // limits width
 1585|    425|        }
 1586|  16.4k|        locs = height > 1 ? locs : (locs & 0x55);         // limits height
  ------------------
  |  Branch (1586:16): [True: 16.1k, False: 265]
  ------------------
 1587|       |
 1588|  16.4k|        if ((((qinf[0] & 0xF0) >> 4) | (qinf[1] & 0xF0)) & ~locs) {
  ------------------
  |  Branch (1588:13): [True: 19, False: 16.3k]
  ------------------
 1589|     19|            if (p_manager_mutex) {
  ------------------
  |  Branch (1589:17): [True: 19, False: 0]
  ------------------
 1590|     19|                opj_mutex_lock(p_manager_mutex);
 1591|     19|            }
 1592|     19|            opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|     19|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1593|     19|                          "VLC code produces significant samples outside "
 1594|     19|                          "the codeblock area.\n");
 1595|     19|            if (p_manager_mutex) {
  ------------------
  |  Branch (1595:17): [True: 19, False: 0]
  ------------------
 1596|     19|                opj_mutex_unlock(p_manager_mutex);
 1597|     19|            }
 1598|     19|            return OPJ_FALSE;
  ------------------
  |  |  118|     19|#define OPJ_FALSE 0
  ------------------
 1599|     19|        }
 1600|       |
 1601|       |        //first quad, starting at first sample in quad and moving on
 1602|  16.3k|        if (qinf[0] & 0x10) { //is it significant? (sigma_n)
  ------------------
  |  Branch (1602:13): [True: 3.92k, False: 12.4k]
  ------------------
 1603|  3.92k|            OPJ_UINT32 val;
 1604|       |
 1605|  3.92k|            ms_val = frwd_fetch(&magsgn);         //get 32 bits of magsgn data
 1606|  3.92k|            m_n = U_q[0] - ((qinf[0] >> 12) & 1); //evaluate m_n (number of bits
 1607|       |            // to read from bitstream), using EMB e_k
 1608|  3.92k|            frwd_advance(&magsgn, m_n);         //consume m_n
 1609|  3.92k|            val = ms_val << 31;                 //get sign bit
 1610|  3.92k|            v_n = ms_val & ((1U << m_n) - 1);   //keep only m_n bits
 1611|  3.92k|            v_n |= ((qinf[0] & 0x100) >> 8) << m_n;  //add EMB e_1 as MSB
 1612|  3.92k|            v_n |= 1;                                //add center of bin
 1613|       |            //v_n now has 2 * (\mu - 1) + 0.5 with correct sign bit
 1614|       |            //add 2 to make it 2*\mu+0.5, shift it up to missing MSBs
 1615|  3.92k|            sp[0] = val | ((v_n + 2) << (p - 1));
 1616|  12.4k|        } else if (locs & 0x1) { // if this is inside the codeblock, set the
  ------------------
  |  Branch (1616:20): [True: 12.4k, False: 0]
  ------------------
 1617|  12.4k|            sp[0] = 0;           // sample to zero
 1618|  12.4k|        }
 1619|       |
 1620|  16.3k|        if (qinf[0] & 0x20) { //sigma_n
  ------------------
  |  Branch (1620:13): [True: 6.31k, False: 10.0k]
  ------------------
 1621|  6.31k|            OPJ_UINT32 val, t;
 1622|       |
 1623|  6.31k|            ms_val = frwd_fetch(&magsgn);         //get 32 bits
 1624|  6.31k|            m_n = U_q[0] - ((qinf[0] >> 13) & 1); //m_n, uses EMB e_k
 1625|  6.31k|            frwd_advance(&magsgn, m_n);           //consume m_n
 1626|  6.31k|            val = ms_val << 31;                   //get sign bit
 1627|  6.31k|            v_n = ms_val & ((1U << m_n) - 1);     //keep only m_n bits
 1628|  6.31k|            v_n |= ((qinf[0] & 0x200) >> 9) << m_n; //add EMB e_1
 1629|  6.31k|            v_n |= 1;                               //bin center
 1630|       |            //v_n now has 2 * (\mu - 1) + 0.5 with correct sign bit
 1631|       |            //add 2 to make it 2*\mu+0.5, shift it up to missing MSBs
 1632|  6.31k|            sp[stride] = val | ((v_n + 2) << (p - 1));
 1633|       |
 1634|       |            //update line_state: bit 7 (\sigma^N), and E^N
 1635|  6.31k|            t = lsp[0] & 0x7F;       // keep E^NW
 1636|  6.31k|            v_n = 32 - count_leading_zeros(v_n);
 1637|  6.31k|            lsp[0] = (OPJ_UINT8)(0x80 | (t > v_n ? t : v_n)); //max(E^NW, E^N) | s
  ------------------
  |  Branch (1637:42): [True: 313, False: 6.00k]
  ------------------
 1638|  10.0k|        } else if (locs & 0x2) { // if this is inside the codeblock, set the
  ------------------
  |  Branch (1638:20): [True: 9.82k, False: 251]
  ------------------
 1639|  9.82k|            sp[stride] = 0;      // sample to zero
 1640|  9.82k|        }
 1641|       |
 1642|  16.3k|        ++lsp; // move to next quad information
 1643|  16.3k|        ++sp;  // move to next column of samples
 1644|       |
 1645|       |        //this is similar to the above two samples
 1646|  16.3k|        if (qinf[0] & 0x40) {
  ------------------
  |  Branch (1646:13): [True: 3.52k, False: 12.8k]
  ------------------
 1647|  3.52k|            OPJ_UINT32 val;
 1648|       |
 1649|  3.52k|            ms_val = frwd_fetch(&magsgn);
 1650|  3.52k|            m_n = U_q[0] - ((qinf[0] >> 14) & 1);
 1651|  3.52k|            frwd_advance(&magsgn, m_n);
 1652|  3.52k|            val = ms_val << 31;
 1653|  3.52k|            v_n = ms_val & ((1U << m_n) - 1);
 1654|  3.52k|            v_n |= (((qinf[0] & 0x400) >> 10) << m_n);
 1655|  3.52k|            v_n |= 1;
 1656|  3.52k|            sp[0] = val | ((v_n + 2) << (p - 1));
 1657|  12.8k|        } else if (locs & 0x4) {
  ------------------
  |  Branch (1657:20): [True: 12.7k, False: 155]
  ------------------
 1658|  12.7k|            sp[0] = 0;
 1659|  12.7k|        }
 1660|       |
 1661|  16.3k|        lsp[0] = 0;
 1662|  16.3k|        if (qinf[0] & 0x80) {
  ------------------
  |  Branch (1662:13): [True: 4.06k, False: 12.3k]
  ------------------
 1663|  4.06k|            OPJ_UINT32 val;
 1664|  4.06k|            ms_val = frwd_fetch(&magsgn);
 1665|  4.06k|            m_n = U_q[0] - ((qinf[0] >> 15) & 1); //m_n
 1666|  4.06k|            frwd_advance(&magsgn, m_n);
 1667|  4.06k|            val = ms_val << 31;
 1668|  4.06k|            v_n = ms_val & ((1U << m_n) - 1);
 1669|  4.06k|            v_n |= ((qinf[0] & 0x800) >> 11) << m_n;
 1670|  4.06k|            v_n |= 1; //center of bin
 1671|  4.06k|            sp[stride] = val | ((v_n + 2) << (p - 1));
 1672|       |
 1673|       |            //line_state: bit 7 (\sigma^NW), and E^NW for next quad
 1674|  4.06k|            lsp[0] = (OPJ_UINT8)(0x80 | (32 - count_leading_zeros(v_n)));
 1675|  12.3k|        } else if (locs & 0x8) { //if outside set to 0
  ------------------
  |  Branch (1675:20): [True: 11.9k, False: 402]
  ------------------
 1676|  11.9k|            sp[stride] = 0;
 1677|  11.9k|        }
 1678|       |
 1679|  16.3k|        ++sp; //move to next column
 1680|       |
 1681|       |        //second quad
 1682|  16.3k|        if (qinf[1] & 0x10) {
  ------------------
  |  Branch (1682:13): [True: 3.81k, False: 12.5k]
  ------------------
 1683|  3.81k|            OPJ_UINT32 val;
 1684|       |
 1685|  3.81k|            ms_val = frwd_fetch(&magsgn);
 1686|  3.81k|            m_n = U_q[1] - ((qinf[1] >> 12) & 1); //m_n
 1687|  3.81k|            frwd_advance(&magsgn, m_n);
 1688|  3.81k|            val = ms_val << 31;
 1689|  3.81k|            v_n = ms_val & ((1U << m_n) - 1);
 1690|  3.81k|            v_n |= (((qinf[1] & 0x100) >> 8) << m_n);
 1691|  3.81k|            v_n |= 1;
 1692|  3.81k|            sp[0] = val | ((v_n + 2) << (p - 1));
 1693|  12.5k|        } else if (locs & 0x10) {
  ------------------
  |  Branch (1693:20): [True: 12.2k, False: 357]
  ------------------
 1694|  12.2k|            sp[0] = 0;
 1695|  12.2k|        }
 1696|       |
 1697|  16.3k|        if (qinf[1] & 0x20) {
  ------------------
  |  Branch (1697:13): [True: 6.11k, False: 10.2k]
  ------------------
 1698|  6.11k|            OPJ_UINT32 val, t;
 1699|       |
 1700|  6.11k|            ms_val = frwd_fetch(&magsgn);
 1701|  6.11k|            m_n = U_q[1] - ((qinf[1] >> 13) & 1); //m_n
 1702|  6.11k|            frwd_advance(&magsgn, m_n);
 1703|  6.11k|            val = ms_val << 31;
 1704|  6.11k|            v_n = ms_val & ((1U << m_n) - 1);
 1705|  6.11k|            v_n |= (((qinf[1] & 0x200) >> 9) << m_n);
 1706|  6.11k|            v_n |= 1;
 1707|  6.11k|            sp[stride] = val | ((v_n + 2) << (p - 1));
 1708|       |
 1709|       |            //update line_state: bit 7 (\sigma^N), and E^N
 1710|  6.11k|            t = lsp[0] & 0x7F;            //E^NW
 1711|  6.11k|            v_n = 32 - count_leading_zeros(v_n);     //E^N
 1712|  6.11k|            lsp[0] = (OPJ_UINT8)(0x80 | (t > v_n ? t : v_n)); //max(E^NW, E^N) | s
  ------------------
  |  Branch (1712:42): [True: 1.67k, False: 4.44k]
  ------------------
 1713|  10.2k|        } else if (locs & 0x20) {
  ------------------
  |  Branch (1713:20): [True: 9.67k, False: 602]
  ------------------
 1714|  9.67k|            sp[stride] = 0;    //no need to update line_state
 1715|  9.67k|        }
 1716|       |
 1717|  16.3k|        ++lsp; //move line state to next quad
 1718|  16.3k|        ++sp;  //move to next sample
 1719|       |
 1720|  16.3k|        if (qinf[1] & 0x40) {
  ------------------
  |  Branch (1720:13): [True: 3.64k, False: 12.7k]
  ------------------
 1721|  3.64k|            OPJ_UINT32 val;
 1722|       |
 1723|  3.64k|            ms_val = frwd_fetch(&magsgn);
 1724|  3.64k|            m_n = U_q[1] - ((qinf[1] >> 14) & 1); //m_n
 1725|  3.64k|            frwd_advance(&magsgn, m_n);
 1726|  3.64k|            val = ms_val << 31;
 1727|  3.64k|            v_n = ms_val & ((1U << m_n) - 1);
 1728|  3.64k|            v_n |= (((qinf[1] & 0x400) >> 10) << m_n);
 1729|  3.64k|            v_n |= 1;
 1730|  3.64k|            sp[0] = val | ((v_n + 2) << (p - 1));
 1731|  12.7k|        } else if (locs & 0x40) {
  ------------------
  |  Branch (1731:20): [True: 12.3k, False: 420]
  ------------------
 1732|  12.3k|            sp[0] = 0;
 1733|  12.3k|        }
 1734|       |
 1735|  16.3k|        lsp[0] = 0;
 1736|  16.3k|        if (qinf[1] & 0x80) {
  ------------------
  |  Branch (1736:13): [True: 3.11k, False: 13.2k]
  ------------------
 1737|  3.11k|            OPJ_UINT32 val;
 1738|       |
 1739|  3.11k|            ms_val = frwd_fetch(&magsgn);
 1740|  3.11k|            m_n = U_q[1] - ((qinf[1] >> 15) & 1); //m_n
 1741|  3.11k|            frwd_advance(&magsgn, m_n);
 1742|  3.11k|            val = ms_val << 31;
 1743|  3.11k|            v_n = ms_val & ((1U << m_n) - 1);
 1744|  3.11k|            v_n |= (((qinf[1] & 0x800) >> 11) << m_n);
 1745|  3.11k|            v_n |= 1; //center of bin
 1746|  3.11k|            sp[stride] = val | ((v_n + 2) << (p - 1));
 1747|       |
 1748|       |            //line_state: bit 7 (\sigma^NW), and E^NW for next quad
 1749|  3.11k|            lsp[0] = (OPJ_UINT8)(0x80 | (32 - count_leading_zeros(v_n)));
 1750|  13.2k|        } else if (locs & 0x80) {
  ------------------
  |  Branch (1750:20): [True: 12.6k, False: 663]
  ------------------
 1751|  12.6k|            sp[stride] = 0;
 1752|  12.6k|        }
 1753|       |
 1754|  16.3k|        ++sp;
 1755|  16.3k|    }
 1756|       |
 1757|       |    //non-initial lines
 1758|       |    //////////////////////////
 1759|  15.1k|    for (y = 2; y < height; /*done at the end of loop*/) {
  ------------------
  |  Branch (1759:17): [True: 14.5k, False: 609]
  ------------------
 1760|  14.5k|        OPJ_UINT32 *sip;
 1761|  14.5k|        OPJ_UINT8 ls0;
 1762|  14.5k|        OPJ_INT32 x;
 1763|       |
 1764|  14.5k|        sip_shift ^= 0x2;  // shift sigma to the upper half od the nibble
 1765|  14.5k|        sip_shift &= 0xFFFFFFEFU; //move back to 0 (it might have been at 0x10)
 1766|  14.5k|        sip = y & 0x4 ? sigma2 : sigma1; //choose sigma array
  ------------------
  |  Branch (1766:15): [True: 7.23k, False: 7.26k]
  ------------------
 1767|       |
 1768|  14.5k|        lsp = line_state;
 1769|  14.5k|        ls0 = lsp[0];                   // read the line state value
 1770|  14.5k|        lsp[0] = 0;                     // and set it to zero
 1771|  14.5k|        sp = decoded_data + y * stride; // generated samples
 1772|  14.5k|        c_q = 0;                        // context
 1773|  93.2k|        for (x = 0; x < width; x += 4) {
  ------------------
  |  Branch (1773:21): [True: 78.8k, False: 14.4k]
  ------------------
 1774|  78.8k|            OPJ_UINT32 U_q[2];
 1775|  78.8k|            OPJ_UINT32 uvlc_mode, consumed_bits;
 1776|  78.8k|            OPJ_UINT32 m_n, v_n;
 1777|  78.8k|            OPJ_UINT32 ms_val;
 1778|  78.8k|            OPJ_UINT32 locs;
 1779|       |
 1780|       |            // decode vlc
 1781|       |            /////////////
 1782|       |
 1783|       |            //first quad
 1784|       |            // get context, eqn. 2 ITU T.814
 1785|       |            // c_q has \sigma^W | \sigma^SW
 1786|  78.8k|            c_q |= (ls0 >> 7);          //\sigma^NW | \sigma^N
 1787|  78.8k|            c_q |= (lsp[1] >> 5) & 0x4; //\sigma^NE | \sigma^NF
 1788|       |
 1789|       |            //the following is very similar to previous code, so please refer to
 1790|       |            // that
 1791|  78.8k|            vlc_val = rev_fetch(&vlc);
 1792|  78.8k|            qinf[0] = vlc_tbl1[(c_q << 7) | (vlc_val & 0x7F)];
 1793|  78.8k|            if (c_q == 0) { //zero context
  ------------------
  |  Branch (1793:17): [True: 66.6k, False: 12.1k]
  ------------------
 1794|  66.6k|                run -= 2;
 1795|  66.6k|                qinf[0] = (run == -1) ? qinf[0] : 0;
  ------------------
  |  Branch (1795:27): [True: 8.43k, False: 58.2k]
  ------------------
 1796|  66.6k|                if (run < 0) {
  ------------------
  |  Branch (1796:21): [True: 14.0k, False: 52.6k]
  ------------------
 1797|  14.0k|                    run = mel_get_run(&mel);
 1798|  14.0k|                }
 1799|  66.6k|            }
 1800|       |            //prepare context for the next quad, \sigma^W | \sigma^SW
 1801|  78.8k|            c_q = ((qinf[0] & 0x40) >> 5) | ((qinf[0] & 0x80) >> 6);
 1802|       |
 1803|       |            //remove data from vlc stream
 1804|  78.8k|            vlc_val = rev_advance(&vlc, qinf[0] & 0x7);
 1805|       |
 1806|       |            //update sigma
 1807|       |            // The update depends on the value of x and y; consider one OPJ_UINT32
 1808|       |            // if x is 0, 8, 16 and so on, and y is 2, 6, etc., then this
 1809|       |            // line update c locations
 1810|       |            //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1811|       |            //                         LSB   0 0 0 0 0 0 0 0
 1812|       |            //                               0 0 0 0 0 0 0 0
 1813|       |            //                               c c 0 0 0 0 0 0
 1814|       |            //                               c c 0 0 0 0 0 0
 1815|  78.8k|            *sip |= (((qinf[0] & 0x30) >> 4) | ((qinf[0] & 0xC0) >> 2)) << sip_shift;
 1816|       |
 1817|       |            //second quad
 1818|  78.8k|            qinf[1] = 0;
 1819|  78.8k|            if (x + 2 < width) {
  ------------------
  |  Branch (1819:17): [True: 76.7k, False: 2.10k]
  ------------------
 1820|  76.7k|                c_q |= (lsp[1] >> 7);
 1821|  76.7k|                c_q |= (lsp[2] >> 5) & 0x4;
 1822|  76.7k|                qinf[1] = vlc_tbl1[(c_q << 7) | (vlc_val & 0x7F)];
 1823|  76.7k|                if (c_q == 0) { //zero context
  ------------------
  |  Branch (1823:21): [True: 64.6k, False: 12.0k]
  ------------------
 1824|  64.6k|                    run -= 2;
 1825|  64.6k|                    qinf[1] = (run == -1) ? qinf[1] : 0;
  ------------------
  |  Branch (1825:31): [True: 8.03k, False: 56.5k]
  ------------------
 1826|  64.6k|                    if (run < 0) {
  ------------------
  |  Branch (1826:25): [True: 13.0k, False: 51.5k]
  ------------------
 1827|  13.0k|                        run = mel_get_run(&mel);
 1828|  13.0k|                    }
 1829|  64.6k|                }
 1830|       |                //prepare context for the next quad
 1831|  76.7k|                c_q = ((qinf[1] & 0x40) >> 5) | ((qinf[1] & 0x80) >> 6);
 1832|       |                //remove data from vlc stream
 1833|  76.7k|                vlc_val = rev_advance(&vlc, qinf[1] & 0x7);
 1834|  76.7k|            }
 1835|       |
 1836|       |            //update sigma
 1837|  78.8k|            *sip |= (((qinf[1] & 0x30) | ((qinf[1] & 0xC0) << 2))) << (4 + sip_shift);
 1838|       |
 1839|  78.8k|            sip += x & 0x7 ? 1 : 0;
  ------------------
  |  Branch (1839:20): [True: 34.2k, False: 44.6k]
  ------------------
 1840|  78.8k|            sip_shift ^= 0x10;
 1841|       |
 1842|       |            //retrieve u
 1843|       |            ////////////
 1844|  78.8k|            uvlc_mode = ((qinf[0] & 0x8) >> 3) | ((qinf[1] & 0x8) >> 2);
 1845|  78.8k|            consumed_bits = decode_noninit_uvlc(vlc_val, uvlc_mode, U_q);
 1846|  78.8k|            vlc_val = rev_advance(&vlc, consumed_bits);
 1847|       |
 1848|       |            //calculate E^max and add it to U_q, eqns 5 and 6 in ITU T.814
 1849|  78.8k|            if ((qinf[0] & 0xF0) & ((qinf[0] & 0xF0) - 1)) { // is \gamma_q 1?
  ------------------
  |  Branch (1849:17): [True: 6.26k, False: 72.5k]
  ------------------
 1850|  6.26k|                OPJ_UINT32 E = (ls0 & 0x7Fu);
 1851|  6.26k|                E = E > (lsp[1] & 0x7Fu) ? E : (lsp[1] & 0x7Fu); //max(E, E^NE, E^NF)
  ------------------
  |  Branch (1851:21): [True: 1.77k, False: 4.48k]
  ------------------
 1852|       |                //since U_q already has u_q + 1, we subtract 2 instead of 1
 1853|  6.26k|                U_q[0] += E > 2 ? E - 2 : 0;
  ------------------
  |  Branch (1853:27): [True: 2.03k, False: 4.22k]
  ------------------
 1854|  6.26k|            }
 1855|       |
 1856|  78.8k|            if ((qinf[1] & 0xF0) & ((qinf[1] & 0xF0) - 1)) { //is \gamma_q 1?
  ------------------
  |  Branch (1856:17): [True: 6.49k, False: 72.3k]
  ------------------
 1857|  6.49k|                OPJ_UINT32 E = (lsp[1] & 0x7Fu);
 1858|  6.49k|                E = E > (lsp[2] & 0x7Fu) ? E : (lsp[2] & 0x7Fu); //max(E, E^NE, E^NF)
  ------------------
  |  Branch (1858:21): [True: 2.41k, False: 4.08k]
  ------------------
 1859|       |                //since U_q already has u_q + 1, we subtract 2 instead of 1
 1860|  6.49k|                U_q[1] += E > 2 ? E - 2 : 0;
  ------------------
  |  Branch (1860:27): [True: 2.23k, False: 4.26k]
  ------------------
 1861|  6.49k|            }
 1862|       |
 1863|  78.8k|            if (U_q[0] > zero_bplanes_p1 || U_q[1] > zero_bplanes_p1) {
  ------------------
  |  Branch (1863:17): [True: 56, False: 78.7k]
  |  Branch (1863:45): [True: 28, False: 78.7k]
  ------------------
 1864|     84|                if (p_manager_mutex) {
  ------------------
  |  Branch (1864:21): [True: 84, False: 0]
  ------------------
 1865|     84|                    opj_mutex_lock(p_manager_mutex);
 1866|     84|                }
 1867|     84|                opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|     84|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1868|     84|                              "Decoding this codeblock is stopped. U_q is"
 1869|     84|                              "larger than bitplanes + 1 \n");
 1870|     84|                if (p_manager_mutex) {
  ------------------
  |  Branch (1870:21): [True: 84, False: 0]
  ------------------
 1871|     84|                    opj_mutex_unlock(p_manager_mutex);
 1872|     84|                }
 1873|     84|                return OPJ_FALSE;
  ------------------
  |  |  118|     84|#define OPJ_FALSE 0
  ------------------
 1874|     84|            }
 1875|       |
 1876|  78.7k|            ls0 = lsp[2]; //for next double quad
 1877|  78.7k|            lsp[1] = lsp[2] = 0;
 1878|       |
 1879|       |            //decode magsgn and update line_state
 1880|       |            /////////////////////////////////////
 1881|       |
 1882|       |            //locations where samples need update
 1883|  78.7k|            locs = 0xFF;
 1884|  78.7k|            if (x + 4 > width) {
  ------------------
  |  Branch (1884:17): [True: 2.48k, False: 76.2k]
  ------------------
 1885|  2.48k|                locs >>= (x + 4 - width) << 1;
 1886|  2.48k|            }
 1887|  78.7k|            locs = y + 2 <= height ? locs : (locs & 0x55);
  ------------------
  |  Branch (1887:20): [True: 77.1k, False: 1.54k]
  ------------------
 1888|       |
 1889|  78.7k|            if ((((qinf[0] & 0xF0) >> 4) | (qinf[1] & 0xF0)) & ~locs) {
  ------------------
  |  Branch (1889:17): [True: 10, False: 78.7k]
  ------------------
 1890|     10|                if (p_manager_mutex) {
  ------------------
  |  Branch (1890:21): [True: 10, False: 0]
  ------------------
 1891|     10|                    opj_mutex_lock(p_manager_mutex);
 1892|     10|                }
 1893|     10|                opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1894|     10|                              "VLC code produces significant samples outside "
 1895|     10|                              "the codeblock area.\n");
 1896|     10|                if (p_manager_mutex) {
  ------------------
  |  Branch (1896:21): [True: 10, False: 0]
  ------------------
 1897|     10|                    opj_mutex_unlock(p_manager_mutex);
 1898|     10|                }
 1899|     10|                return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
 1900|     10|            }
 1901|       |
 1902|       |
 1903|       |
 1904|  78.7k|            if (qinf[0] & 0x10) { //sigma_n
  ------------------
  |  Branch (1904:17): [True: 13.2k, False: 65.5k]
  ------------------
 1905|  13.2k|                OPJ_UINT32 val;
 1906|       |
 1907|  13.2k|                ms_val = frwd_fetch(&magsgn);
 1908|  13.2k|                m_n = U_q[0] - ((qinf[0] >> 12) & 1); //m_n
 1909|  13.2k|                frwd_advance(&magsgn, m_n);
 1910|  13.2k|                val = ms_val << 31;
 1911|  13.2k|                v_n = ms_val & ((1U << m_n) - 1);
 1912|  13.2k|                v_n |= ((qinf[0] & 0x100) >> 8) << m_n;
 1913|  13.2k|                v_n |= 1; //center of bin
 1914|  13.2k|                sp[0] = val | ((v_n + 2) << (p - 1));
 1915|  65.5k|            } else if (locs & 0x1) {
  ------------------
  |  Branch (1915:24): [True: 65.5k, False: 0]
  ------------------
 1916|  65.5k|                sp[0] = 0;
 1917|  65.5k|            }
 1918|       |
 1919|  78.7k|            if (qinf[0] & 0x20) { //sigma_n
  ------------------
  |  Branch (1919:17): [True: 4.24k, False: 74.4k]
  ------------------
 1920|  4.24k|                OPJ_UINT32 val, t;
 1921|       |
 1922|  4.24k|                ms_val = frwd_fetch(&magsgn);
 1923|  4.24k|                m_n = U_q[0] - ((qinf[0] >> 13) & 1); //m_n
 1924|  4.24k|                frwd_advance(&magsgn, m_n);
 1925|  4.24k|                val = ms_val << 31;
 1926|  4.24k|                v_n = ms_val & ((1U << m_n) - 1);
 1927|  4.24k|                v_n |= ((qinf[0] & 0x200) >> 9) << m_n;
 1928|  4.24k|                v_n |= 1; //center of bin
 1929|  4.24k|                sp[stride] = val | ((v_n + 2) << (p - 1));
 1930|       |
 1931|       |                //update line_state: bit 7 (\sigma^N), and E^N
 1932|  4.24k|                t = lsp[0] & 0x7F;          //E^NW
 1933|  4.24k|                v_n = 32 - count_leading_zeros(v_n);
 1934|  4.24k|                lsp[0] = (OPJ_UINT8)(0x80 | (t > v_n ? t : v_n));
  ------------------
  |  Branch (1934:46): [True: 1.20k, False: 3.04k]
  ------------------
 1935|  74.4k|            } else if (locs & 0x2) {
  ------------------
  |  Branch (1935:24): [True: 72.9k, False: 1.54k]
  ------------------
 1936|  72.9k|                sp[stride] = 0;    //no need to update line_state
 1937|  72.9k|            }
 1938|       |
 1939|  78.7k|            ++lsp;
 1940|  78.7k|            ++sp;
 1941|       |
 1942|  78.7k|            if (qinf[0] & 0x40) { //sigma_n
  ------------------
  |  Branch (1942:17): [True: 4.76k, False: 73.9k]
  ------------------
 1943|  4.76k|                OPJ_UINT32 val;
 1944|       |
 1945|  4.76k|                ms_val = frwd_fetch(&magsgn);
 1946|  4.76k|                m_n = U_q[0] - ((qinf[0] >> 14) & 1); //m_n
 1947|  4.76k|                frwd_advance(&magsgn, m_n);
 1948|  4.76k|                val = ms_val << 31;
 1949|  4.76k|                v_n = ms_val & ((1U << m_n) - 1);
 1950|  4.76k|                v_n |= (((qinf[0] & 0x400) >> 10) << m_n);
 1951|  4.76k|                v_n |= 1;                            //center of bin
 1952|  4.76k|                sp[0] = val | ((v_n + 2) << (p - 1));
 1953|  73.9k|            } else if (locs & 0x4) {
  ------------------
  |  Branch (1953:24): [True: 73.2k, False: 753]
  ------------------
 1954|  73.2k|                sp[0] = 0;
 1955|  73.2k|            }
 1956|       |
 1957|  78.7k|            if (qinf[0] & 0x80) { //sigma_n
  ------------------
  |  Branch (1957:17): [True: 5.20k, False: 73.5k]
  ------------------
 1958|  5.20k|                OPJ_UINT32 val;
 1959|       |
 1960|  5.20k|                ms_val = frwd_fetch(&magsgn);
 1961|  5.20k|                m_n = U_q[0] - ((qinf[0] >> 15) & 1); //m_n
 1962|  5.20k|                frwd_advance(&magsgn, m_n);
 1963|  5.20k|                val = ms_val << 31;
 1964|  5.20k|                v_n = ms_val & ((1U << m_n) - 1);
 1965|  5.20k|                v_n |= ((qinf[0] & 0x800) >> 11) << m_n;
 1966|  5.20k|                v_n |= 1; //center of bin
 1967|  5.20k|                sp[stride] = val | ((v_n + 2) << (p - 1));
 1968|       |
 1969|       |                //update line_state: bit 7 (\sigma^NW), and E^NW for next quad
 1970|  5.20k|                lsp[0] = (OPJ_UINT8)(0x80 | (32 - count_leading_zeros(v_n)));
 1971|  73.5k|            } else if (locs & 0x8) {
  ------------------
  |  Branch (1971:24): [True: 71.2k, False: 2.27k]
  ------------------
 1972|  71.2k|                sp[stride] = 0;
 1973|  71.2k|            }
 1974|       |
 1975|  78.7k|            ++sp;
 1976|       |
 1977|  78.7k|            if (qinf[1] & 0x10) { //sigma_n
  ------------------
  |  Branch (1977:17): [True: 12.1k, False: 66.6k]
  ------------------
 1978|  12.1k|                OPJ_UINT32 val;
 1979|       |
 1980|  12.1k|                ms_val = frwd_fetch(&magsgn);
 1981|  12.1k|                m_n = U_q[1] - ((qinf[1] >> 12) & 1); //m_n
 1982|  12.1k|                frwd_advance(&magsgn, m_n);
 1983|  12.1k|                val = ms_val << 31;
 1984|  12.1k|                v_n = ms_val & ((1U << m_n) - 1);
 1985|  12.1k|                v_n |= (((qinf[1] & 0x100) >> 8) << m_n);
 1986|  12.1k|                v_n |= 1;                            //center of bin
 1987|  12.1k|                sp[0] = val | ((v_n + 2) << (p - 1));
 1988|  66.6k|            } else if (locs & 0x10) {
  ------------------
  |  Branch (1988:24): [True: 64.4k, False: 2.10k]
  ------------------
 1989|  64.4k|                sp[0] = 0;
 1990|  64.4k|            }
 1991|       |
 1992|  78.7k|            if (qinf[1] & 0x20) { //sigma_n
  ------------------
  |  Branch (1992:17): [True: 5.88k, False: 72.8k]
  ------------------
 1993|  5.88k|                OPJ_UINT32 val, t;
 1994|       |
 1995|  5.88k|                ms_val = frwd_fetch(&magsgn);
 1996|  5.88k|                m_n = U_q[1] - ((qinf[1] >> 13) & 1); //m_n
 1997|  5.88k|                frwd_advance(&magsgn, m_n);
 1998|  5.88k|                val = ms_val << 31;
 1999|  5.88k|                v_n = ms_val & ((1U << m_n) - 1);
 2000|  5.88k|                v_n |= (((qinf[1] & 0x200) >> 9) << m_n);
 2001|  5.88k|                v_n |= 1; //center of bin
 2002|  5.88k|                sp[stride] = val | ((v_n + 2) << (p - 1));
 2003|       |
 2004|       |                //update line_state: bit 7 (\sigma^N), and E^N
 2005|  5.88k|                t = lsp[0] & 0x7F;          //E^NW
 2006|  5.88k|                v_n = 32 - count_leading_zeros(v_n);
 2007|  5.88k|                lsp[0] = (OPJ_UINT8)(0x80 | (t > v_n ? t : v_n));
  ------------------
  |  Branch (2007:46): [True: 1.05k, False: 4.83k]
  ------------------
 2008|  72.8k|            } else if (locs & 0x20) {
  ------------------
  |  Branch (2008:24): [True: 69.2k, False: 3.57k]
  ------------------
 2009|  69.2k|                sp[stride] = 0;    //no need to update line_state
 2010|  69.2k|            }
 2011|       |
 2012|  78.7k|            ++lsp;
 2013|  78.7k|            ++sp;
 2014|       |
 2015|  78.7k|            if (qinf[1] & 0x40) { //sigma_n
  ------------------
  |  Branch (2015:17): [True: 4.17k, False: 74.5k]
  ------------------
 2016|  4.17k|                OPJ_UINT32 val;
 2017|       |
 2018|  4.17k|                ms_val = frwd_fetch(&magsgn);
 2019|  4.17k|                m_n = U_q[1] - ((qinf[1] >> 14) & 1); //m_n
 2020|  4.17k|                frwd_advance(&magsgn, m_n);
 2021|  4.17k|                val = ms_val << 31;
 2022|  4.17k|                v_n = ms_val & ((1U << m_n) - 1);
 2023|  4.17k|                v_n |= (((qinf[1] & 0x400) >> 10) << m_n);
 2024|  4.17k|                v_n |= 1;                            //center of bin
 2025|  4.17k|                sp[0] = val | ((v_n + 2) << (p - 1));
 2026|  74.5k|            } else if (locs & 0x40) {
  ------------------
  |  Branch (2026:24): [True: 72.0k, False: 2.48k]
  ------------------
 2027|  72.0k|                sp[0] = 0;
 2028|  72.0k|            }
 2029|       |
 2030|  78.7k|            if (qinf[1] & 0x80) { //sigma_n
  ------------------
  |  Branch (2030:17): [True: 3.44k, False: 75.2k]
  ------------------
 2031|  3.44k|                OPJ_UINT32 val;
 2032|       |
 2033|  3.44k|                ms_val = frwd_fetch(&magsgn);
 2034|  3.44k|                m_n = U_q[1] - ((qinf[1] >> 15) & 1); //m_n
 2035|  3.44k|                frwd_advance(&magsgn, m_n);
 2036|  3.44k|                val = ms_val << 31;
 2037|  3.44k|                v_n = ms_val & ((1U << m_n) - 1);
 2038|  3.44k|                v_n |= (((qinf[1] & 0x800) >> 11) << m_n);
 2039|  3.44k|                v_n |= 1; //center of bin
 2040|  3.44k|                sp[stride] = val | ((v_n + 2) << (p - 1));
 2041|       |
 2042|       |                //update line_state: bit 7 (\sigma^NW), and E^NW for next quad
 2043|  3.44k|                lsp[0] = (OPJ_UINT8)(0x80 | (32 - count_leading_zeros(v_n)));
 2044|  75.2k|            } else if (locs & 0x80) {
  ------------------
  |  Branch (2044:24): [True: 71.3k, False: 3.92k]
  ------------------
 2045|  71.3k|                sp[stride] = 0;
 2046|  71.3k|            }
 2047|       |
 2048|  78.7k|            ++sp;
 2049|  78.7k|        }
 2050|       |
 2051|  14.4k|        y += 2;
 2052|  14.4k|        if (num_passes > 1 && (y & 3) == 0) { //executed at multiples of 4
  ------------------
  |  Branch (2052:13): [True: 11.0k, False: 3.33k]
  |  Branch (2052:31): [True: 5.66k, False: 5.41k]
  ------------------
 2053|       |            // This is for SPP and potentially MRP
 2054|       |
 2055|  5.66k|            if (num_passes > 2) { //do MRP
  ------------------
  |  Branch (2055:17): [True: 4.09k, False: 1.57k]
  ------------------
 2056|       |                // select the current stripe
 2057|  4.09k|                OPJ_UINT32 *cur_sig = y & 0x4 ? sigma1 : sigma2;
  ------------------
  |  Branch (2057:39): [True: 2.09k, False: 1.99k]
  ------------------
 2058|       |                // the address of the data that needs updating
 2059|  4.09k|                OPJ_UINT32 *dpp = decoded_data + (y - 4) * stride;
 2060|  4.09k|                OPJ_UINT32 half = 1u << (p - 2); // half the center of the bin
 2061|  4.09k|                OPJ_INT32 i;
 2062|  16.8k|                for (i = 0; i < width; i += 8) {
  ------------------
  |  Branch (2062:29): [True: 12.7k, False: 4.09k]
  ------------------
 2063|       |                    //Process one entry from sigma array at a time
 2064|       |                    // Each nibble (4 bits) in the sigma array represents 4 rows,
 2065|       |                    // and the 32 bits contain 8 columns
 2066|  12.7k|                    OPJ_UINT32 cwd = rev_fetch_mrp(&magref); // get 32 bit data
 2067|  12.7k|                    OPJ_UINT32 sig = *cur_sig++; // 32 bit that will be processed now
 2068|  12.7k|                    OPJ_UINT32 col_mask = 0xFu;  // a mask for a column in sig
 2069|  12.7k|                    OPJ_UINT32 *dp = dpp + i;    // next column in decode samples
 2070|  12.7k|                    if (sig) { // if any of the 32 bits are set
  ------------------
  |  Branch (2070:25): [True: 5.18k, False: 7.55k]
  ------------------
 2071|  5.18k|                        int j;
 2072|  46.7k|                        for (j = 0; j < 8; ++j, dp++) { //one column at a time
  ------------------
  |  Branch (2072:37): [True: 41.5k, False: 5.18k]
  ------------------
 2073|  41.5k|                            if (sig & col_mask) { // lowest nibble
  ------------------
  |  Branch (2073:33): [True: 22.4k, False: 19.1k]
  ------------------
 2074|  22.4k|                                OPJ_UINT32 sample_mask = 0x11111111u & col_mask; //LSB
 2075|       |
 2076|  22.4k|                                if (sig & sample_mask) { //if LSB is set
  ------------------
  |  Branch (2076:37): [True: 13.8k, False: 8.56k]
  ------------------
 2077|  13.8k|                                    OPJ_UINT32 sym;
 2078|       |
 2079|  13.8k|                                    assert(dp[0] != 0); // decoded value cannot be zero
 2080|  13.8k|                                    sym = cwd & 1; // get it value
 2081|       |                                    // remove center of bin if sym is 0
 2082|  13.8k|                                    dp[0] ^= (1 - sym) << (p - 1);
 2083|  13.8k|                                    dp[0] |= half;      // put half the center of bin
 2084|  13.8k|                                    cwd >>= 1;          //consume word
 2085|  13.8k|                                }
 2086|  22.4k|                                sample_mask += sample_mask; //next row
 2087|       |
 2088|  22.4k|                                if (sig & sample_mask) {
  ------------------
  |  Branch (2088:37): [True: 11.9k, False: 10.4k]
  ------------------
 2089|  11.9k|                                    OPJ_UINT32 sym;
 2090|       |
 2091|  11.9k|                                    assert(dp[stride] != 0);
 2092|  11.9k|                                    sym = cwd & 1;
 2093|  11.9k|                                    dp[stride] ^= (1 - sym) << (p - 1);
 2094|  11.9k|                                    dp[stride] |= half;
 2095|  11.9k|                                    cwd >>= 1;
 2096|  11.9k|                                }
 2097|  22.4k|                                sample_mask += sample_mask;
 2098|       |
 2099|  22.4k|                                if (sig & sample_mask) {
  ------------------
  |  Branch (2099:37): [True: 13.6k, False: 8.78k]
  ------------------
 2100|  13.6k|                                    OPJ_UINT32 sym;
 2101|       |
 2102|  13.6k|                                    assert(dp[2 * stride] != 0);
 2103|  13.6k|                                    sym = cwd & 1;
 2104|  13.6k|                                    dp[2 * stride] ^= (1 - sym) << (p - 1);
 2105|  13.6k|                                    dp[2 * stride] |= half;
 2106|  13.6k|                                    cwd >>= 1;
 2107|  13.6k|                                }
 2108|  22.4k|                                sample_mask += sample_mask;
 2109|       |
 2110|  22.4k|                                if (sig & sample_mask) {
  ------------------
  |  Branch (2110:37): [True: 7.39k, False: 15.0k]
  ------------------
 2111|  7.39k|                                    OPJ_UINT32 sym;
 2112|       |
 2113|  7.39k|                                    assert(dp[3 * stride] != 0);
 2114|  7.39k|                                    sym = cwd & 1;
 2115|  7.39k|                                    dp[3 * stride] ^= (1 - sym) << (p - 1);
 2116|  7.39k|                                    dp[3 * stride] |= half;
 2117|  7.39k|                                    cwd >>= 1;
 2118|  7.39k|                                }
 2119|  22.4k|                                sample_mask += sample_mask;
 2120|  22.4k|                            }
 2121|  41.5k|                            col_mask <<= 4; //next column
 2122|  41.5k|                        }
 2123|  5.18k|                    }
 2124|       |                    // consume data according to the number of bits set
 2125|  12.7k|                    rev_advance_mrp(&magref, population_count(sig));
 2126|  12.7k|                }
 2127|  4.09k|            }
 2128|       |
 2129|  5.66k|            if (y >= 4) { // update mbr array at the end of each stripe
  ------------------
  |  Branch (2129:17): [True: 5.66k, False: 0]
  ------------------
 2130|       |                //generate mbr corresponding to a stripe
 2131|  5.66k|                OPJ_UINT32 *sig = y & 0x4 ? sigma1 : sigma2;
  ------------------
  |  Branch (2131:35): [True: 2.96k, False: 2.70k]
  ------------------
 2132|  5.66k|                OPJ_UINT32 *mbr = y & 0x4 ? mbr1 : mbr2;
  ------------------
  |  Branch (2132:35): [True: 2.96k, False: 2.70k]
  ------------------
 2133|       |
 2134|       |                //data is processed in patches of 8 columns, each
 2135|       |                // each 32 bits in sigma1 or mbr1 represent 4 rows
 2136|       |
 2137|       |                //integrate horizontally
 2138|  5.66k|                OPJ_UINT32 prev = 0; // previous columns
 2139|  5.66k|                OPJ_INT32 i;
 2140|  23.1k|                for (i = 0; i < width; i += 8, mbr++, sig++) {
  ------------------
  |  Branch (2140:29): [True: 17.4k, False: 5.66k]
  ------------------
 2141|  17.4k|                    OPJ_UINT32 t, z;
 2142|       |
 2143|  17.4k|                    mbr[0] = sig[0];         //start with significant samples
 2144|  17.4k|                    mbr[0] |= prev >> 28;    //for first column, left neighbors
 2145|  17.4k|                    mbr[0] |= sig[0] << 4;   //left neighbors
 2146|  17.4k|                    mbr[0] |= sig[0] >> 4;   //right neighbors
 2147|  17.4k|                    mbr[0] |= sig[1] << 28;  //for last column, right neighbors
 2148|  17.4k|                    prev = sig[0];           // for next group of columns
 2149|       |
 2150|       |                    //integrate vertically
 2151|  17.4k|                    t = mbr[0], z = mbr[0];
 2152|  17.4k|                    z |= (t & 0x77777777) << 1; //above neighbors
 2153|  17.4k|                    z |= (t & 0xEEEEEEEE) >> 1; //below neighbors
 2154|  17.4k|                    mbr[0] = z & ~sig[0]; //remove already significance samples
 2155|  17.4k|                }
 2156|  5.66k|            }
 2157|       |
 2158|  5.66k|            if (y >= 8) { //wait until 8 rows has been processed
  ------------------
  |  Branch (2158:17): [True: 5.22k, False: 440]
  ------------------
 2159|  5.22k|                OPJ_UINT32 *cur_sig, *cur_mbr, *nxt_sig, *nxt_mbr;
 2160|  5.22k|                OPJ_UINT32 prev;
 2161|  5.22k|                OPJ_UINT32 val;
 2162|  5.22k|                OPJ_INT32 i;
 2163|       |
 2164|       |                // add membership from the next stripe, obtained above
 2165|  5.22k|                cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2165:27): [True: 2.52k, False: 2.70k]
  ------------------
 2166|  5.22k|                cur_mbr = y & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2166:27): [True: 2.52k, False: 2.70k]
  ------------------
 2167|  5.22k|                nxt_sig = y & 0x4 ? sigma1 : sigma2;  //future samples
  ------------------
  |  Branch (2167:27): [True: 2.52k, False: 2.70k]
  ------------------
 2168|  5.22k|                prev = 0; // the columns before these group of 8 columns
 2169|  19.8k|                for (i = 0; i < width; i += 8, cur_mbr++, cur_sig++, nxt_sig++) {
  ------------------
  |  Branch (2169:29): [True: 14.6k, False: 5.22k]
  ------------------
 2170|  14.6k|                    OPJ_UINT32 t = nxt_sig[0];
 2171|  14.6k|                    t |= prev >> 28;        //for first column, left neighbors
 2172|  14.6k|                    t |= nxt_sig[0] << 4;   //left neighbors
 2173|  14.6k|                    t |= nxt_sig[0] >> 4;   //right neighbors
 2174|  14.6k|                    t |= nxt_sig[1] << 28;  //for last column, right neighbors
 2175|  14.6k|                    prev = nxt_sig[0];      // for next group of columns
 2176|       |
 2177|  14.6k|                    if (!stripe_causal) {
  ------------------
  |  Branch (2177:25): [True: 9.65k, False: 4.97k]
  ------------------
 2178|  9.65k|                        cur_mbr[0] |= (t & 0x11111111u) << 3; //propagate up to cur_mbr
 2179|  9.65k|                    }
 2180|  14.6k|                    cur_mbr[0] &= ~cur_sig[0]; //remove already significance samples
 2181|  14.6k|                }
 2182|       |
 2183|       |                //find new locations and get signs
 2184|  5.22k|                cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2184:27): [True: 2.52k, False: 2.70k]
  ------------------
 2185|  5.22k|                cur_mbr = y & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2185:27): [True: 2.52k, False: 2.70k]
  ------------------
 2186|  5.22k|                nxt_sig = y & 0x4 ? sigma1 : sigma2; //future samples
  ------------------
  |  Branch (2186:27): [True: 2.52k, False: 2.70k]
  ------------------
 2187|  5.22k|                nxt_mbr = y & 0x4 ? mbr1 : mbr2;     //future samples
  ------------------
  |  Branch (2187:27): [True: 2.52k, False: 2.70k]
  ------------------
 2188|  5.22k|                val = 3u << (p - 2); // sample values for newly discovered
 2189|       |                // significant samples including the bin center
 2190|  19.8k|                for (i = 0; i < width;
  ------------------
  |  Branch (2190:29): [True: 14.6k, False: 5.22k]
  ------------------
 2191|  14.6k|                        i += 8, cur_sig++, cur_mbr++, nxt_sig++, nxt_mbr++) {
 2192|  14.6k|                    OPJ_UINT32 ux, tx;
 2193|  14.6k|                    OPJ_UINT32 mbr = *cur_mbr;
 2194|  14.6k|                    OPJ_UINT32 new_sig = 0;
 2195|  14.6k|                    if (mbr) { //are there any samples that might be significant
  ------------------
  |  Branch (2195:25): [True: 6.14k, False: 8.48k]
  ------------------
 2196|  6.14k|                        OPJ_INT32 n;
 2197|  18.4k|                        for (n = 0; n < 8; n += 4) {
  ------------------
  |  Branch (2197:37): [True: 12.2k, False: 6.14k]
  ------------------
 2198|  12.2k|                            OPJ_UINT32 col_mask;
 2199|  12.2k|                            OPJ_UINT32 inv_sig;
 2200|  12.2k|                            OPJ_INT32 end;
 2201|  12.2k|                            OPJ_INT32 j;
 2202|       |
 2203|  12.2k|                            OPJ_UINT32 cwd = frwd_fetch(&sigprop); //get 32 bits
 2204|  12.2k|                            OPJ_UINT32 cnt = 0;
 2205|       |
 2206|  12.2k|                            OPJ_UINT32 *dp = decoded_data + (y - 8) * stride;
 2207|  12.2k|                            dp += i + n; //address for decoded samples
 2208|       |
 2209|  12.2k|                            col_mask = 0xFu << (4 * n); //a mask to select a column
 2210|       |
 2211|  12.2k|                            inv_sig = ~cur_sig[0]; // insignificant samples
 2212|       |
 2213|       |                            //find the last sample we operate on
 2214|  12.2k|                            end = n + 4 + i < width ? n + 4 : width - i;
  ------------------
  |  Branch (2214:35): [True: 8.48k, False: 3.79k]
  ------------------
 2215|       |
 2216|  54.3k|                            for (j = n; j < end; ++j, ++dp, col_mask <<= 4) {
  ------------------
  |  Branch (2216:41): [True: 42.1k, False: 12.2k]
  ------------------
 2217|  42.1k|                                OPJ_UINT32 sample_mask;
 2218|       |
 2219|  42.1k|                                if ((col_mask & mbr) == 0) { //no samples need checking
  ------------------
  |  Branch (2219:37): [True: 6.72k, False: 35.3k]
  ------------------
 2220|  6.72k|                                    continue;
 2221|  6.72k|                                }
 2222|       |
 2223|       |                                //scan mbr to find a new significant sample
 2224|  35.3k|                                sample_mask = 0x11111111u & col_mask; // LSB
 2225|  35.3k|                                if (mbr & sample_mask) {
  ------------------
  |  Branch (2225:37): [True: 21.0k, False: 14.3k]
  ------------------
 2226|  21.0k|                                    assert(dp[0] == 0); // the sample must have been 0
 2227|  21.0k|                                    if (cwd & 1) { //if this sample has become significant
  ------------------
  |  Branch (2227:41): [True: 6.14k, False: 14.9k]
  ------------------
 2228|       |                                        // must propagate it to nearby samples
 2229|  6.14k|                                        OPJ_UINT32 t;
 2230|  6.14k|                                        new_sig |= sample_mask;  // new significant samples
 2231|  6.14k|                                        t = 0x32u << (j * 4);// propagation to neighbors
 2232|  6.14k|                                        mbr |= t & inv_sig; //remove already significant samples
 2233|  6.14k|                                    }
 2234|  21.0k|                                    cwd >>= 1;
 2235|  21.0k|                                    ++cnt; //consume bit and increment number of
 2236|       |                                    //consumed bits
 2237|  21.0k|                                }
 2238|       |
 2239|  35.3k|                                sample_mask += sample_mask;  // next row
 2240|  35.3k|                                if (mbr & sample_mask) {
  ------------------
  |  Branch (2240:37): [True: 23.8k, False: 11.5k]
  ------------------
 2241|  23.8k|                                    assert(dp[stride] == 0);
 2242|  23.8k|                                    if (cwd & 1) {
  ------------------
  |  Branch (2242:41): [True: 5.77k, False: 18.0k]
  ------------------
 2243|  5.77k|                                        OPJ_UINT32 t;
 2244|  5.77k|                                        new_sig |= sample_mask;
 2245|  5.77k|                                        t = 0x74u << (j * 4);
 2246|  5.77k|                                        mbr |= t & inv_sig;
 2247|  5.77k|                                    }
 2248|  23.8k|                                    cwd >>= 1;
 2249|  23.8k|                                    ++cnt;
 2250|  23.8k|                                }
 2251|       |
 2252|  35.3k|                                sample_mask += sample_mask;
 2253|  35.3k|                                if (mbr & sample_mask) {
  ------------------
  |  Branch (2253:37): [True: 17.2k, False: 18.1k]
  ------------------
 2254|  17.2k|                                    assert(dp[2 * stride] == 0);
 2255|  17.2k|                                    if (cwd & 1) {
  ------------------
  |  Branch (2255:41): [True: 5.07k, False: 12.1k]
  ------------------
 2256|  5.07k|                                        OPJ_UINT32 t;
 2257|  5.07k|                                        new_sig |= sample_mask;
 2258|  5.07k|                                        t = 0xE8u << (j * 4);
 2259|  5.07k|                                        mbr |= t & inv_sig;
 2260|  5.07k|                                    }
 2261|  17.2k|                                    cwd >>= 1;
 2262|  17.2k|                                    ++cnt;
 2263|  17.2k|                                }
 2264|       |
 2265|  35.3k|                                sample_mask += sample_mask;
 2266|  35.3k|                                if (mbr & sample_mask) {
  ------------------
  |  Branch (2266:37): [True: 23.0k, False: 12.3k]
  ------------------
 2267|  23.0k|                                    assert(dp[3 * stride] == 0);
 2268|  23.0k|                                    if (cwd & 1) {
  ------------------
  |  Branch (2268:41): [True: 6.54k, False: 16.4k]
  ------------------
 2269|  6.54k|                                        OPJ_UINT32 t;
 2270|  6.54k|                                        new_sig |= sample_mask;
 2271|  6.54k|                                        t = 0xC0u << (j * 4);
 2272|  6.54k|                                        mbr |= t & inv_sig;
 2273|  6.54k|                                    }
 2274|  23.0k|                                    cwd >>= 1;
 2275|  23.0k|                                    ++cnt;
 2276|  23.0k|                                }
 2277|  35.3k|                            }
 2278|       |
 2279|       |                            //obtain signs here
 2280|  12.2k|                            if (new_sig & (0xFFFFu << (4 * n))) { //if any
  ------------------
  |  Branch (2280:33): [True: 4.97k, False: 7.31k]
  ------------------
 2281|  4.97k|                                OPJ_UINT32 col_mask;
 2282|  4.97k|                                OPJ_INT32 j;
 2283|  4.97k|                                OPJ_UINT32 *dp = decoded_data + (y - 8) * stride;
 2284|  4.97k|                                dp += i + n; // decoded samples address
 2285|  4.97k|                                col_mask = 0xFu << (4 * n); //mask to select a column
 2286|       |
 2287|  24.7k|                                for (j = n; j < end; ++j, ++dp, col_mask <<= 4) {
  ------------------
  |  Branch (2287:45): [True: 19.7k, False: 4.97k]
  ------------------
 2288|  19.7k|                                    OPJ_UINT32 sample_mask;
 2289|       |
 2290|  19.7k|                                    if ((col_mask & new_sig) == 0) { //if non is significant
  ------------------
  |  Branch (2290:41): [True: 6.73k, False: 13.0k]
  ------------------
 2291|  6.73k|                                        continue;
 2292|  6.73k|                                    }
 2293|       |
 2294|       |                                    //scan 4 signs
 2295|  13.0k|                                    sample_mask = 0x11111111u & col_mask;
 2296|  13.0k|                                    if (new_sig & sample_mask) {
  ------------------
  |  Branch (2296:41): [True: 6.14k, False: 6.88k]
  ------------------
 2297|  6.14k|                                        assert(dp[0] == 0);
 2298|  6.14k|                                        dp[0] |= ((cwd & 1) << 31) | val; //put value and sign
 2299|  6.14k|                                        cwd >>= 1;
 2300|  6.14k|                                        ++cnt; //consume bit and increment number
 2301|       |                                        //of consumed bits
 2302|  6.14k|                                    }
 2303|       |
 2304|  13.0k|                                    sample_mask += sample_mask;
 2305|  13.0k|                                    if (new_sig & sample_mask) {
  ------------------
  |  Branch (2305:41): [True: 5.77k, False: 7.25k]
  ------------------
 2306|  5.77k|                                        assert(dp[stride] == 0);
 2307|  5.77k|                                        dp[stride] |= ((cwd & 1) << 31) | val;
 2308|  5.77k|                                        cwd >>= 1;
 2309|  5.77k|                                        ++cnt;
 2310|  5.77k|                                    }
 2311|       |
 2312|  13.0k|                                    sample_mask += sample_mask;
 2313|  13.0k|                                    if (new_sig & sample_mask) {
  ------------------
  |  Branch (2313:41): [True: 5.07k, False: 7.95k]
  ------------------
 2314|  5.07k|                                        assert(dp[2 * stride] == 0);
 2315|  5.07k|                                        dp[2 * stride] |= ((cwd & 1) << 31) | val;
 2316|  5.07k|                                        cwd >>= 1;
 2317|  5.07k|                                        ++cnt;
 2318|  5.07k|                                    }
 2319|       |
 2320|  13.0k|                                    sample_mask += sample_mask;
 2321|  13.0k|                                    if (new_sig & sample_mask) {
  ------------------
  |  Branch (2321:41): [True: 6.54k, False: 6.48k]
  ------------------
 2322|  6.54k|                                        assert(dp[3 * stride] == 0);
 2323|  6.54k|                                        dp[3 * stride] |= ((cwd & 1) << 31) | val;
 2324|  6.54k|                                        cwd >>= 1;
 2325|  6.54k|                                        ++cnt;
 2326|  6.54k|                                    }
 2327|  13.0k|                                }
 2328|       |
 2329|  4.97k|                            }
 2330|  12.2k|                            frwd_advance(&sigprop, cnt); //consume the bits from bitstrm
 2331|  12.2k|                            cnt = 0;
 2332|       |
 2333|       |                            //update the next 8 columns
 2334|  12.2k|                            if (n == 4) {
  ------------------
  |  Branch (2334:33): [True: 6.14k, False: 6.14k]
  ------------------
 2335|       |                                //horizontally
 2336|  6.14k|                                OPJ_UINT32 t = new_sig >> 28;
 2337|  6.14k|                                t |= ((t & 0xE) >> 1) | ((t & 7) << 1);
 2338|  6.14k|                                cur_mbr[1] |= t & ~cur_sig[1];
 2339|  6.14k|                            }
 2340|  12.2k|                        }
 2341|  6.14k|                    }
 2342|       |                    //update the next stripe (vertically propagation)
 2343|  14.6k|                    new_sig |= cur_sig[0];
 2344|  14.6k|                    ux = (new_sig & 0x88888888) >> 3;
 2345|  14.6k|                    tx = ux | (ux << 4) | (ux >> 4); //left and right neighbors
 2346|  14.6k|                    if (i > 0) {
  ------------------
  |  Branch (2346:25): [True: 9.40k, False: 5.22k]
  ------------------
 2347|  9.40k|                        nxt_mbr[-1] |= (ux << 28) & ~nxt_sig[-1];
 2348|  9.40k|                    }
 2349|  14.6k|                    nxt_mbr[0] |= tx & ~nxt_sig[0];
 2350|  14.6k|                    nxt_mbr[1] |= (ux >> 28) & ~nxt_sig[1];
 2351|  14.6k|                }
 2352|       |
 2353|       |                //clear current sigma
 2354|       |                //mbr need not be cleared because it is overwritten
 2355|  5.22k|                cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2355:27): [True: 2.52k, False: 2.70k]
  ------------------
 2356|  5.22k|                memset(cur_sig, 0, ((((OPJ_UINT32)width + 7u) >> 3) + 1u) << 2);
 2357|  5.22k|            }
 2358|  5.66k|        }
 2359|  14.4k|    }
 2360|       |
 2361|       |    //terminating
 2362|    609|    if (num_passes > 1) {
  ------------------
  |  Branch (2362:9): [True: 499, False: 110]
  ------------------
 2363|    499|        OPJ_INT32 st, y;
 2364|       |
 2365|    499|        if (num_passes > 2 && ((height & 3) == 1 || (height & 3) == 2)) {
  ------------------
  |  Branch (2365:13): [True: 211, False: 288]
  |  Branch (2365:32): [True: 13, False: 198]
  |  Branch (2365:53): [True: 79, False: 119]
  ------------------
 2366|       |            //do magref
 2367|     92|            OPJ_UINT32 *cur_sig = height & 0x4 ? sigma2 : sigma1; //reversed
  ------------------
  |  Branch (2367:35): [True: 28, False: 64]
  ------------------
 2368|     92|            OPJ_UINT32 *dpp = decoded_data + (height & 0xFFFFFC) * stride;
 2369|     92|            OPJ_UINT32 half = 1u << (p - 2);
 2370|     92|            OPJ_INT32 i;
 2371|  2.79k|            for (i = 0; i < width; i += 8) {
  ------------------
  |  Branch (2371:25): [True: 2.69k, False: 92]
  ------------------
 2372|  2.69k|                OPJ_UINT32 cwd = rev_fetch_mrp(&magref);
 2373|  2.69k|                OPJ_UINT32 sig = *cur_sig++;
 2374|  2.69k|                OPJ_UINT32 col_mask = 0xF;
 2375|  2.69k|                OPJ_UINT32 *dp = dpp + i;
 2376|  2.69k|                if (sig) {
  ------------------
  |  Branch (2376:21): [True: 1.54k, False: 1.15k]
  ------------------
 2377|  1.54k|                    int j;
 2378|  13.9k|                    for (j = 0; j < 8; ++j, dp++) {
  ------------------
  |  Branch (2378:33): [True: 12.3k, False: 1.54k]
  ------------------
 2379|  12.3k|                        if (sig & col_mask) {
  ------------------
  |  Branch (2379:29): [True: 6.88k, False: 5.49k]
  ------------------
 2380|  6.88k|                            OPJ_UINT32 sample_mask = 0x11111111 & col_mask;
 2381|       |
 2382|  6.88k|                            if (sig & sample_mask) {
  ------------------
  |  Branch (2382:33): [True: 5.27k, False: 1.61k]
  ------------------
 2383|  5.27k|                                OPJ_UINT32 sym;
 2384|  5.27k|                                assert(dp[0] != 0);
 2385|  5.27k|                                sym = cwd & 1;
 2386|  5.27k|                                dp[0] ^= (1 - sym) << (p - 1);
 2387|  5.27k|                                dp[0] |= half;
 2388|  5.27k|                                cwd >>= 1;
 2389|  5.27k|                            }
 2390|  6.88k|                            sample_mask += sample_mask;
 2391|       |
 2392|  6.88k|                            if (sig & sample_mask) {
  ------------------
  |  Branch (2392:33): [True: 6.60k, False: 279]
  ------------------
 2393|  6.60k|                                OPJ_UINT32 sym;
 2394|  6.60k|                                assert(dp[stride] != 0);
 2395|  6.60k|                                sym = cwd & 1;
 2396|  6.60k|                                dp[stride] ^= (1 - sym) << (p - 1);
 2397|  6.60k|                                dp[stride] |= half;
 2398|  6.60k|                                cwd >>= 1;
 2399|  6.60k|                            }
 2400|  6.88k|                            sample_mask += sample_mask;
 2401|       |
 2402|  6.88k|                            if (sig & sample_mask) {
  ------------------
  |  Branch (2402:33): [True: 0, False: 6.88k]
  ------------------
 2403|      0|                                OPJ_UINT32 sym;
 2404|      0|                                assert(dp[2 * stride] != 0);
 2405|      0|                                sym = cwd & 1;
 2406|      0|                                dp[2 * stride] ^= (1 - sym) << (p - 1);
 2407|      0|                                dp[2 * stride] |= half;
 2408|      0|                                cwd >>= 1;
 2409|      0|                            }
 2410|  6.88k|                            sample_mask += sample_mask;
 2411|       |
 2412|  6.88k|                            if (sig & sample_mask) {
  ------------------
  |  Branch (2412:33): [True: 0, False: 6.88k]
  ------------------
 2413|      0|                                OPJ_UINT32 sym;
 2414|      0|                                assert(dp[3 * stride] != 0);
 2415|      0|                                sym = cwd & 1;
 2416|      0|                                dp[3 * stride] ^= (1 - sym) << (p - 1);
 2417|      0|                                dp[3 * stride] |= half;
 2418|      0|                                cwd >>= 1;
 2419|      0|                            }
 2420|  6.88k|                            sample_mask += sample_mask;
 2421|  6.88k|                        }
 2422|  12.3k|                        col_mask <<= 4;
 2423|  12.3k|                    }
 2424|  1.54k|                }
 2425|  2.69k|                rev_advance_mrp(&magref, population_count(sig));
 2426|  2.69k|            }
 2427|     92|        }
 2428|       |
 2429|       |        //do the last incomplete stripe
 2430|       |        // for cases of (height & 3) == 0 and 3
 2431|       |        // the should have been processed previously
 2432|    499|        if ((height & 3) == 1 || (height & 3) == 2) {
  ------------------
  |  Branch (2432:13): [True: 113, False: 386]
  |  Branch (2432:34): [True: 165, False: 221]
  ------------------
 2433|       |            //generate mbr of first stripe
 2434|    278|            OPJ_UINT32 *sig = height & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2434:31): [True: 115, False: 163]
  ------------------
 2435|    278|            OPJ_UINT32 *mbr = height & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2435:31): [True: 115, False: 163]
  ------------------
 2436|       |            //integrate horizontally
 2437|    278|            OPJ_UINT32 prev = 0;
 2438|    278|            OPJ_INT32 i;
 2439|  4.55k|            for (i = 0; i < width; i += 8, mbr++, sig++) {
  ------------------
  |  Branch (2439:25): [True: 4.27k, False: 278]
  ------------------
 2440|  4.27k|                OPJ_UINT32 t, z;
 2441|       |
 2442|  4.27k|                mbr[0] = sig[0];
 2443|  4.27k|                mbr[0] |= prev >> 28;    //for first column, left neighbors
 2444|  4.27k|                mbr[0] |= sig[0] << 4;   //left neighbors
 2445|  4.27k|                mbr[0] |= sig[0] >> 4;   //left neighbors
 2446|  4.27k|                mbr[0] |= sig[1] << 28;  //for last column, right neighbors
 2447|  4.27k|                prev = sig[0];
 2448|       |
 2449|       |                //integrate vertically
 2450|  4.27k|                t = mbr[0], z = mbr[0];
 2451|  4.27k|                z |= (t & 0x77777777) << 1; //above neighbors
 2452|  4.27k|                z |= (t & 0xEEEEEEEE) >> 1; //below neighbors
 2453|  4.27k|                mbr[0] = z & ~sig[0]; //remove already significance samples
 2454|  4.27k|            }
 2455|    278|        }
 2456|       |
 2457|    499|        st = height;
 2458|    499|        st -= height > 6 ? (((height + 1) & 3) + 3) : height;
  ------------------
  |  Branch (2458:15): [True: 201, False: 298]
  ------------------
 2459|  1.16k|        for (y = st; y < height; y += 4) {
  ------------------
  |  Branch (2459:22): [True: 666, False: 499]
  ------------------
 2460|    666|            OPJ_UINT32 *cur_sig, *cur_mbr, *nxt_sig, *nxt_mbr;
 2461|    666|            OPJ_UINT32 val;
 2462|    666|            OPJ_INT32 i;
 2463|       |
 2464|    666|            OPJ_UINT32 pattern = 0xFFFFFFFFu; // a pattern needed samples
 2465|    666|            if (height - y == 3) {
  ------------------
  |  Branch (2465:17): [True: 33, False: 633]
  ------------------
 2466|     33|                pattern = 0x77777777u;
 2467|    633|            } else if (height - y == 2) {
  ------------------
  |  Branch (2467:24): [True: 165, False: 468]
  ------------------
 2468|    165|                pattern = 0x33333333u;
 2469|    468|            } else if (height - y == 1) {
  ------------------
  |  Branch (2469:24): [True: 113, False: 355]
  ------------------
 2470|    113|                pattern = 0x11111111u;
 2471|    113|            }
 2472|       |
 2473|       |            //add membership from the next stripe, obtained above
 2474|    666|            if (height - y > 4) {
  ------------------
  |  Branch (2474:17): [True: 167, False: 499]
  ------------------
 2475|    167|                OPJ_UINT32 prev = 0;
 2476|    167|                OPJ_INT32 i;
 2477|    167|                cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2477:27): [True: 52, False: 115]
  ------------------
 2478|    167|                cur_mbr = y & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2478:27): [True: 52, False: 115]
  ------------------
 2479|    167|                nxt_sig = y & 0x4 ? sigma1 : sigma2;
  ------------------
  |  Branch (2479:27): [True: 52, False: 115]
  ------------------
 2480|    842|                for (i = 0; i < width; i += 8, cur_mbr++, cur_sig++, nxt_sig++) {
  ------------------
  |  Branch (2480:29): [True: 675, False: 167]
  ------------------
 2481|    675|                    OPJ_UINT32 t = nxt_sig[0];
 2482|    675|                    t |= prev >> 28;     //for first column, left neighbors
 2483|    675|                    t |= nxt_sig[0] << 4;   //left neighbors
 2484|    675|                    t |= nxt_sig[0] >> 4;   //left neighbors
 2485|    675|                    t |= nxt_sig[1] << 28;  //for last column, right neighbors
 2486|    675|                    prev = nxt_sig[0];
 2487|       |
 2488|    675|                    if (!stripe_causal) {
  ------------------
  |  Branch (2488:25): [True: 326, False: 349]
  ------------------
 2489|    326|                        cur_mbr[0] |= (t & 0x11111111u) << 3;
 2490|    326|                    }
 2491|       |                    //remove already significance samples
 2492|    675|                    cur_mbr[0] &= ~cur_sig[0];
 2493|    675|                }
 2494|    167|            }
 2495|       |
 2496|       |            //find new locations and get signs
 2497|    666|            cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2497:23): [True: 269, False: 397]
  ------------------
 2498|    666|            cur_mbr = y & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2498:23): [True: 269, False: 397]
  ------------------
 2499|    666|            nxt_sig = y & 0x4 ? sigma1 : sigma2;
  ------------------
  |  Branch (2499:23): [True: 269, False: 397]
  ------------------
 2500|    666|            nxt_mbr = y & 0x4 ? mbr1 : mbr2;
  ------------------
  |  Branch (2500:23): [True: 269, False: 397]
  ------------------
 2501|    666|            val = 3u << (p - 2);
 2502|  7.48k|            for (i = 0; i < width; i += 8,
  ------------------
  |  Branch (2502:25): [True: 6.81k, False: 666]
  ------------------
 2503|  6.81k|                    cur_sig++, cur_mbr++, nxt_sig++, nxt_mbr++) {
 2504|  6.81k|                OPJ_UINT32 mbr = *cur_mbr & pattern; //skip unneeded samples
 2505|  6.81k|                OPJ_UINT32 new_sig = 0;
 2506|  6.81k|                OPJ_UINT32 ux, tx;
 2507|  6.81k|                if (mbr) {
  ------------------
  |  Branch (2507:21): [True: 3.13k, False: 3.68k]
  ------------------
 2508|  3.13k|                    OPJ_INT32 n;
 2509|  9.39k|                    for (n = 0; n < 8; n += 4) {
  ------------------
  |  Branch (2509:33): [True: 6.26k, False: 3.13k]
  ------------------
 2510|  6.26k|                        OPJ_UINT32 col_mask;
 2511|  6.26k|                        OPJ_UINT32 inv_sig;
 2512|  6.26k|                        OPJ_INT32 end;
 2513|  6.26k|                        OPJ_INT32 j;
 2514|       |
 2515|  6.26k|                        OPJ_UINT32 cwd = frwd_fetch(&sigprop);
 2516|  6.26k|                        OPJ_UINT32 cnt = 0;
 2517|       |
 2518|  6.26k|                        OPJ_UINT32 *dp = decoded_data + y * stride;
 2519|  6.26k|                        dp += i + n;
 2520|       |
 2521|  6.26k|                        col_mask = 0xFu << (4 * n);
 2522|       |
 2523|  6.26k|                        inv_sig = ~cur_sig[0] & pattern;
 2524|       |
 2525|  6.26k|                        end = n + 4 + i < width ? n + 4 : width - i;
  ------------------
  |  Branch (2525:31): [True: 5.83k, False: 435]
  ------------------
 2526|  30.3k|                        for (j = n; j < end; ++j, ++dp, col_mask <<= 4) {
  ------------------
  |  Branch (2526:37): [True: 24.0k, False: 6.26k]
  ------------------
 2527|  24.0k|                            OPJ_UINT32 sample_mask;
 2528|       |
 2529|  24.0k|                            if ((col_mask & mbr) == 0) {
  ------------------
  |  Branch (2529:33): [True: 4.98k, False: 19.0k]
  ------------------
 2530|  4.98k|                                continue;
 2531|  4.98k|                            }
 2532|       |
 2533|       |                            //scan 4 mbr
 2534|  19.0k|                            sample_mask = 0x11111111u & col_mask;
 2535|  19.0k|                            if (mbr & sample_mask) {
  ------------------
  |  Branch (2535:33): [True: 14.6k, False: 4.38k]
  ------------------
 2536|  14.6k|                                assert(dp[0] == 0);
 2537|  14.6k|                                if (cwd & 1) {
  ------------------
  |  Branch (2537:37): [True: 3.87k, False: 10.8k]
  ------------------
 2538|  3.87k|                                    OPJ_UINT32 t;
 2539|  3.87k|                                    new_sig |= sample_mask;
 2540|  3.87k|                                    t = 0x32u << (j * 4);
 2541|  3.87k|                                    mbr |= t & inv_sig;
 2542|  3.87k|                                }
 2543|  14.6k|                                cwd >>= 1;
 2544|  14.6k|                                ++cnt;
 2545|  14.6k|                            }
 2546|       |
 2547|  19.0k|                            sample_mask += sample_mask;
 2548|  19.0k|                            if (mbr & sample_mask) {
  ------------------
  |  Branch (2548:33): [True: 11.3k, False: 7.69k]
  ------------------
 2549|  11.3k|                                assert(dp[stride] == 0);
 2550|  11.3k|                                if (cwd & 1) {
  ------------------
  |  Branch (2550:37): [True: 3.04k, False: 8.34k]
  ------------------
 2551|  3.04k|                                    OPJ_UINT32 t;
 2552|  3.04k|                                    new_sig |= sample_mask;
 2553|  3.04k|                                    t = 0x74u << (j * 4);
 2554|  3.04k|                                    mbr |= t & inv_sig;
 2555|  3.04k|                                }
 2556|  11.3k|                                cwd >>= 1;
 2557|  11.3k|                                ++cnt;
 2558|  11.3k|                            }
 2559|       |
 2560|  19.0k|                            sample_mask += sample_mask;
 2561|  19.0k|                            if (mbr & sample_mask) {
  ------------------
  |  Branch (2561:33): [True: 7.82k, False: 11.2k]
  ------------------
 2562|  7.82k|                                assert(dp[2 * stride] == 0);
 2563|  7.82k|                                if (cwd & 1) {
  ------------------
  |  Branch (2563:37): [True: 1.80k, False: 6.02k]
  ------------------
 2564|  1.80k|                                    OPJ_UINT32 t;
 2565|  1.80k|                                    new_sig |= sample_mask;
 2566|  1.80k|                                    t = 0xE8u << (j * 4);
 2567|  1.80k|                                    mbr |= t & inv_sig;
 2568|  1.80k|                                }
 2569|  7.82k|                                cwd >>= 1;
 2570|  7.82k|                                ++cnt;
 2571|  7.82k|                            }
 2572|       |
 2573|  19.0k|                            sample_mask += sample_mask;
 2574|  19.0k|                            if (mbr & sample_mask) {
  ------------------
  |  Branch (2574:33): [True: 3.19k, False: 15.8k]
  ------------------
 2575|  3.19k|                                assert(dp[3 * stride] == 0);
 2576|  3.19k|                                if (cwd & 1) {
  ------------------
  |  Branch (2576:37): [True: 1.17k, False: 2.02k]
  ------------------
 2577|  1.17k|                                    OPJ_UINT32 t;
 2578|  1.17k|                                    new_sig |= sample_mask;
 2579|  1.17k|                                    t = 0xC0u << (j * 4);
 2580|  1.17k|                                    mbr |= t & inv_sig;
 2581|  1.17k|                                }
 2582|  3.19k|                                cwd >>= 1;
 2583|  3.19k|                                ++cnt;
 2584|  3.19k|                            }
 2585|  19.0k|                        }
 2586|       |
 2587|       |                        //signs here
 2588|  6.26k|                        if (new_sig & (0xFFFFu << (4 * n))) {
  ------------------
  |  Branch (2588:29): [True: 2.64k, False: 3.62k]
  ------------------
 2589|  2.64k|                            OPJ_UINT32 col_mask;
 2590|  2.64k|                            OPJ_INT32 j;
 2591|  2.64k|                            OPJ_UINT32 *dp = decoded_data + y * stride;
 2592|  2.64k|                            dp += i + n;
 2593|  2.64k|                            col_mask = 0xFu << (4 * n);
 2594|       |
 2595|  13.1k|                            for (j = n; j < end; ++j, ++dp, col_mask <<= 4) {
  ------------------
  |  Branch (2595:41): [True: 10.5k, False: 2.64k]
  ------------------
 2596|  10.5k|                                OPJ_UINT32 sample_mask;
 2597|  10.5k|                                if ((col_mask & new_sig) == 0) {
  ------------------
  |  Branch (2597:37): [True: 4.13k, False: 6.37k]
  ------------------
 2598|  4.13k|                                    continue;
 2599|  4.13k|                                }
 2600|       |
 2601|       |                                //scan 4 signs
 2602|  6.37k|                                sample_mask = 0x11111111u & col_mask;
 2603|  6.37k|                                if (new_sig & sample_mask) {
  ------------------
  |  Branch (2603:37): [True: 3.87k, False: 2.50k]
  ------------------
 2604|  3.87k|                                    assert(dp[0] == 0);
 2605|  3.87k|                                    dp[0] |= ((cwd & 1) << 31) | val;
 2606|  3.87k|                                    cwd >>= 1;
 2607|  3.87k|                                    ++cnt;
 2608|  3.87k|                                }
 2609|       |
 2610|  6.37k|                                sample_mask += sample_mask;
 2611|  6.37k|                                if (new_sig & sample_mask) {
  ------------------
  |  Branch (2611:37): [True: 3.04k, False: 3.33k]
  ------------------
 2612|  3.04k|                                    assert(dp[stride] == 0);
 2613|  3.04k|                                    dp[stride] |= ((cwd & 1) << 31) | val;
 2614|  3.04k|                                    cwd >>= 1;
 2615|  3.04k|                                    ++cnt;
 2616|  3.04k|                                }
 2617|       |
 2618|  6.37k|                                sample_mask += sample_mask;
 2619|  6.37k|                                if (new_sig & sample_mask) {
  ------------------
  |  Branch (2619:37): [True: 1.80k, False: 4.57k]
  ------------------
 2620|  1.80k|                                    assert(dp[2 * stride] == 0);
 2621|  1.80k|                                    dp[2 * stride] |= ((cwd & 1) << 31) | val;
 2622|  1.80k|                                    cwd >>= 1;
 2623|  1.80k|                                    ++cnt;
 2624|  1.80k|                                }
 2625|       |
 2626|  6.37k|                                sample_mask += sample_mask;
 2627|  6.37k|                                if (new_sig & sample_mask) {
  ------------------
  |  Branch (2627:37): [True: 1.17k, False: 5.20k]
  ------------------
 2628|  1.17k|                                    assert(dp[3 * stride] == 0);
 2629|  1.17k|                                    dp[3 * stride] |= ((cwd & 1) << 31) | val;
 2630|  1.17k|                                    cwd >>= 1;
 2631|  1.17k|                                    ++cnt;
 2632|  1.17k|                                }
 2633|  6.37k|                            }
 2634|       |
 2635|  2.64k|                        }
 2636|  6.26k|                        frwd_advance(&sigprop, cnt);
 2637|  6.26k|                        cnt = 0;
 2638|       |
 2639|       |                        //update next columns
 2640|  6.26k|                        if (n == 4) {
  ------------------
  |  Branch (2640:29): [True: 3.13k, False: 3.13k]
  ------------------
 2641|       |                            //horizontally
 2642|  3.13k|                            OPJ_UINT32 t = new_sig >> 28;
 2643|  3.13k|                            t |= ((t & 0xE) >> 1) | ((t & 7) << 1);
 2644|  3.13k|                            cur_mbr[1] |= t & ~cur_sig[1];
 2645|  3.13k|                        }
 2646|  6.26k|                    }
 2647|  3.13k|                }
 2648|       |                //propagate down (vertically propagation)
 2649|  6.81k|                new_sig |= cur_sig[0];
 2650|  6.81k|                ux = (new_sig & 0x88888888) >> 3;
 2651|  6.81k|                tx = ux | (ux << 4) | (ux >> 4);
 2652|  6.81k|                if (i > 0) {
  ------------------
  |  Branch (2652:21): [True: 6.15k, False: 666]
  ------------------
 2653|  6.15k|                    nxt_mbr[-1] |= (ux << 28) & ~nxt_sig[-1];
 2654|  6.15k|                }
 2655|  6.81k|                nxt_mbr[0] |= tx & ~nxt_sig[0];
 2656|  6.81k|                nxt_mbr[1] |= (ux >> 28) & ~nxt_sig[1];
 2657|  6.81k|            }
 2658|    666|        }
 2659|    499|    }
 2660|       |
 2661|    609|    {
 2662|    609|        OPJ_INT32 x, y;
 2663|  28.2k|        for (y = 0; y < height; ++y) {
  ------------------
  |  Branch (2663:21): [True: 27.6k, False: 609]
  ------------------
 2664|  27.6k|            OPJ_INT32* sp = (OPJ_INT32*)decoded_data + y * stride;
 2665|   667k|            for (x = 0; x < width; ++x, ++sp) {
  ------------------
  |  Branch (2665:25): [True: 640k, False: 27.6k]
  ------------------
 2666|   640k|                OPJ_INT32 val = (*sp & 0x7FFFFFFF);
 2667|   640k|                *sp = ((OPJ_UINT32) * sp & 0x80000000) ? -val : val;
  ------------------
  |  Branch (2667:23): [True: 55.5k, False: 584k]
  ------------------
 2668|   640k|            }
 2669|  27.6k|        }
 2670|    609|    }
 2671|       |
 2672|    609|    return OPJ_TRUE;
  ------------------
  |  |  117|    609|#define OPJ_TRUE 1
  ------------------
 2673|    703|}
ht_dec.c:opj_t1_allocate_buffers:
 1030|  29.5k|{
 1031|  29.5k|    OPJ_UINT32 flagssize;
 1032|       |
 1033|       |    /* No risk of overflow. Prior checks ensure those assert are met */
 1034|       |    /* They are per the specification */
 1035|  29.5k|    assert(w <= 1024);
 1036|  29.5k|    assert(h <= 1024);
 1037|  29.5k|    assert(w * h <= 4096);
 1038|       |
 1039|       |    /* encoder uses tile buffer, so no need to allocate */
 1040|  29.5k|    {
 1041|  29.5k|        OPJ_UINT32 datasize = w * h;
 1042|       |
 1043|  29.5k|        if (datasize > t1->datasize) {
  ------------------
  |  Branch (1043:13): [True: 1.79k, False: 27.7k]
  ------------------
 1044|  1.79k|            opj_aligned_free(t1->data);
 1045|  1.79k|            t1->data = (OPJ_INT32*)
 1046|  1.79k|                       opj_aligned_malloc(datasize * sizeof(OPJ_INT32));
 1047|  1.79k|            if (!t1->data) {
  ------------------
  |  Branch (1047:17): [True: 0, False: 1.79k]
  ------------------
 1048|       |                /* FIXME event manager error callback */
 1049|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1050|      0|            }
 1051|  1.79k|            t1->datasize = datasize;
 1052|  1.79k|        }
 1053|       |        /* memset first arg is declared to never be null by gcc */
 1054|  29.5k|        if (t1->data != NULL) {
  ------------------
  |  Branch (1054:13): [True: 29.1k, False: 404]
  ------------------
 1055|  29.1k|            memset(t1->data, 0, datasize * sizeof(OPJ_INT32));
 1056|  29.1k|        }
 1057|  29.5k|    }
 1058|       |
 1059|       |    // We expand these buffers to multiples of 16 bytes.
 1060|       |    // We need 4 buffers of 129 integers each, expanded to 132 integers each
 1061|       |    // We also need 514 bytes of buffer, expanded to 528 bytes
 1062|      0|    flagssize = 132U * sizeof(OPJ_UINT32) * 4U; // expanded to multiple of 16
 1063|  29.5k|    flagssize += 528U; // 514 expanded to multiples of 16
 1064|       |
 1065|  29.5k|    {
 1066|  29.5k|        if (flagssize > t1->flagssize) {
  ------------------
  |  Branch (1066:13): [True: 680, False: 28.8k]
  ------------------
 1067|       |
 1068|    680|            opj_aligned_free(t1->flags);
 1069|    680|            t1->flags = (opj_flag_t*) opj_aligned_malloc(flagssize * sizeof(opj_flag_t));
 1070|    680|            if (!t1->flags) {
  ------------------
  |  Branch (1070:17): [True: 0, False: 680]
  ------------------
 1071|       |                /* FIXME event manager error callback */
 1072|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1073|      0|            }
 1074|    680|        }
 1075|  29.5k|        t1->flagssize = flagssize;
 1076|       |
 1077|  29.5k|        memset(t1->flags, 0, flagssize * sizeof(opj_flag_t));
 1078|  29.5k|    }
 1079|       |
 1080|      0|    t1->w = w;
 1081|  29.5k|    t1->h = h;
 1082|       |
 1083|  29.5k|    return OPJ_TRUE;
  ------------------
  |  |  117|  29.5k|#define OPJ_TRUE 1
  ------------------
 1084|  29.5k|}
ht_dec.c:mel_init:
  298|    794|{
  299|    794|    int num;
  300|    794|    int i;
  301|       |
  302|    794|    melp->data = bbuf + lcup - scup; // move the pointer to the start of MEL
  303|    794|    melp->bits = 0;                  // 0 bits in tmp
  304|    794|    melp->tmp = 0;                   //
  305|    794|    melp->unstuff = OPJ_FALSE;       // no unstuffing
  ------------------
  |  |  118|    794|#define OPJ_FALSE 0
  ------------------
  306|    794|    melp->size = scup - 1;           // size is the length of MEL+VLC-1
  307|    794|    melp->k = 0;                     // 0 for state
  308|    794|    melp->num_runs = 0;              // num_runs is 0
  309|    794|    melp->runs = 0;                  //
  310|       |
  311|       |    //This code is borrowed; original is for a different architecture
  312|       |    //These few lines take care of the case where data is not at a multiple
  313|       |    // of 4 boundary.  It reads 1,2,3 up to 4 bytes from the MEL segment
  314|    794|    num = 4 - (int)((intptr_t)(melp->data) & 0x3);
  315|  2.92k|    for (i = 0; i < num; ++i) { // this code is similar to mel_read
  ------------------
  |  Branch (315:17): [True: 2.13k, False: 791]
  ------------------
  316|  2.13k|        OPJ_UINT64 d;
  317|  2.13k|        int d_bits;
  318|       |
  319|  2.13k|        if (melp->unstuff == OPJ_TRUE && melp->data[0] > 0x8F) {
  ------------------
  |  |  117|  4.26k|#define OPJ_TRUE 1
  ------------------
  |  Branch (319:13): [True: 206, False: 1.92k]
  |  Branch (319:42): [True: 3, False: 203]
  ------------------
  320|      3|            return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
  321|      3|        }
  322|  2.12k|        d = (melp->size > 0) ? *melp->data : 0xFF; // if buffer is consumed
  ------------------
  |  Branch (322:13): [True: 1.77k, False: 358]
  ------------------
  323|       |        // set data to 0xFF
  324|  2.12k|        if (melp->size == 1) {
  ------------------
  |  Branch (324:13): [True: 230, False: 1.89k]
  ------------------
  325|    230|            d |= 0xF;    //if this is MEL+VLC-1, set LSBs to 0xF
  326|    230|        }
  327|       |        // see the standard
  328|  2.12k|        melp->data += melp->size-- > 0; //increment if the end is not reached
  329|  2.12k|        d_bits = 8 - melp->unstuff; //if unstuffing is needed, reduce by 1
  330|  2.12k|        melp->tmp = (melp->tmp << d_bits) | d; //store bits in tmp
  331|  2.12k|        melp->bits += d_bits;  //increment tmp by number of bits
  332|  2.12k|        melp->unstuff = ((d & 0xFF) == 0xFF); //true of next byte needs
  333|       |        //unstuffing
  334|  2.12k|    }
  335|    791|    melp->tmp <<= (64 - melp->bits); //push all the way up so the first bit
  336|       |    // is the MSB
  337|    791|    return OPJ_TRUE;
  ------------------
  |  |  117|    791|#define OPJ_TRUE 1
  ------------------
  338|    794|}
ht_dec.c:rev_init:
  464|    791|{
  465|    791|    OPJ_UINT32 d;
  466|    791|    int num, tnum, i;
  467|       |
  468|       |    //first byte has only the upper 4 bits
  469|    791|    vlcp->data = data + lcup - 2;
  470|       |
  471|       |    //size can not be larger than this, in fact it should be smaller
  472|    791|    vlcp->size = scup - 2;
  473|       |
  474|    791|    d = *vlcp->data--;            // read one byte (this is a half byte)
  475|    791|    vlcp->tmp = d >> 4;           // both initialize and set
  476|    791|    vlcp->bits = 4 - ((vlcp->tmp & 7) == 7); //check standard
  477|    791|    vlcp->unstuff = (d | 0xF) > 0x8F; //this is useful for the next byte
  478|       |
  479|       |    //This code is designed for an architecture that read address should
  480|       |    // align to the read size (address multiple of 4 if read size is 4)
  481|       |    //These few lines take care of the case where data is not at a multiple
  482|       |    // of 4 boundary. It reads 1,2,3 up to 4 bytes from the VLC bitstream.
  483|       |    // To read 32 bits, read from (vlcp->data - 3)
  484|    791|    num = 1 + (int)((intptr_t)(vlcp->data) & 0x3);
  485|    791|    tnum = num < vlcp->size ? num : vlcp->size;
  ------------------
  |  Branch (485:12): [True: 516, False: 275]
  ------------------
  486|  2.17k|    for (i = 0; i < tnum; ++i) {
  ------------------
  |  Branch (486:17): [True: 1.38k, False: 791]
  ------------------
  487|  1.38k|        OPJ_UINT64 d;
  488|  1.38k|        OPJ_UINT32 d_bits;
  489|  1.38k|        d = *vlcp->data--;  // read one byte and move read pointer
  490|       |        //check if the last byte was >0x8F (unstuff == true) and this is 0x7F
  491|  1.38k|        d_bits = 8u - ((vlcp->unstuff && ((d & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (491:25): [True: 186, False: 1.19k]
  |  Branch (491:42): [True: 26, False: 160]
  ------------------
  492|  1.38k|        vlcp->tmp |= d << vlcp->bits; // move data to vlcp->tmp
  493|  1.38k|        vlcp->bits += d_bits;
  494|  1.38k|        vlcp->unstuff = d > 0x8F; // for next byte
  495|  1.38k|    }
  496|    791|    vlcp->size -= tnum;
  497|    791|    rev_read(vlcp);  // read another 32 buts
  498|    791|}
ht_dec.c:rev_read:
  396|  9.47k|{
  397|  9.47k|    OPJ_UINT32 val;
  398|  9.47k|    OPJ_UINT32 tmp;
  399|  9.47k|    OPJ_UINT32 bits;
  400|  9.47k|    OPJ_BOOL unstuff;
  401|       |
  402|       |    //process 4 bytes at a time
  403|  9.47k|    if (vlcp->bits > 32) { // if there are more than 32 bits in tmp, then
  ------------------
  |  Branch (403:9): [True: 56, False: 9.41k]
  ------------------
  404|     56|        return;    // reading 32 bits can overflow vlcp->tmp
  405|     56|    }
  406|  9.41k|    val = 0;
  407|       |    //the next line (the if statement) needs to be tested first
  408|  9.41k|    if (vlcp->size > 3) { // if there are more than 3 bytes left in VLC
  ------------------
  |  Branch (408:9): [True: 5.23k, False: 4.18k]
  ------------------
  409|       |        // (vlcp->data - 3) move pointer back to read 32 bits at once
  410|  5.23k|        val = read_le_uint32(vlcp->data - 3); // then read 32 bits
  411|  5.23k|        vlcp->data -= 4;                // move data pointer back by 4
  412|  5.23k|        vlcp->size -= 4;                // reduce available byte by 4
  413|  5.23k|    } else if (vlcp->size > 0) { // 4 or less
  ------------------
  |  Branch (413:16): [True: 301, False: 3.88k]
  ------------------
  414|    301|        int i = 24;
  415|    872|        while (vlcp->size > 0) {
  ------------------
  |  Branch (415:16): [True: 571, False: 301]
  ------------------
  416|    571|            OPJ_UINT32 v = *vlcp->data--; // read one byte at a time
  417|    571|            val |= (v << i);              // put byte in its correct location
  418|    571|            --vlcp->size;
  419|    571|            i -= 8;
  420|    571|        }
  421|    301|    }
  422|       |
  423|       |    //accumulate in tmp, number of bits in tmp are stored in bits
  424|  9.41k|    tmp = val >> 24;  //start with the MSB byte
  425|       |
  426|       |    // test unstuff (previous byte is >0x8F), and this byte is 0x7F
  427|  9.41k|    bits = 8u - ((vlcp->unstuff && (((val >> 24) & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (427:19): [True: 1.56k, False: 7.84k]
  |  Branch (427:36): [True: 484, False: 1.08k]
  ------------------
  428|  9.41k|    unstuff = (val >> 24) > 0x8F; //this is for the next byte
  429|       |
  430|  9.41k|    tmp |= ((val >> 16) & 0xFF) << bits; //process the next byte
  431|  9.41k|    bits += 8u - ((unstuff && (((val >> 16) & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (431:20): [True: 1.49k, False: 7.92k]
  |  Branch (431:31): [True: 482, False: 1.00k]
  ------------------
  432|  9.41k|    unstuff = ((val >> 16) & 0xFF) > 0x8F;
  433|       |
  434|  9.41k|    tmp |= ((val >> 8) & 0xFF) << bits;
  435|  9.41k|    bits += 8u - ((unstuff && (((val >> 8) & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (435:20): [True: 1.47k, False: 7.94k]
  |  Branch (435:31): [True: 499, False: 974]
  ------------------
  436|  9.41k|    unstuff = ((val >> 8) & 0xFF) > 0x8F;
  437|       |
  438|  9.41k|    tmp |= (val & 0xFF) << bits;
  439|  9.41k|    bits += 8u - ((unstuff && ((val & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (439:20): [True: 1.47k, False: 7.94k]
  |  Branch (439:31): [True: 469, False: 1.00k]
  ------------------
  440|  9.41k|    unstuff = (val & 0xFF) > 0x8F;
  441|       |
  442|       |    // now move the read and unstuffed bits into vlcp->tmp
  443|  9.41k|    vlcp->tmp |= (OPJ_UINT64)tmp << vlcp->bits;
  444|  9.41k|    vlcp->bits += bits;
  445|  9.41k|    vlcp->unstuff = unstuff; // this for the next read
  446|  9.41k|}
ht_dec.c:read_le_uint32:
  119|  13.2k|{
  120|       |#if defined(OPJ_BIG_ENDIAN)
  121|       |    const OPJ_UINT8* data = (const OPJ_UINT8*)dataIn;
  122|       |    return ((OPJ_UINT32)data[0]) | (OPJ_UINT32)(data[1] << 8) | (OPJ_UINT32)(
  123|       |               data[2] << 16) | (((
  124|       |                                      OPJ_UINT32)data[3]) <<
  125|       |                                 24U);
  126|       |#else
  127|  13.2k|    return *(OPJ_UINT32*)dataIn;
  128|  13.2k|#endif
  129|  13.2k|}
ht_dec.c:frwd_init:
  961|  1.39k|{
  962|  1.39k|    int num, i;
  963|       |
  964|  1.39k|    msp->data = data;
  965|  1.39k|    msp->tmp = 0;
  966|  1.39k|    msp->bits = 0;
  967|  1.39k|    msp->unstuff = OPJ_FALSE;
  ------------------
  |  |  118|  1.39k|#define OPJ_FALSE 0
  ------------------
  968|  1.39k|    msp->size = size;
  969|  1.39k|    msp->X = X;
  970|  1.39k|    assert(msp->X == 0 || msp->X == 0xFF);
  971|       |
  972|       |    //This code is designed for an architecture that read address should
  973|       |    // align to the read size (address multiple of 4 if read size is 4)
  974|       |    //These few lines take care of the case where data is not at a multiple
  975|       |    // of 4 boundary.  It reads 1,2,3 up to 4 bytes from the bitstream
  976|  1.39k|    num = 4 - (int)((intptr_t)(msp->data) & 0x3);
  977|  6.05k|    for (i = 0; i < num; ++i) {
  ------------------
  |  Branch (977:17): [True: 4.66k, False: 1.39k]
  ------------------
  978|  4.66k|        OPJ_UINT64 d;
  979|       |        //read a byte if the buffer is not exhausted, otherwise set it to X
  980|  4.66k|        d = msp->size-- > 0 ? *msp->data++ : msp->X;
  ------------------
  |  Branch (980:13): [True: 3.92k, False: 740]
  ------------------
  981|  4.66k|        msp->tmp |= (d << msp->bits);      // store data in msp->tmp
  982|  4.66k|        msp->bits += 8u - (msp->unstuff ? 1u : 0u); // number of bits added to msp->tmp
  ------------------
  |  Branch (982:28): [True: 771, False: 3.89k]
  ------------------
  983|  4.66k|        msp->unstuff = ((d & 0xFF) == 0xFF); // unstuffing for next byte
  984|  4.66k|    }
  985|  1.39k|    frwd_read(msp); // read 32 bits more
  986|  1.39k|}
ht_dec.c:frwd_read:
  901|  12.1k|{
  902|  12.1k|    OPJ_UINT32 val;
  903|  12.1k|    OPJ_UINT32 bits;
  904|  12.1k|    OPJ_UINT32 t;
  905|  12.1k|    OPJ_BOOL unstuff;
  906|       |
  907|  12.1k|    assert(msp->bits <= 32); // assert that there is a space for 32 bits
  908|       |
  909|  12.1k|    val = 0u;
  910|  12.1k|    if (msp->size > 3) {
  ------------------
  |  Branch (910:9): [True: 5.66k, False: 6.49k]
  ------------------
  911|  5.66k|        val = read_le_uint32(msp->data);  // read 32 bits
  912|  5.66k|        msp->data += 4;           // increment pointer
  913|  5.66k|        msp->size -= 4;           // reduce size
  914|  6.49k|    } else if (msp->size > 0) {
  ------------------
  |  Branch (914:16): [True: 487, False: 6.00k]
  ------------------
  915|    487|        int i = 0;
  916|    487|        val = msp->X != 0 ? 0xFFFFFFFFu : 0;
  ------------------
  |  Branch (916:15): [True: 231, False: 256]
  ------------------
  917|  1.51k|        while (msp->size > 0) {
  ------------------
  |  Branch (917:16): [True: 1.02k, False: 487]
  ------------------
  918|  1.02k|            OPJ_UINT32 v = *msp->data++;  // read one byte at a time
  919|  1.02k|            OPJ_UINT32 m = ~(0xFFu << i); // mask of location
  920|  1.02k|            val = (val & m) | (v << i);   // put one byte in its correct location
  921|  1.02k|            --msp->size;
  922|  1.02k|            i += 8;
  923|  1.02k|        }
  924|  6.00k|    } else {
  925|  6.00k|        val = msp->X != 0 ? 0xFFFFFFFFu : 0;
  ------------------
  |  Branch (925:15): [True: 4.37k, False: 1.62k]
  ------------------
  926|  6.00k|    }
  927|       |
  928|       |    // we accumulate in t and keep a count of the number of bits in bits
  929|  12.1k|    bits = 8u - (msp->unstuff ? 1u : 0u);
  ------------------
  |  Branch (929:18): [True: 5.15k, False: 6.99k]
  ------------------
  930|  12.1k|    t = val & 0xFF;
  931|  12.1k|    unstuff = ((val & 0xFF) == 0xFF);  // Do we need unstuffing next?
  932|       |
  933|  12.1k|    t |= ((val >> 8) & 0xFF) << bits;
  934|  12.1k|    bits += 8u - (unstuff ? 1u : 0u);
  ------------------
  |  Branch (934:19): [True: 5.27k, False: 6.87k]
  ------------------
  935|  12.1k|    unstuff = (((val >> 8) & 0xFF) == 0xFF);
  936|       |
  937|  12.1k|    t |= ((val >> 16) & 0xFF) << bits;
  938|  12.1k|    bits += 8u - (unstuff ? 1u : 0u);
  ------------------
  |  Branch (938:19): [True: 5.33k, False: 6.81k]
  ------------------
  939|  12.1k|    unstuff = (((val >> 16) & 0xFF) == 0xFF);
  940|       |
  941|  12.1k|    t |= ((val >> 24) & 0xFF) << bits;
  942|  12.1k|    bits += 8u - (unstuff ? 1u : 0u);
  ------------------
  |  Branch (942:19): [True: 5.22k, False: 6.92k]
  ------------------
  943|  12.1k|    msp->unstuff = (((val >> 24) & 0xFF) == 0xFF); // for next byte
  944|       |
  945|  12.1k|    msp->tmp |= ((OPJ_UINT64)t) << msp->bits;  // move data to msp->tmp
  946|  12.1k|    msp->bits += bits;
  947|  12.1k|}
ht_dec.c:rev_init_mrp:
  616|    290|{
  617|    290|    int num, i;
  618|       |
  619|    290|    mrp->data = data + lcup + len2 - 1;
  620|    290|    mrp->size = len2;
  621|    290|    mrp->unstuff = OPJ_TRUE;
  ------------------
  |  |  117|    290|#define OPJ_TRUE 1
  ------------------
  622|    290|    mrp->bits = 0;
  623|    290|    mrp->tmp = 0;
  624|       |
  625|       |    //This code is designed for an architecture that read address should
  626|       |    // align to the read size (address multiple of 4 if read size is 4)
  627|       |    //These few lines take care of the case where data is not at a multiple
  628|       |    // of 4 boundary.  It reads 1,2,3 up to 4 bytes from the MRP stream
  629|    290|    num = 1 + (int)((intptr_t)(mrp->data) & 0x3);
  630|  1.15k|    for (i = 0; i < num; ++i) {
  ------------------
  |  Branch (630:17): [True: 861, False: 290]
  ------------------
  631|    861|        OPJ_UINT64 d;
  632|    861|        OPJ_UINT32 d_bits;
  633|       |
  634|       |        //read a byte, 0 if no more data
  635|    861|        d = (mrp->size-- > 0) ? *mrp->data-- : 0;
  ------------------
  |  Branch (635:13): [True: 825, False: 36]
  ------------------
  636|       |        //check if unstuffing is needed
  637|    861|        d_bits = 8u - ((mrp->unstuff && ((d & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (637:25): [True: 540, False: 321]
  |  Branch (637:41): [True: 69, False: 471]
  ------------------
  638|    861|        mrp->tmp |= d << mrp->bits; // move data to vlcp->tmp
  639|    861|        mrp->bits += d_bits;
  640|    861|        mrp->unstuff = d > 0x8F; // for next byte
  641|    861|    }
  642|    290|    rev_read_mrp(mrp);
  643|    290|}
ht_dec.c:rev_read_mrp:
  547|  2.08k|{
  548|  2.08k|    OPJ_UINT32 val;
  549|  2.08k|    OPJ_UINT32 tmp;
  550|  2.08k|    OPJ_UINT32 bits;
  551|  2.08k|    OPJ_BOOL unstuff;
  552|       |
  553|       |    //process 4 bytes at a time
  554|  2.08k|    if (mrp->bits > 32) {
  ------------------
  |  Branch (554:9): [True: 0, False: 2.08k]
  ------------------
  555|      0|        return;
  556|      0|    }
  557|  2.08k|    val = 0;
  558|  2.08k|    if (mrp->size > 3) { // If there are 3 byte or more
  ------------------
  |  Branch (558:9): [True: 1.41k, False: 663]
  ------------------
  559|       |        // (mrp->data - 3) move pointer back to read 32 bits at once
  560|  1.41k|        val = read_le_uint32(mrp->data - 3); // read 32 bits
  561|  1.41k|        mrp->data -= 4;                      // move back pointer
  562|  1.41k|        mrp->size -= 4;                      // reduce count
  563|  1.41k|    } else if (mrp->size > 0) {
  ------------------
  |  Branch (563:16): [True: 43, False: 620]
  ------------------
  564|     43|        int i = 24;
  565|    117|        while (mrp->size > 0) {
  ------------------
  |  Branch (565:16): [True: 74, False: 43]
  ------------------
  566|     74|            OPJ_UINT32 v = *mrp->data--; // read one byte at a time
  567|     74|            val |= (v << i);             // put byte in its correct location
  568|     74|            --mrp->size;
  569|     74|            i -= 8;
  570|     74|        }
  571|     43|    }
  572|       |
  573|       |
  574|       |    //accumulate in tmp, and keep count in bits
  575|  2.08k|    tmp = val >> 24;
  576|       |
  577|       |    //test if the last byte > 0x8F (unstuff must be true) and this is 0x7F
  578|  2.08k|    bits = 8u - ((mrp->unstuff && (((val >> 24) & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (578:19): [True: 489, False: 1.59k]
  |  Branch (578:35): [True: 210, False: 279]
  ------------------
  579|  2.08k|    unstuff = (val >> 24) > 0x8F;
  580|       |
  581|       |    //process the next byte
  582|  2.08k|    tmp |= ((val >> 16) & 0xFF) << bits;
  583|  2.08k|    bits += 8u - ((unstuff && (((val >> 16) & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (583:20): [True: 503, False: 1.57k]
  |  Branch (583:31): [True: 211, False: 292]
  ------------------
  584|  2.08k|    unstuff = ((val >> 16) & 0xFF) > 0x8F;
  585|       |
  586|  2.08k|    tmp |= ((val >> 8) & 0xFF) << bits;
  587|  2.08k|    bits += 8u - ((unstuff && (((val >> 8) & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (587:20): [True: 464, False: 1.61k]
  |  Branch (587:31): [True: 195, False: 269]
  ------------------
  588|  2.08k|    unstuff = ((val >> 8) & 0xFF) > 0x8F;
  589|       |
  590|  2.08k|    tmp |= (val & 0xFF) << bits;
  591|  2.08k|    bits += 8u - ((unstuff && ((val & 0x7F) == 0x7F)) ? 1u : 0u);
  ------------------
  |  Branch (591:20): [True: 507, False: 1.57k]
  |  Branch (591:31): [True: 205, False: 302]
  ------------------
  592|  2.08k|    unstuff = (val & 0xFF) > 0x8F;
  593|       |
  594|  2.08k|    mrp->tmp |= (OPJ_UINT64)tmp << mrp->bits; // move data to mrp pointer
  595|  2.08k|    mrp->bits += bits;
  596|  2.08k|    mrp->unstuff = unstuff;                   // next byte
  597|  2.08k|}
ht_dec.c:mel_get_run:
  348|  38.7k|{
  349|  38.7k|    int t;
  350|  38.7k|    if (melp->num_runs == 0) { //if no runs, decode more bit from MEL segment
  ------------------
  |  Branch (350:9): [True: 5.75k, False: 32.9k]
  ------------------
  351|  5.75k|        mel_decode(melp);
  352|  5.75k|    }
  353|       |
  354|  38.7k|    t = melp->runs & 0x7F; //retrieve one run
  355|  38.7k|    melp->runs >>= 7;  // remove the retrieved run
  356|  38.7k|    melp->num_runs--;
  357|  38.7k|    return t; // return run
  358|  38.7k|}
ht_dec.c:mel_decode:
  248|  5.75k|{
  249|  5.75k|    static const int mel_exp[13] = { //MEL exponents
  250|  5.75k|        0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5
  251|  5.75k|    };
  252|       |
  253|  5.75k|    if (melp->bits < 6) { // if there are less than 6 bits in tmp
  ------------------
  |  Branch (253:9): [True: 1.41k, False: 4.34k]
  ------------------
  254|  1.41k|        mel_read(melp);    // then read from the MEL bitstream
  255|  1.41k|    }
  256|       |    // 6 bits is the largest decodable MEL cwd
  257|       |
  258|       |    //repeat so long that there is enough decodable bits in tmp,
  259|       |    // and the runs store is not full (num_runs < 8)
  260|  47.2k|    while (melp->bits >= 6 && melp->num_runs < 8) {
  ------------------
  |  Branch (260:12): [True: 45.7k, False: 1.52k]
  |  Branch (260:31): [True: 41.5k, False: 4.23k]
  ------------------
  261|  41.5k|        int eval = mel_exp[melp->k]; // number of bits associated with state
  262|  41.5k|        int run = 0;
  263|  41.5k|        if (melp->tmp & (1ull << 63)) { //The next bit to decode (stored in MSB)
  ------------------
  |  Branch (263:13): [True: 17.0k, False: 24.4k]
  ------------------
  264|       |            //one is found
  265|  17.0k|            run = 1 << eval;
  266|  17.0k|            run--; // consecutive runs of 0 events - 1
  267|  17.0k|            melp->k = melp->k + 1 < 12 ? melp->k + 1 : 12;//increment, max is 12
  ------------------
  |  Branch (267:23): [True: 12.5k, False: 4.49k]
  ------------------
  268|  17.0k|            melp->tmp <<= 1; // consume one bit from tmp
  269|  17.0k|            melp->bits -= 1;
  270|  17.0k|            run = run << 1; // a stretch of zeros not terminating in one
  271|  24.4k|        } else {
  272|       |            //0 is found
  273|  24.4k|            run = (int)(melp->tmp >> (63 - eval)) & ((1 << eval) - 1);
  274|  24.4k|            melp->k = melp->k - 1 > 0 ? melp->k - 1 : 0; //decrement, min is 0
  ------------------
  |  Branch (274:23): [True: 5.29k, False: 19.2k]
  ------------------
  275|  24.4k|            melp->tmp <<= eval + 1; //consume eval + 1 bits (max is 6)
  276|  24.4k|            melp->bits -= eval + 1;
  277|  24.4k|            run = (run << 1) + 1; // a stretch of zeros terminating with one
  278|  24.4k|        }
  279|  41.5k|        eval = melp->num_runs * 7;                 // 7 bits per run
  280|  41.5k|        melp->runs &= ~((OPJ_UINT64)0x3F << eval); // 6 bits are sufficient
  281|  41.5k|        melp->runs |= ((OPJ_UINT64)run) << eval;   // store the value in runs
  282|  41.5k|        melp->num_runs++;                          // increment count
  283|  41.5k|    }
  284|  5.75k|}
ht_dec.c:mel_read:
  166|  1.41k|{
  167|  1.41k|    OPJ_UINT32 val;
  168|  1.41k|    int bits;
  169|  1.41k|    OPJ_UINT32 t;
  170|  1.41k|    OPJ_BOOL unstuff;
  171|       |
  172|  1.41k|    if (melp->bits > 32) { //there are enough bits in the tmp variable
  ------------------
  |  Branch (172:9): [True: 0, False: 1.41k]
  ------------------
  173|      0|        return;    // return without reading new data
  174|      0|    }
  175|       |
  176|  1.41k|    val = 0xFFFFFFFF;      // feed in 0xFF if buffer is exhausted
  177|  1.41k|    if (melp->size > 4) {  // if there is more than 4 bytes the MEL segment
  ------------------
  |  Branch (177:9): [True: 950, False: 463]
  ------------------
  178|    950|        val = read_le_uint32(melp->data);  // read 32 bits from MEL data
  179|    950|        melp->data += 4;           // advance pointer
  180|    950|        melp->size -= 4;           // reduce counter
  181|    950|    } else if (melp->size > 0) { // 4 or less
  ------------------
  |  Branch (181:16): [True: 249, False: 214]
  ------------------
  182|    249|        OPJ_UINT32 m, v;
  183|    249|        int i = 0;
  184|    671|        while (melp->size > 1) {
  ------------------
  |  Branch (184:16): [True: 422, False: 249]
  ------------------
  185|    422|            OPJ_UINT32 v = *melp->data++; // read one byte at a time
  186|    422|            OPJ_UINT32 m = ~(0xFFu << i); // mask of location
  187|    422|            val = (val & m) | (v << i);   // put byte in its correct location
  188|    422|            --melp->size;
  189|    422|            i += 8;
  190|    422|        }
  191|       |        // size equal to 1
  192|    249|        v = *melp->data++;  // the one before the last is different
  193|    249|        v |= 0xF;                         // MEL and VLC segments can overlap
  194|    249|        m = ~(0xFFu << i);
  195|    249|        val = (val & m) | (v << i);
  196|    249|        --melp->size;
  197|    249|    }
  198|       |
  199|       |    // next we unstuff them before adding them to the buffer
  200|  1.41k|    bits = 32 - melp->unstuff;      // number of bits in val, subtract 1 if
  201|       |    // the previously read byte requires
  202|       |    // unstuffing
  203|       |
  204|       |    // data is unstuffed and accumulated in t
  205|       |    // bits has the number of bits in t
  206|  1.41k|    t = val & 0xFF;
  207|  1.41k|    unstuff = ((val & 0xFF) == 0xFF); // true if the byte needs unstuffing
  208|  1.41k|    bits -= unstuff; // there is one less bit in t if unstuffing is needed
  209|  1.41k|    t = t << (8 - unstuff); // move up to make room for the next byte
  210|       |
  211|       |    //this is a repeat of the above
  212|  1.41k|    t |= (val >> 8) & 0xFF;
  213|  1.41k|    unstuff = (((val >> 8) & 0xFF) == 0xFF);
  214|  1.41k|    bits -= unstuff;
  215|  1.41k|    t = t << (8 - unstuff);
  216|       |
  217|  1.41k|    t |= (val >> 16) & 0xFF;
  218|  1.41k|    unstuff = (((val >> 16) & 0xFF) == 0xFF);
  219|  1.41k|    bits -= unstuff;
  220|  1.41k|    t = t << (8 - unstuff);
  221|       |
  222|  1.41k|    t |= (val >> 24) & 0xFF;
  223|  1.41k|    melp->unstuff = (((val >> 24) & 0xFF) == 0xFF);
  224|       |
  225|       |    // move t to tmp, and push the result all the way up, so we read from
  226|       |    // the MSB
  227|  1.41k|    melp->tmp |= ((OPJ_UINT64)t) << (64 - bits - melp->bits);
  228|  1.41k|    melp->bits += bits; //increment the number of bits in tmp
  229|  1.41k|}
ht_dec.c:rev_fetch:
  509|  95.3k|{
  510|  95.3k|    if (vlcp->bits < 32) { // if there are less then 32 bits, read more
  ------------------
  |  Branch (510:9): [True: 8.68k, False: 86.6k]
  ------------------
  511|  8.68k|        rev_read(vlcp);     // read 32 bits, but unstuffing might reduce this
  512|  8.68k|        if (vlcp->bits < 32) { // if there is still space in vlcp->tmp for 32 bits
  ------------------
  |  Branch (512:13): [True: 0, False: 8.68k]
  ------------------
  513|      0|            rev_read(vlcp);    // read another 32
  514|      0|        }
  515|  8.68k|    }
  516|  95.3k|    return (OPJ_UINT32)vlcp->tmp; // return the head (bottom-most) of vlcp->tmp
  517|  95.3k|}
ht_dec.c:rev_advance:
  527|   283k|{
  528|   283k|    assert(num_bits <= vlcp->bits); // vlcp->tmp must have more than num_bits
  529|   283k|    vlcp->tmp >>= num_bits;         // remove bits
  530|   283k|    vlcp->bits -= num_bits;         // decrement the number of bits
  531|   283k|    return (OPJ_UINT32)vlcp->tmp;
  532|   283k|}
ht_dec.c:decode_init_uvlc:
  692|  16.4k|{
  693|       |    //table stores possible decoding three bits from vlc
  694|       |    // there are 8 entries for xx1, x10, 100, 000, where x means do not care
  695|       |    // table value is made up of
  696|       |    // 2 bits in the LSB for prefix length
  697|       |    // 3 bits for suffix length
  698|       |    // 3 bits in the MSB for prefix value (u_pfx in Table 3 of ITU T.814)
  699|  16.4k|    static const OPJ_UINT8 dec[8] = { // the index is the prefix codeword
  700|  16.4k|        3 | (5 << 2) | (5 << 5),        //000 == 000, prefix codeword "000"
  701|  16.4k|        1 | (0 << 2) | (1 << 5),        //001 == xx1, prefix codeword "1"
  702|  16.4k|        2 | (0 << 2) | (2 << 5),        //010 == x10, prefix codeword "01"
  703|  16.4k|        1 | (0 << 2) | (1 << 5),        //011 == xx1, prefix codeword "1"
  704|  16.4k|        3 | (1 << 2) | (3 << 5),        //100 == 100, prefix codeword "001"
  705|  16.4k|        1 | (0 << 2) | (1 << 5),        //101 == xx1, prefix codeword "1"
  706|  16.4k|        2 | (0 << 2) | (2 << 5),        //110 == x10, prefix codeword "01"
  707|  16.4k|        1 | (0 << 2) | (1 << 5)         //111 == xx1, prefix codeword "1"
  708|  16.4k|    };
  709|       |
  710|  16.4k|    OPJ_UINT32 consumed_bits = 0;
  711|  16.4k|    if (mode == 0) { // both u_off are 0
  ------------------
  |  Branch (711:9): [True: 12.3k, False: 4.14k]
  ------------------
  712|  12.3k|        u[0] = u[1] = 1; //Kappa is 1 for initial line
  713|  12.3k|    } else if (mode <= 2) { // u_off are either 01 or 10
  ------------------
  |  Branch (713:16): [True: 942, False: 3.20k]
  ------------------
  714|    942|        OPJ_UINT32 d;
  715|    942|        OPJ_UINT32 suffix_len;
  716|       |
  717|    942|        d = dec[vlc & 0x7];   //look at the least significant 3 bits
  718|    942|        vlc >>= d & 0x3;                 //prefix length
  719|    942|        consumed_bits += d & 0x3;
  720|       |
  721|    942|        suffix_len = ((d >> 2) & 0x7);
  722|    942|        consumed_bits += suffix_len;
  723|       |
  724|    942|        d = (d >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  725|    942|        u[0] = (mode == 1) ? d + 1 : 1; // kappa is 1 for initial line
  ------------------
  |  Branch (725:16): [True: 392, False: 550]
  ------------------
  726|    942|        u[1] = (mode == 1) ? 1 : d + 1; // kappa is 1 for initial line
  ------------------
  |  Branch (726:16): [True: 392, False: 550]
  ------------------
  727|  3.20k|    } else if (mode == 3) { // both u_off are 1, and MEL event is 0
  ------------------
  |  Branch (727:16): [True: 2.01k, False: 1.18k]
  ------------------
  728|  2.01k|        OPJ_UINT32 d1 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  729|  2.01k|        vlc >>= d1 & 0x3;                // Consume bits
  730|  2.01k|        consumed_bits += d1 & 0x3;
  731|       |
  732|  2.01k|        if ((d1 & 0x3) > 2) {
  ------------------
  |  Branch (732:13): [True: 1.48k, False: 530]
  ------------------
  733|  1.48k|            OPJ_UINT32 suffix_len;
  734|       |
  735|       |            //u_{q_2} prefix
  736|  1.48k|            u[1] = (vlc & 1) + 1 + 1; //Kappa is 1 for initial line
  737|  1.48k|            ++consumed_bits;
  738|  1.48k|            vlc >>= 1;
  739|       |
  740|  1.48k|            suffix_len = ((d1 >> 2) & 0x7);
  741|  1.48k|            consumed_bits += suffix_len;
  742|  1.48k|            d1 = (d1 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  743|  1.48k|            u[0] = d1 + 1; //Kappa is 1 for initial line
  744|  1.48k|        } else {
  745|    530|            OPJ_UINT32 d2;
  746|    530|            OPJ_UINT32 suffix_len;
  747|       |
  748|    530|            d2 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  749|    530|            vlc >>= d2 & 0x3;                // Consume bits
  750|    530|            consumed_bits += d2 & 0x3;
  751|       |
  752|    530|            suffix_len = ((d1 >> 2) & 0x7);
  753|    530|            consumed_bits += suffix_len;
  754|       |
  755|    530|            d1 = (d1 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  756|    530|            u[0] = d1 + 1; //Kappa is 1 for initial line
  757|    530|            vlc >>= suffix_len;
  758|       |
  759|    530|            suffix_len = ((d2 >> 2) & 0x7);
  760|    530|            consumed_bits += suffix_len;
  761|       |
  762|    530|            d2 = (d2 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  763|    530|            u[1] = d2 + 1; //Kappa is 1 for initial line
  764|    530|        }
  765|  2.01k|    } else if (mode == 4) { // both u_off are 1, and MEL event is 1
  ------------------
  |  Branch (765:16): [True: 1.18k, False: 0]
  ------------------
  766|  1.18k|        OPJ_UINT32 d1;
  767|  1.18k|        OPJ_UINT32 d2;
  768|  1.18k|        OPJ_UINT32 suffix_len;
  769|       |
  770|  1.18k|        d1 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  771|  1.18k|        vlc >>= d1 & 0x3;                // Consume bits
  772|  1.18k|        consumed_bits += d1 & 0x3;
  773|       |
  774|  1.18k|        d2 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  775|  1.18k|        vlc >>= d2 & 0x3;                // Consume bits
  776|  1.18k|        consumed_bits += d2 & 0x3;
  777|       |
  778|  1.18k|        suffix_len = ((d1 >> 2) & 0x7);
  779|  1.18k|        consumed_bits += suffix_len;
  780|       |
  781|  1.18k|        d1 = (d1 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  782|  1.18k|        u[0] = d1 + 3; // add 2+kappa
  783|  1.18k|        vlc >>= suffix_len;
  784|       |
  785|  1.18k|        suffix_len = ((d2 >> 2) & 0x7);
  786|  1.18k|        consumed_bits += suffix_len;
  787|       |
  788|  1.18k|        d2 = (d2 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  789|  1.18k|        u[1] = d2 + 3; // add 2+kappa
  790|  1.18k|    }
  791|  16.4k|    return consumed_bits;
  792|  16.4k|}
ht_dec.c:frwd_fetch:
 1009|   106k|{
 1010|   106k|    if (msp->bits < 32) {
  ------------------
  |  Branch (1010:9): [True: 10.7k, False: 95.4k]
  ------------------
 1011|  10.7k|        frwd_read(msp);
 1012|  10.7k|        if (msp->bits < 32) { //need to test
  ------------------
  |  Branch (1012:13): [True: 27, False: 10.7k]
  ------------------
 1013|     27|            frwd_read(msp);
 1014|     27|        }
 1015|  10.7k|    }
 1016|   106k|    return (OPJ_UINT32)msp->tmp;
 1017|   106k|}
ht_dec.c:frwd_advance:
  996|   106k|{
  997|   106k|    assert(num_bits <= msp->bits);
  998|   106k|    msp->tmp >>= num_bits;  // consume num_bits
  999|   106k|    msp->bits -= num_bits;
 1000|   106k|}
ht_dec.c:count_leading_zeros:
   96|  38.3k|{
   97|       |#ifdef OPJ_COMPILER_MSVC
   98|       |    unsigned long result = 0;
   99|       |    _BitScanReverse(&result, val);
  100|       |    return 31U ^ (OPJ_UINT32)result;
  101|       |#elif (defined OPJ_COMPILER_GNUC)
  102|  38.3k|    return (OPJ_UINT32)__builtin_clz(val);
  103|       |#else
  104|       |    val |= (val >> 1);
  105|       |    val |= (val >> 2);
  106|       |    val |= (val >> 4);
  107|       |    val |= (val >> 8);
  108|       |    val |= (val >> 16);
  109|       |    return 32U - population_count(val);
  110|       |#endif
  111|  38.3k|}
ht_dec.c:decode_noninit_uvlc:
  805|  78.8k|{
  806|       |    //table stores possible decoding three bits from vlc
  807|       |    // there are 8 entries for xx1, x10, 100, 000, where x means do not care
  808|       |    // table value is made up of
  809|       |    // 2 bits in the LSB for prefix length
  810|       |    // 3 bits for suffix length
  811|       |    // 3 bits in the MSB for prefix value (u_pfx in Table 3 of ITU T.814)
  812|  78.8k|    static const OPJ_UINT8 dec[8] = {
  813|  78.8k|        3 | (5 << 2) | (5 << 5), //000 == 000, prefix codeword "000"
  814|  78.8k|        1 | (0 << 2) | (1 << 5), //001 == xx1, prefix codeword "1"
  815|  78.8k|        2 | (0 << 2) | (2 << 5), //010 == x10, prefix codeword "01"
  816|  78.8k|        1 | (0 << 2) | (1 << 5), //011 == xx1, prefix codeword "1"
  817|  78.8k|        3 | (1 << 2) | (3 << 5), //100 == 100, prefix codeword "001"
  818|  78.8k|        1 | (0 << 2) | (1 << 5), //101 == xx1, prefix codeword "1"
  819|  78.8k|        2 | (0 << 2) | (2 << 5), //110 == x10, prefix codeword "01"
  820|  78.8k|        1 | (0 << 2) | (1 << 5)  //111 == xx1, prefix codeword "1"
  821|  78.8k|    };
  822|       |
  823|  78.8k|    OPJ_UINT32 consumed_bits = 0;
  824|  78.8k|    if (mode == 0) {
  ------------------
  |  Branch (824:9): [True: 71.7k, False: 7.07k]
  ------------------
  825|  71.7k|        u[0] = u[1] = 1; //for kappa
  826|  71.7k|    } else if (mode <= 2) { //u_off are either 01 or 10
  ------------------
  |  Branch (826:16): [True: 1.63k, False: 5.44k]
  ------------------
  827|  1.63k|        OPJ_UINT32 d;
  828|  1.63k|        OPJ_UINT32 suffix_len;
  829|       |
  830|  1.63k|        d = dec[vlc & 0x7];  //look at the least significant 3 bits
  831|  1.63k|        vlc >>= d & 0x3;                //prefix length
  832|  1.63k|        consumed_bits += d & 0x3;
  833|       |
  834|  1.63k|        suffix_len = ((d >> 2) & 0x7);
  835|  1.63k|        consumed_bits += suffix_len;
  836|       |
  837|  1.63k|        d = (d >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  838|  1.63k|        u[0] = (mode == 1) ? d + 1 : 1; //for kappa
  ------------------
  |  Branch (838:16): [True: 764, False: 873]
  ------------------
  839|  1.63k|        u[1] = (mode == 1) ? 1 : d + 1; //for kappa
  ------------------
  |  Branch (839:16): [True: 764, False: 873]
  ------------------
  840|  5.44k|    } else if (mode == 3) { // both u_off are 1
  ------------------
  |  Branch (840:16): [True: 5.44k, False: 0]
  ------------------
  841|  5.44k|        OPJ_UINT32 d1;
  842|  5.44k|        OPJ_UINT32 d2;
  843|  5.44k|        OPJ_UINT32 suffix_len;
  844|       |
  845|  5.44k|        d1 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  846|  5.44k|        vlc >>= d1 & 0x3;                // Consume bits
  847|  5.44k|        consumed_bits += d1 & 0x3;
  848|       |
  849|  5.44k|        d2 = dec[vlc & 0x7];  // LSBs of VLC are prefix codeword
  850|  5.44k|        vlc >>= d2 & 0x3;                // Consume bits
  851|  5.44k|        consumed_bits += d2 & 0x3;
  852|       |
  853|  5.44k|        suffix_len = ((d1 >> 2) & 0x7);
  854|  5.44k|        consumed_bits += suffix_len;
  855|       |
  856|  5.44k|        d1 = (d1 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  857|  5.44k|        u[0] = d1 + 1;  //1 for kappa
  858|  5.44k|        vlc >>= suffix_len;
  859|       |
  860|  5.44k|        suffix_len = ((d2 >> 2) & 0x7);
  861|  5.44k|        consumed_bits += suffix_len;
  862|       |
  863|  5.44k|        d2 = (d2 >> 5) + (vlc & ((1U << suffix_len) - 1)); // u value
  864|  5.44k|        u[1] = d2 + 1;  //1 for kappa
  865|  5.44k|    }
  866|  78.8k|    return consumed_bits;
  867|  78.8k|}
ht_dec.c:rev_fetch_mrp:
  654|  15.4k|{
  655|  15.4k|    if (mrp->bits < 32) { // if there are less than 32 bits in mrp->tmp
  ------------------
  |  Branch (655:9): [True: 1.79k, False: 13.6k]
  ------------------
  656|  1.79k|        rev_read_mrp(mrp);    // read 30-32 bits from mrp
  657|  1.79k|        if (mrp->bits < 32) { // if there is a space of 32 bits
  ------------------
  |  Branch (657:13): [True: 0, False: 1.79k]
  ------------------
  658|      0|            rev_read_mrp(mrp);    // read more
  659|      0|        }
  660|  1.79k|    }
  661|  15.4k|    return (OPJ_UINT32)mrp->tmp;  // return the head of mrp->tmp
  662|  15.4k|}
ht_dec.c:rev_advance_mrp:
  672|  15.4k|{
  673|  15.4k|    assert(num_bits <= mrp->bits); // we must not consume more than mrp->bits
  674|  15.4k|    mrp->tmp >>= num_bits;         // discard the lowest num_bits bits
  675|  15.4k|    mrp->bits -= num_bits;
  676|  15.4k|    return (OPJ_UINT32)mrp->tmp;   // return data after consumption
  677|  15.4k|}
ht_dec.c:population_count:
   71|  15.4k|{
   72|       |#if defined(OPJ_COMPILER_MSVC) && (defined(_M_IX86) || defined(_M_AMD64))
   73|       |    return (OPJ_UINT32)__popcnt(val);
   74|       |#elif (defined OPJ_COMPILER_GNUC)
   75|  15.4k|    return (OPJ_UINT32)__builtin_popcount(val);
   76|       |#else
   77|       |    val -= ((val >> 1) & 0x55555555);
   78|       |    val = (((val >> 2) & 0x33333333) + (val & 0x33333333));
   79|       |    val = (((val >> 4) + val) & 0x0f0f0f0f);
   80|       |    val += (val >> 8);
   81|       |    val += (val >> 16);
   82|       |    return (OPJ_UINT32)(val & 0x0000003f);
   83|       |#endif
   84|  15.4k|}

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

opj_j2k_setup_decoder:
 6689|  9.22k|{
 6690|  9.22k|    if (j2k && parameters) {
  ------------------
  |  Branch (6690:9): [True: 9.22k, False: 0]
  |  Branch (6690:16): [True: 9.22k, False: 0]
  ------------------
 6691|  9.22k|        j2k->m_cp.m_specific_param.m_dec.m_layer = parameters->cp_layer;
 6692|  9.22k|        j2k->m_cp.m_specific_param.m_dec.m_reduce = parameters->cp_reduce;
 6693|       |
 6694|  9.22k|        j2k->dump_state = (parameters->flags & OPJ_DPARAMETERS_DUMP_FLAG);
  ------------------
  |  |  547|  9.22k|#define OPJ_DPARAMETERS_DUMP_FLAG 0x0002
  ------------------
 6695|       |#ifdef USE_JPWL
 6696|       |        j2k->m_cp.correct = parameters->jpwl_correct;
 6697|       |        j2k->m_cp.exp_comps = parameters->jpwl_exp_comps;
 6698|       |        j2k->m_cp.max_tiles = parameters->jpwl_max_tiles;
 6699|       |#endif /* USE_JPWL */
 6700|  9.22k|    }
 6701|  9.22k|}
opj_j2k_end_decompress:
 8412|  6.87k|{
 8413|  6.87k|    (void)p_j2k;
 8414|  6.87k|    (void)p_stream;
 8415|  6.87k|    (void)p_manager;
 8416|  6.87k|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.87k|#define OPJ_TRUE 1
  ------------------
 8417|  6.87k|}
opj_j2k_read_header:
 8423|  8.04k|{
 8424|       |    /* preconditions */
 8425|  8.04k|    assert(p_j2k != 00);
 8426|  8.04k|    assert(p_stream != 00);
 8427|  8.04k|    assert(p_manager != 00);
 8428|       |
 8429|       |    /* create an empty image header */
 8430|  8.04k|    p_j2k->m_private_image = opj_image_create0();
 8431|  8.04k|    if (! p_j2k->m_private_image) {
  ------------------
  |  Branch (8431:9): [True: 0, False: 8.04k]
  ------------------
 8432|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8433|      0|    }
 8434|       |
 8435|       |    /* customization of the validation */
 8436|  8.04k|    if (! opj_j2k_setup_decoding_validation(p_j2k, p_manager)) {
  ------------------
  |  Branch (8436:9): [True: 0, False: 8.04k]
  ------------------
 8437|      0|        opj_image_destroy(p_j2k->m_private_image);
 8438|      0|        p_j2k->m_private_image = NULL;
 8439|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8440|      0|    }
 8441|       |
 8442|       |    /* validation of the parameters codec */
 8443|  8.04k|    if (! opj_j2k_exec(p_j2k, p_j2k->m_validation_list, p_stream, p_manager)) {
  ------------------
  |  Branch (8443:9): [True: 0, False: 8.04k]
  ------------------
 8444|      0|        opj_image_destroy(p_j2k->m_private_image);
 8445|      0|        p_j2k->m_private_image = NULL;
 8446|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8447|      0|    }
 8448|       |
 8449|       |    /* customization of the encoding */
 8450|  8.04k|    if (! opj_j2k_setup_header_reading(p_j2k, p_manager)) {
  ------------------
  |  Branch (8450:9): [True: 0, False: 8.04k]
  ------------------
 8451|      0|        opj_image_destroy(p_j2k->m_private_image);
 8452|      0|        p_j2k->m_private_image = NULL;
 8453|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8454|      0|    }
 8455|       |
 8456|       |    /* read header */
 8457|  8.04k|    if (! opj_j2k_exec(p_j2k, p_j2k->m_procedure_list, p_stream, p_manager)) {
  ------------------
  |  Branch (8457:9): [True: 1.16k, False: 6.88k]
  ------------------
 8458|  1.16k|        opj_image_destroy(p_j2k->m_private_image);
 8459|  1.16k|        p_j2k->m_private_image = NULL;
 8460|  1.16k|        return OPJ_FALSE;
  ------------------
  |  |  118|  1.16k|#define OPJ_FALSE 0
  ------------------
 8461|  1.16k|    }
 8462|       |
 8463|  6.88k|    *p_image = opj_image_create0();
 8464|  6.88k|    if (!(*p_image)) {
  ------------------
  |  Branch (8464:9): [True: 0, False: 6.88k]
  ------------------
 8465|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8466|      0|    }
 8467|       |
 8468|       |    /* Copy codestream image information to the output image */
 8469|  6.88k|    opj_copy_image_header(p_j2k->m_private_image, *p_image);
 8470|       |
 8471|       |    /*Allocate and initialize some elements of codestrem index*/
 8472|  6.88k|    if (!opj_j2k_allocate_tile_element_cstr_index(p_j2k)) {
  ------------------
  |  Branch (8472:9): [True: 0, False: 6.88k]
  ------------------
 8473|      0|        opj_image_destroy(*p_image);
 8474|      0|        *p_image = NULL;
 8475|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8476|      0|    }
 8477|       |
 8478|  6.88k|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.88k|#define OPJ_TRUE 1
  ------------------
 8479|  6.88k|}
opj_j2k_destroy:
 9208|  9.22k|{
 9209|  9.22k|    if (p_j2k == 00) {
  ------------------
  |  Branch (9209:9): [True: 0, False: 9.22k]
  ------------------
 9210|      0|        return;
 9211|      0|    }
 9212|       |
 9213|  9.22k|    if (p_j2k->m_is_decoder) {
  ------------------
  |  Branch (9213:9): [True: 9.22k, False: 0]
  ------------------
 9214|       |
 9215|  9.22k|        if (p_j2k->m_specific_param.m_decoder.m_default_tcp != 00) {
  ------------------
  |  Branch (9215:13): [True: 9.22k, False: 0]
  ------------------
 9216|  9.22k|            opj_j2k_tcp_destroy(p_j2k->m_specific_param.m_decoder.m_default_tcp);
 9217|  9.22k|            opj_free(p_j2k->m_specific_param.m_decoder.m_default_tcp);
 9218|  9.22k|            p_j2k->m_specific_param.m_decoder.m_default_tcp = 00;
 9219|  9.22k|        }
 9220|       |
 9221|  9.22k|        if (p_j2k->m_specific_param.m_decoder.m_header_data != 00) {
  ------------------
  |  Branch (9221:13): [True: 9.22k, False: 0]
  ------------------
 9222|  9.22k|            opj_free(p_j2k->m_specific_param.m_decoder.m_header_data);
 9223|  9.22k|            p_j2k->m_specific_param.m_decoder.m_header_data = 00;
 9224|  9.22k|            p_j2k->m_specific_param.m_decoder.m_header_data_size = 0;
 9225|  9.22k|        }
 9226|       |
 9227|  9.22k|        opj_free(p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode);
 9228|  9.22k|        p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode = 00;
 9229|  9.22k|        p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode = 0;
 9230|       |
 9231|  9.22k|    } else {
 9232|       |
 9233|      0|        if (p_j2k->m_specific_param.m_encoder.m_encoded_tile_data) {
  ------------------
  |  Branch (9233:13): [True: 0, False: 0]
  ------------------
 9234|      0|            opj_free(p_j2k->m_specific_param.m_encoder.m_encoded_tile_data);
 9235|      0|            p_j2k->m_specific_param.m_encoder.m_encoded_tile_data = 00;
 9236|      0|        }
 9237|       |
 9238|      0|        if (p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_buffer) {
  ------------------
  |  Branch (9238:13): [True: 0, False: 0]
  ------------------
 9239|      0|            opj_free(p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_buffer);
 9240|      0|            p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_buffer = 00;
 9241|      0|            p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_current = 00;
 9242|      0|        }
 9243|       |
 9244|      0|        if (p_j2k->m_specific_param.m_encoder.m_header_tile_data) {
  ------------------
  |  Branch (9244:13): [True: 0, False: 0]
  ------------------
 9245|      0|            opj_free(p_j2k->m_specific_param.m_encoder.m_header_tile_data);
 9246|      0|            p_j2k->m_specific_param.m_encoder.m_header_tile_data = 00;
 9247|      0|            p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = 0;
 9248|      0|        }
 9249|      0|    }
 9250|       |
 9251|  9.22k|    opj_tcd_destroy(p_j2k->m_tcd);
 9252|       |
 9253|  9.22k|    opj_j2k_cp_destroy(&(p_j2k->m_cp));
 9254|  9.22k|    memset(&(p_j2k->m_cp), 0, sizeof(opj_cp_t));
 9255|       |
 9256|  9.22k|    opj_procedure_list_destroy(p_j2k->m_procedure_list);
 9257|  9.22k|    p_j2k->m_procedure_list = 00;
 9258|       |
 9259|  9.22k|    opj_procedure_list_destroy(p_j2k->m_validation_list);
 9260|  9.22k|    p_j2k->m_procedure_list = 00;
 9261|       |
 9262|  9.22k|    j2k_destroy_cstr_index(p_j2k->cstr_index);
 9263|  9.22k|    p_j2k->cstr_index = NULL;
 9264|       |
 9265|  9.22k|    opj_image_destroy(p_j2k->m_private_image);
 9266|  9.22k|    p_j2k->m_private_image = NULL;
 9267|       |
 9268|  9.22k|    opj_image_destroy(p_j2k->m_output_image);
 9269|  9.22k|    p_j2k->m_output_image = NULL;
 9270|       |
 9271|  9.22k|    opj_thread_pool_destroy(p_j2k->m_tp);
 9272|  9.22k|    p_j2k->m_tp = NULL;
 9273|       |
 9274|  9.22k|    opj_free(p_j2k);
 9275|  9.22k|}
j2k_destroy_cstr_index:
 9278|  9.22k|{
 9279|  9.22k|    if (p_cstr_ind) {
  ------------------
  |  Branch (9279:9): [True: 9.22k, False: 0]
  ------------------
 9280|       |
 9281|  9.22k|        if (p_cstr_ind->marker) {
  ------------------
  |  Branch (9281:13): [True: 9.22k, False: 0]
  ------------------
 9282|  9.22k|            opj_free(p_cstr_ind->marker);
 9283|  9.22k|            p_cstr_ind->marker = NULL;
 9284|  9.22k|        }
 9285|       |
 9286|  9.22k|        if (p_cstr_ind->tile_index) {
  ------------------
  |  Branch (9286:13): [True: 6.88k, False: 2.34k]
  ------------------
 9287|  6.88k|            OPJ_UINT32 it_tile = 0;
 9288|       |
 9289|  1.15M|            for (it_tile = 0; it_tile < p_cstr_ind->nb_of_tiles; it_tile++) {
  ------------------
  |  Branch (9289:31): [True: 1.14M, False: 6.88k]
  ------------------
 9290|       |
 9291|  1.14M|                if (p_cstr_ind->tile_index[it_tile].packet_index) {
  ------------------
  |  Branch (9291:21): [True: 0, False: 1.14M]
  ------------------
 9292|      0|                    opj_free(p_cstr_ind->tile_index[it_tile].packet_index);
 9293|      0|                    p_cstr_ind->tile_index[it_tile].packet_index = NULL;
 9294|      0|                }
 9295|       |
 9296|  1.14M|                if (p_cstr_ind->tile_index[it_tile].tp_index) {
  ------------------
  |  Branch (9296:21): [True: 7.37k, False: 1.13M]
  ------------------
 9297|  7.37k|                    opj_free(p_cstr_ind->tile_index[it_tile].tp_index);
 9298|  7.37k|                    p_cstr_ind->tile_index[it_tile].tp_index = NULL;
 9299|  7.37k|                }
 9300|       |
 9301|  1.14M|                if (p_cstr_ind->tile_index[it_tile].marker) {
  ------------------
  |  Branch (9301:21): [True: 1.14M, False: 0]
  ------------------
 9302|  1.14M|                    opj_free(p_cstr_ind->tile_index[it_tile].marker);
 9303|  1.14M|                    p_cstr_ind->tile_index[it_tile].marker = NULL;
 9304|       |
 9305|  1.14M|                }
 9306|  1.14M|            }
 9307|       |
 9308|  6.88k|            opj_free(p_cstr_ind->tile_index);
 9309|  6.88k|            p_cstr_ind->tile_index = NULL;
 9310|  6.88k|        }
 9311|       |
 9312|  9.22k|        opj_free(p_cstr_ind);
 9313|  9.22k|    }
 9314|  9.22k|}
opj_j2k_read_tile_header:
 9556|  7.42k|{
 9557|  7.42k|    OPJ_UINT32 l_current_marker = J2K_MS_SOT;
  ------------------
  |  |   73|  7.42k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
 9558|  7.42k|    OPJ_UINT32 l_marker_size;
 9559|  7.42k|    const opj_dec_memory_marker_handler_t * l_marker_handler = 00;
 9560|  7.42k|    opj_tcp_t * l_tcp = NULL;
 9561|  7.42k|    const OPJ_UINT32 l_nb_tiles = p_j2k->m_cp.tw * p_j2k->m_cp.th;
 9562|       |
 9563|       |    /* preconditions */
 9564|  7.42k|    assert(p_stream != 00);
 9565|  7.42k|    assert(p_j2k != 00);
 9566|  7.42k|    assert(p_manager != 00);
 9567|       |
 9568|       |    /* Reach the End Of Codestream ?*/
 9569|  7.42k|    if (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_EOC) {
  ------------------
  |  Branch (9569:9): [True: 4, False: 7.42k]
  ------------------
 9570|      4|        l_current_marker = J2K_MS_EOC;
  ------------------
  |  |   75|      4|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
 9571|      4|    }
 9572|       |    /* We need to encounter a SOT marker (a new tile-part header) */
 9573|  7.42k|    else if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_TPHSOT) {
  ------------------
  |  Branch (9573:14): [True: 0, False: 7.42k]
  ------------------
 9574|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9575|      0|    }
 9576|       |
 9577|       |    /* Read into the codestream until reach the EOC or ! can_decode ??? FIXME */
 9578|  14.5k|    while ((!p_j2k->m_specific_param.m_decoder.m_can_decode) &&
  ------------------
  |  Branch (9578:12): [True: 13.1k, False: 1.46k]
  ------------------
 9579|  14.5k|            (l_current_marker != J2K_MS_EOC)) {
  ------------------
  |  |   75|  13.1k|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
  |  Branch (9579:13): [True: 13.1k, False: 7]
  ------------------
 9580|       |
 9581|       |        /* Try to read until the Start Of Data is detected */
 9582|  24.3k|        while (l_current_marker != J2K_MS_SOD) {
  ------------------
  |  |   74|  24.3k|#define J2K_MS_SOD 0xff93   /**< SOD marker value */
  ------------------
  |  Branch (9582:16): [True: 17.1k, False: 7.24k]
  ------------------
 9583|       |
 9584|  17.1k|            if (opj_stream_get_number_byte_left(p_stream) == 0) {
  ------------------
  |  Branch (9584:17): [True: 5.52k, False: 11.6k]
  ------------------
 9585|  5.52k|                p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
 9586|  5.52k|                break;
 9587|  5.52k|            }
 9588|       |
 9589|       |            /* Try to read 2 bytes (the marker size) from stream and copy them into the buffer */
 9590|  11.6k|            if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9590:17): [True: 9, False: 11.6k]
  ------------------
 9591|  11.6k|                                     p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9592|      9|                opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      9|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9593|      9|                return OPJ_FALSE;
  ------------------
  |  |  118|      9|#define OPJ_FALSE 0
  ------------------
 9594|      9|            }
 9595|       |
 9596|       |            /* Read 2 bytes from the buffer as the marker size */
 9597|  11.6k|            opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data, &l_marker_size,
  ------------------
  |  |   65|  11.6k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9598|  11.6k|                           2);
 9599|       |
 9600|       |            /* Check marker size (does not include marker ID but includes marker size) */
 9601|  11.6k|            if (l_marker_size < 2) {
  ------------------
  |  Branch (9601:17): [True: 30, False: 11.5k]
  ------------------
 9602|     30|                opj_event_msg(p_manager, EVT_ERROR, "Inconsistent marker size\n");
  ------------------
  |  |   66|     30|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9603|     30|                return OPJ_FALSE;
  ------------------
  |  |  118|     30|#define OPJ_FALSE 0
  ------------------
 9604|     30|            }
 9605|       |
 9606|       |            /* cf. https://code.google.com/p/openjpeg/issues/detail?id=226 */
 9607|  11.5k|            if (l_current_marker == 0x8080 &&
  ------------------
  |  Branch (9607:17): [True: 2, False: 11.5k]
  ------------------
 9608|  11.5k|                    opj_stream_get_number_byte_left(p_stream) == 0) {
  ------------------
  |  Branch (9608:21): [True: 1, False: 1]
  ------------------
 9609|      1|                p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
 9610|      1|                break;
 9611|      1|            }
 9612|       |
 9613|       |            /* Why this condition? FIXME */
 9614|  11.5k|            if (p_j2k->m_specific_param.m_decoder.m_state & J2K_STATE_TPH) {
  ------------------
  |  Branch (9614:17): [True: 4.09k, False: 7.49k]
  ------------------
 9615|  4.09k|                p_j2k->m_specific_param.m_decoder.m_sot_length -= (l_marker_size + 2);
 9616|  4.09k|            }
 9617|  11.5k|            l_marker_size -= 2; /* Subtract the size of the marker ID already read */
 9618|       |
 9619|       |            /* Get the marker handler from the marker ID */
 9620|  11.5k|            l_marker_handler = opj_j2k_get_marker_handler(l_current_marker);
 9621|       |
 9622|       |            /* Check if the marker is known and if it is the right place to find it */
 9623|  11.5k|            if (!(p_j2k->m_specific_param.m_decoder.m_state & l_marker_handler->states)) {
  ------------------
  |  Branch (9623:17): [True: 14, False: 11.5k]
  ------------------
 9624|     14|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     14|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9625|     14|                              "Marker is not compliant with its position\n");
 9626|     14|                return OPJ_FALSE;
  ------------------
  |  |  118|     14|#define OPJ_FALSE 0
  ------------------
 9627|     14|            }
 9628|       |            /* FIXME manage case of unknown marker as in the main header ? */
 9629|       |
 9630|       |            /* Check if the marker size is compatible with the header data size */
 9631|  11.5k|            if (l_marker_size > p_j2k->m_specific_param.m_decoder.m_header_data_size) {
  ------------------
  |  Branch (9631:17): [True: 98, False: 11.4k]
  ------------------
 9632|     98|                OPJ_BYTE *new_header_data = NULL;
 9633|       |                /* If we are here, this means we consider this marker as known & we will read it */
 9634|       |                /* Check enough bytes left in stream before allocation */
 9635|     98|                if ((OPJ_OFF_T)l_marker_size >  opj_stream_get_number_byte_left(p_stream)) {
  ------------------
  |  Branch (9635:21): [True: 74, False: 24]
  ------------------
 9636|     74|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     74|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9637|     74|                                  "Marker size inconsistent with stream length\n");
 9638|     74|                    return OPJ_FALSE;
  ------------------
  |  |  118|     74|#define OPJ_FALSE 0
  ------------------
 9639|     74|                }
 9640|     24|                new_header_data = (OPJ_BYTE *) opj_realloc(
 9641|     24|                                      p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size);
 9642|     24|                if (! new_header_data) {
  ------------------
  |  Branch (9642:21): [True: 0, False: 24]
  ------------------
 9643|      0|                    opj_free(p_j2k->m_specific_param.m_decoder.m_header_data);
 9644|      0|                    p_j2k->m_specific_param.m_decoder.m_header_data = NULL;
 9645|      0|                    p_j2k->m_specific_param.m_decoder.m_header_data_size = 0;
 9646|      0|                    opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read header\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9647|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9648|      0|                }
 9649|     24|                p_j2k->m_specific_param.m_decoder.m_header_data = new_header_data;
 9650|     24|                p_j2k->m_specific_param.m_decoder.m_header_data_size = l_marker_size;
 9651|     24|            }
 9652|       |
 9653|       |            /* Try to read the rest of the marker segment from stream and copy them into the buffer */
 9654|  11.5k|            if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9654:17): [True: 61, False: 11.4k]
  ------------------
 9655|  11.5k|                                     p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size,
 9656|  11.5k|                                     p_manager) != l_marker_size) {
 9657|     61|                opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|     61|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9658|     61|                return OPJ_FALSE;
  ------------------
  |  |  118|     61|#define OPJ_FALSE 0
  ------------------
 9659|     61|            }
 9660|       |
 9661|  11.4k|            if (!l_marker_handler->handler) {
  ------------------
  |  Branch (9661:17): [True: 22, False: 11.4k]
  ------------------
 9662|       |                /* See issue #175 */
 9663|     22|                opj_event_msg(p_manager, EVT_ERROR, "Not sure how that happened.\n");
  ------------------
  |  |   66|     22|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9664|     22|                return OPJ_FALSE;
  ------------------
  |  |  118|     22|#define OPJ_FALSE 0
  ------------------
 9665|     22|            }
 9666|       |            /* Read the marker segment with the correct marker handler */
 9667|  11.4k|            if (!(*(l_marker_handler->handler))(p_j2k,
  ------------------
  |  Branch (9667:17): [True: 81, False: 11.3k]
  ------------------
 9668|  11.4k|                                                p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size, p_manager)) {
 9669|     81|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     81|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9670|     81|                              "Fail to read the current marker segment (%#x)\n", l_current_marker);
 9671|     81|                return OPJ_FALSE;
  ------------------
  |  |  118|     81|#define OPJ_FALSE 0
  ------------------
 9672|     81|            }
 9673|       |
 9674|       |            /* Add the marker to the codestream index*/
 9675|  11.3k|            if (OPJ_FALSE == opj_j2k_add_tlmarker(p_j2k->m_current_tile_number,
  ------------------
  |  |  118|  11.3k|#define OPJ_FALSE 0
  ------------------
  |  Branch (9675:17): [True: 0, False: 11.3k]
  ------------------
 9676|  11.3k|                                                  p_j2k->cstr_index,
 9677|  11.3k|                                                  l_marker_handler->id,
 9678|  11.3k|                                                  (OPJ_UINT32) opj_stream_tell(p_stream) - l_marker_size - 4,
 9679|  11.3k|                                                  l_marker_size + 4)) {
 9680|      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 */
  ------------------
 9681|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9682|      0|            }
 9683|       |
 9684|       |            /* Keep the position of the last SOT marker read */
 9685|  11.3k|            if (l_marker_handler->id == J2K_MS_SOT) {
  ------------------
  |  |   73|  11.3k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (9685:17): [True: 7.39k, False: 3.94k]
  ------------------
 9686|  7.39k|                OPJ_UINT32 sot_pos = (OPJ_UINT32) opj_stream_tell(p_stream) - l_marker_size - 4
 9687|  7.39k|                                     ;
 9688|  7.39k|                if (sot_pos > p_j2k->m_specific_param.m_decoder.m_last_sot_read_pos) {
  ------------------
  |  Branch (9688:21): [True: 7.39k, False: 0]
  ------------------
 9689|  7.39k|                    p_j2k->m_specific_param.m_decoder.m_last_sot_read_pos = sot_pos;
 9690|  7.39k|                }
 9691|  7.39k|            }
 9692|       |
 9693|  11.3k|            if (p_j2k->m_specific_param.m_decoder.m_skip_data) {
  ------------------
  |  Branch (9693:17): [True: 167, False: 11.1k]
  ------------------
 9694|       |                /* Skip the rest of the tile part header*/
 9695|    167|                if (opj_stream_skip(p_stream, p_j2k->m_specific_param.m_decoder.m_sot_length,
  ------------------
  |  Branch (9695:21): [True: 41, False: 126]
  ------------------
 9696|    167|                                    p_manager) != p_j2k->m_specific_param.m_decoder.m_sot_length) {
 9697|     41|                    opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|     41|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9698|     41|                    return OPJ_FALSE;
  ------------------
  |  |  118|     41|#define OPJ_FALSE 0
  ------------------
 9699|     41|                }
 9700|    126|                l_current_marker = J2K_MS_SOD; /* Normally we reached a SOD */
  ------------------
  |  |   74|    126|#define J2K_MS_SOD 0xff93   /**< SOD marker value */
  ------------------
 9701|  11.1k|            } else {
 9702|       |                /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer*/
 9703|  11.1k|                if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9703:21): [True: 21, False: 11.1k]
  ------------------
 9704|  11.1k|                                         p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9705|     21|                    opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|     21|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9706|     21|                    return OPJ_FALSE;
  ------------------
  |  |  118|     21|#define OPJ_FALSE 0
  ------------------
 9707|     21|                }
 9708|       |                /* Read 2 bytes from the buffer as the new marker ID */
 9709|  11.1k|                opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|  11.1k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9710|  11.1k|                               &l_current_marker, 2);
 9711|  11.1k|            }
 9712|  11.3k|        }
 9713|  12.7k|        if (opj_stream_get_number_byte_left(p_stream) == 0
  ------------------
  |  Branch (9713:13): [True: 5.53k, False: 7.23k]
  ------------------
 9714|  12.7k|                && p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NEOC) {
  ------------------
  |  Branch (9714:20): [True: 5.52k, False: 5]
  ------------------
 9715|  5.52k|            break;
 9716|  5.52k|        }
 9717|       |
 9718|       |        /* If we didn't skip data before, we need to read the SOD marker*/
 9719|  7.24k|        if (! p_j2k->m_specific_param.m_decoder.m_skip_data) {
  ------------------
  |  Branch (9719:13): [True: 7.11k, False: 126]
  ------------------
 9720|       |            /* Try to read the SOD marker and skip data ? FIXME */
 9721|  7.11k|            if (! opj_j2k_read_sod(p_j2k, p_stream, p_manager)) {
  ------------------
  |  Branch (9721:17): [True: 61, False: 7.05k]
  ------------------
 9722|     61|                return OPJ_FALSE;
  ------------------
  |  |  118|     61|#define OPJ_FALSE 0
  ------------------
 9723|     61|            }
 9724|  7.05k|            if (p_j2k->m_specific_param.m_decoder.m_can_decode &&
  ------------------
  |  Branch (9724:17): [True: 1.49k, False: 5.56k]
  ------------------
 9725|  7.05k|                    !p_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction_checked) {
  ------------------
  |  Branch (9725:21): [True: 1.04k, False: 450]
  ------------------
 9726|       |                /* Issue 254 */
 9727|  1.04k|                OPJ_BOOL l_correction_needed;
 9728|       |
 9729|  1.04k|                p_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction_checked = 1;
 9730|  1.04k|                if (!opj_j2k_need_nb_tile_parts_correction(p_stream,
  ------------------
  |  Branch (9730:21): [True: 4, False: 1.03k]
  ------------------
 9731|  1.04k|                        p_j2k->m_current_tile_number, &l_correction_needed, p_manager)) {
 9732|      4|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      4|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9733|      4|                                  "opj_j2k_apply_nb_tile_parts_correction error\n");
 9734|      4|                    return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
 9735|      4|                }
 9736|  1.03k|                if (l_correction_needed) {
  ------------------
  |  Branch (9736:21): [True: 27, False: 1.01k]
  ------------------
 9737|     27|                    OPJ_UINT32 l_tile_no;
 9738|       |
 9739|     27|                    p_j2k->m_specific_param.m_decoder.m_can_decode = 0;
 9740|     27|                    p_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction = 1;
 9741|       |                    /* correct tiles */
 9742|  1.52k|                    for (l_tile_no = 0U; l_tile_no < l_nb_tiles; ++l_tile_no) {
  ------------------
  |  Branch (9742:42): [True: 1.49k, False: 27]
  ------------------
 9743|  1.49k|                        if (p_j2k->m_cp.tcps[l_tile_no].m_nb_tile_parts != 0U) {
  ------------------
  |  Branch (9743:29): [True: 27, False: 1.46k]
  ------------------
 9744|     27|                            p_j2k->m_cp.tcps[l_tile_no].m_nb_tile_parts += 1;
 9745|     27|                        }
 9746|  1.49k|                    }
 9747|     27|                    opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|     27|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 9748|     27|                                  "Non conformant codestream TPsot==TNsot.\n");
 9749|     27|                }
 9750|  1.03k|            }
 9751|  7.05k|        } else {
 9752|       |            /* Indicate we will try to read a new tile-part header*/
 9753|    126|            p_j2k->m_specific_param.m_decoder.m_skip_data = 0;
 9754|    126|            p_j2k->m_specific_param.m_decoder.m_can_decode = 0;
 9755|    126|            p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPHSOT;
 9756|    126|        }
 9757|       |
 9758|  7.17k|        if (! p_j2k->m_specific_param.m_decoder.m_can_decode) {
  ------------------
  |  Branch (9758:13): [True: 5.71k, False: 1.46k]
  ------------------
 9759|       |            /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */
 9760|  5.71k|            if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9760:17): [True: 16, False: 5.70k]
  ------------------
 9761|  5.71k|                                     p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9762|       |
 9763|       |                /* Deal with likely non conformant SPOT6 files, where the last */
 9764|       |                /* row of tiles have TPsot == 0 and TNsot == 0, and missing EOC, */
 9765|       |                /* but no other tile-parts were found. */
 9766|     16|                if (p_j2k->m_current_tile_number + 1 == l_nb_tiles) {
  ------------------
  |  Branch (9766:21): [True: 14, False: 2]
  ------------------
 9767|     14|                    OPJ_UINT32 l_tile_no;
 9768|     53|                    for (l_tile_no = 0U; l_tile_no < l_nb_tiles; ++l_tile_no) {
  ------------------
  |  Branch (9768:42): [True: 51, False: 2]
  ------------------
 9769|     51|                        if (p_j2k->m_cp.tcps[l_tile_no].m_current_tile_part_number == 0 &&
  ------------------
  |  Branch (9769:29): [True: 15, False: 36]
  ------------------
 9770|     51|                                p_j2k->m_cp.tcps[l_tile_no].m_nb_tile_parts == 0) {
  ------------------
  |  Branch (9770:33): [True: 12, False: 3]
  ------------------
 9771|     12|                            break;
 9772|     12|                        }
 9773|     51|                    }
 9774|     14|                    if (l_tile_no < l_nb_tiles) {
  ------------------
  |  Branch (9774:25): [True: 12, False: 2]
  ------------------
 9775|     12|                        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|     12|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 9776|     12|                                      "Tile %u has TPsot == 0 and TNsot == 0, "
 9777|     12|                                      "but no other tile-parts were found. "
 9778|     12|                                      "EOC is also missing.\n",
 9779|     12|                                      l_tile_no);
 9780|     12|                        p_j2k->m_current_tile_number = l_tile_no;
 9781|     12|                        l_current_marker = J2K_MS_EOC;
  ------------------
  |  |   75|     12|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
 9782|     12|                        p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
 9783|     12|                        break;
 9784|     12|                    }
 9785|     14|                }
 9786|       |
 9787|      4|                opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      4|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9788|      4|                return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
 9789|     16|            }
 9790|       |
 9791|       |            /* Read 2 bytes from buffer as the new marker ID */
 9792|  5.70k|            opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|  5.70k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9793|  5.70k|                           &l_current_marker, 2);
 9794|  5.70k|        }
 9795|  7.17k|    }
 9796|       |
 9797|       |    /* Current marker is the EOC marker ?*/
 9798|  7.00k|    if (l_current_marker == J2K_MS_EOC) {
  ------------------
  |  |   75|  7.00k|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
  |  Branch (9798:9): [True: 19, False: 6.98k]
  ------------------
 9799|     19|        if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_EOC) {
  ------------------
  |  Branch (9799:13): [True: 3, False: 16]
  ------------------
 9800|      3|            p_j2k->m_current_tile_number = 0;
 9801|      3|            p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
 9802|      3|        }
 9803|     19|    }
 9804|       |
 9805|       |    /* Deal with tiles that have a single tile-part with TPsot == 0 and TNsot == 0 */
 9806|  7.00k|    if (! p_j2k->m_specific_param.m_decoder.m_can_decode) {
  ------------------
  |  Branch (9806:9): [True: 5.52k, False: 1.47k]
  ------------------
 9807|  5.52k|        l_tcp = p_j2k->m_cp.tcps + p_j2k->m_current_tile_number;
 9808|       |
 9809|  34.5k|        while ((p_j2k->m_current_tile_number < l_nb_tiles) && (l_tcp->m_data == 00)) {
  ------------------
  |  Branch (9809:16): [True: 34.5k, False: 33]
  |  Branch (9809:63): [True: 29.0k, False: 5.49k]
  ------------------
 9810|  29.0k|            ++p_j2k->m_current_tile_number;
 9811|  29.0k|            ++l_tcp;
 9812|  29.0k|        }
 9813|       |
 9814|  5.52k|        if (p_j2k->m_current_tile_number == l_nb_tiles) {
  ------------------
  |  Branch (9814:13): [True: 33, False: 5.49k]
  ------------------
 9815|     33|            *p_go_on = OPJ_FALSE;
  ------------------
  |  |  118|     33|#define OPJ_FALSE 0
  ------------------
 9816|     33|            return OPJ_TRUE;
  ------------------
  |  |  117|     33|#define OPJ_TRUE 1
  ------------------
 9817|     33|        }
 9818|  5.52k|    }
 9819|       |
 9820|  6.97k|    if (! opj_j2k_merge_ppt(p_j2k->m_cp.tcps + p_j2k->m_current_tile_number,
  ------------------
  |  Branch (9820:9): [True: 0, False: 6.97k]
  ------------------
 9821|  6.97k|                            p_manager)) {
 9822|      0|        opj_event_msg(p_manager, EVT_ERROR, "Failed to merge PPT data\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9823|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9824|      0|    }
 9825|       |    /*FIXME ???*/
 9826|  6.97k|    if (! opj_tcd_init_decode_tile(p_j2k->m_tcd, p_j2k->m_current_tile_number,
  ------------------
  |  Branch (9826:9): [True: 16, False: 6.95k]
  ------------------
 9827|  6.97k|                                   p_manager)) {
 9828|     16|        opj_event_msg(p_manager, EVT_ERROR, "Cannot decode tile, memory error\n");
  ------------------
  |  |   66|     16|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9829|     16|        return OPJ_FALSE;
  ------------------
  |  |  118|     16|#define OPJ_FALSE 0
  ------------------
 9830|     16|    }
 9831|       |
 9832|  6.95k|    opj_event_msg(p_manager, EVT_INFO, "Header of tile %d / %d has been read.\n",
  ------------------
  |  |   68|  6.95k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 9833|  6.95k|                  p_j2k->m_current_tile_number + 1, (p_j2k->m_cp.th * p_j2k->m_cp.tw));
 9834|       |
 9835|  6.95k|    *p_tile_index = p_j2k->m_current_tile_number;
 9836|  6.95k|    *p_go_on = OPJ_TRUE;
  ------------------
  |  |  117|  6.95k|#define OPJ_TRUE 1
  ------------------
 9837|  6.95k|    if (p_data_size) {
  ------------------
  |  Branch (9837:9): [True: 0, False: 6.95k]
  ------------------
 9838|       |        /* For internal use in j2k.c, we don't need this */
 9839|       |        /* This is just needed for folks using the opj_read_tile_header() / opj_decode_tile_data() combo */
 9840|      0|        *p_data_size = opj_tcd_get_decoded_tile_size(p_j2k->m_tcd, OPJ_FALSE);
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9841|      0|        if (*p_data_size == UINT_MAX) {
  ------------------
  |  Branch (9841:13): [True: 0, False: 0]
  ------------------
 9842|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9843|      0|        }
 9844|      0|    }
 9845|  6.95k|    *p_tile_x0 = p_j2k->m_tcd->tcd_image->tiles->x0;
 9846|  6.95k|    *p_tile_y0 = p_j2k->m_tcd->tcd_image->tiles->y0;
 9847|  6.95k|    *p_tile_x1 = p_j2k->m_tcd->tcd_image->tiles->x1;
 9848|  6.95k|    *p_tile_y1 = p_j2k->m_tcd->tcd_image->tiles->y1;
 9849|  6.95k|    *p_nb_comps = p_j2k->m_tcd->tcd_image->tiles->numcomps;
 9850|       |
 9851|  6.95k|    p_j2k->m_specific_param.m_decoder.m_state |= J2K_STATE_DATA;
 9852|       |
 9853|  6.95k|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.95k|#define OPJ_TRUE 1
  ------------------
 9854|  6.95k|}
opj_j2k_decode_tile:
 9862|  6.95k|{
 9863|  6.95k|    OPJ_UINT32 l_current_marker;
 9864|  6.95k|    OPJ_BYTE l_data [2];
 9865|  6.95k|    opj_tcp_t * l_tcp;
 9866|  6.95k|    opj_image_t* l_image_for_bounds;
 9867|       |
 9868|       |    /* preconditions */
 9869|  6.95k|    assert(p_stream != 00);
 9870|  6.95k|    assert(p_j2k != 00);
 9871|  6.95k|    assert(p_manager != 00);
 9872|       |
 9873|  6.95k|    if (!(p_j2k->m_specific_param.m_decoder.m_state & J2K_STATE_DATA)
  ------------------
  |  Branch (9873:9): [True: 0, False: 6.95k]
  ------------------
 9874|  6.95k|            || (p_tile_index != p_j2k->m_current_tile_number)) {
  ------------------
  |  Branch (9874:16): [True: 0, False: 6.95k]
  ------------------
 9875|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9876|      0|    }
 9877|       |
 9878|  6.95k|    l_tcp = &(p_j2k->m_cp.tcps[p_tile_index]);
 9879|  6.95k|    if (! l_tcp->m_data) {
  ------------------
  |  Branch (9879:9): [True: 17, False: 6.93k]
  ------------------
 9880|     17|        opj_j2k_tcp_destroy(l_tcp);
 9881|     17|        return OPJ_FALSE;
  ------------------
  |  |  118|     17|#define OPJ_FALSE 0
  ------------------
 9882|     17|    }
 9883|       |
 9884|       |    /* When using the opj_read_tile_header / opj_decode_tile_data API */
 9885|       |    /* such as in test_tile_decoder, m_output_image is NULL, so fall back */
 9886|       |    /* to the full image dimension. This is a bit surprising that */
 9887|       |    /* opj_set_decode_area() is only used to determine intersecting tiles, */
 9888|       |    /* but full tile decoding is done */
 9889|  6.93k|    l_image_for_bounds = p_j2k->m_output_image ? p_j2k->m_output_image :
  ------------------
  |  Branch (9889:26): [True: 6.93k, False: 0]
  ------------------
 9890|  6.93k|                         p_j2k->m_private_image;
 9891|  6.93k|    if (! opj_tcd_decode_tile(p_j2k->m_tcd,
  ------------------
  |  Branch (9891:9): [True: 1.66k, False: 5.27k]
  ------------------
 9892|  6.93k|                              l_image_for_bounds->x0,
 9893|  6.93k|                              l_image_for_bounds->y0,
 9894|  6.93k|                              l_image_for_bounds->x1,
 9895|  6.93k|                              l_image_for_bounds->y1,
 9896|  6.93k|                              p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode,
 9897|  6.93k|                              p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode,
 9898|  6.93k|                              l_tcp->m_data,
 9899|  6.93k|                              l_tcp->m_data_size,
 9900|  6.93k|                              p_tile_index,
 9901|  6.93k|                              p_j2k->cstr_index, p_manager)) {
 9902|  1.66k|        opj_j2k_tcp_destroy(l_tcp);
 9903|  1.66k|        p_j2k->m_specific_param.m_decoder.m_state |= J2K_STATE_ERR;
 9904|  1.66k|        opj_event_msg(p_manager, EVT_ERROR, "Failed to decode.\n");
  ------------------
  |  |   66|  1.66k|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9905|  1.66k|        return OPJ_FALSE;
  ------------------
  |  |  118|  1.66k|#define OPJ_FALSE 0
  ------------------
 9906|  1.66k|    }
 9907|       |
 9908|       |    /* p_data can be set to NULL when the call will take care of using */
 9909|       |    /* itself the TCD data. This is typically the case for whole single */
 9910|       |    /* tile decoding optimization. */
 9911|  5.27k|    if (p_data != NULL) {
  ------------------
  |  Branch (9911:9): [True: 0, False: 5.27k]
  ------------------
 9912|      0|        if (! opj_tcd_update_tile_data(p_j2k->m_tcd, p_data, p_data_size)) {
  ------------------
  |  Branch (9912:13): [True: 0, False: 0]
  ------------------
 9913|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9914|      0|        }
 9915|       |
 9916|       |        /* To avoid to destroy the tcp which can be useful when we try to decode a tile decoded before (cf j2k_random_tile_access)
 9917|       |        * we destroy just the data which will be re-read in read_tile_header*/
 9918|       |        /*opj_j2k_tcp_destroy(l_tcp);
 9919|       |        p_j2k->m_tcd->tcp = 0;*/
 9920|      0|        opj_j2k_tcp_data_destroy(l_tcp);
 9921|      0|    }
 9922|       |
 9923|  5.27k|    p_j2k->m_specific_param.m_decoder.m_can_decode = 0;
 9924|  5.27k|    p_j2k->m_specific_param.m_decoder.m_state &= (~(OPJ_UINT32)J2K_STATE_DATA);
 9925|       |
 9926|  5.27k|    if (opj_stream_get_number_byte_left(p_stream) == 0
  ------------------
  |  Branch (9926:9): [True: 4.03k, False: 1.24k]
  ------------------
 9927|  5.27k|            && p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NEOC) {
  ------------------
  |  Branch (9927:16): [True: 4.01k, False: 11]
  ------------------
 9928|  4.01k|        return OPJ_TRUE;
  ------------------
  |  |  117|  4.01k|#define OPJ_TRUE 1
  ------------------
 9929|  4.01k|    }
 9930|       |
 9931|  1.25k|    if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_EOC) {
  ------------------
  |  Branch (9931:9): [True: 1.24k, False: 8]
  ------------------
 9932|  1.24k|        if (opj_stream_read_data(p_stream, l_data, 2, p_manager) != 2) {
  ------------------
  |  Branch (9932:13): [True: 8, False: 1.23k]
  ------------------
 9933|      8|            opj_event_msg(p_manager, p_j2k->m_cp.strict ? EVT_ERROR : EVT_WARNING,
  ------------------
  |  |   66|      8|#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 (9933:38): [True: 8, False: 0]
  ------------------
 9934|      8|                          "Stream too short\n");
 9935|      8|            return p_j2k->m_cp.strict ? OPJ_FALSE : OPJ_TRUE;
  ------------------
  |  |  118|      8|#define OPJ_FALSE 0
  ------------------
                          return p_j2k->m_cp.strict ? OPJ_FALSE : OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
  |  Branch (9935:20): [True: 8, False: 0]
  ------------------
 9936|      8|        }
 9937|  1.23k|        opj_read_bytes(l_data, &l_current_marker, 2);
  ------------------
  |  |   65|  1.23k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9938|       |
 9939|  1.23k|        if (l_current_marker == J2K_MS_EOC) {
  ------------------
  |  |   75|  1.23k|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
  |  Branch (9939:13): [True: 2, False: 1.23k]
  ------------------
 9940|      2|            p_j2k->m_current_tile_number = 0;
 9941|      2|            p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
 9942|  1.23k|        } else if (l_current_marker != J2K_MS_SOT) {
  ------------------
  |  |   73|  1.23k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (9942:20): [True: 693, False: 543]
  ------------------
 9943|    693|            if (opj_stream_get_number_byte_left(p_stream) == 0) {
  ------------------
  |  Branch (9943:17): [True: 599, False: 94]
  ------------------
 9944|    599|                p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
 9945|    599|                opj_event_msg(p_manager, EVT_WARNING, "Stream does not end with EOC\n");
  ------------------
  |  |   67|    599|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 9946|    599|                return OPJ_TRUE;
  ------------------
  |  |  117|    599|#define OPJ_TRUE 1
  ------------------
 9947|    599|            }
 9948|     94|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short, expected SOT\n");
  ------------------
  |  |   66|     94|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9949|     94|            return OPJ_FALSE;
  ------------------
  |  |  118|     94|#define OPJ_FALSE 0
  ------------------
 9950|    693|        }
 9951|  1.23k|    }
 9952|       |
 9953|    553|    return OPJ_TRUE;
  ------------------
  |  |  117|    553|#define OPJ_TRUE 1
  ------------------
 9954|  1.25k|}
opj_j2k_set_decode_area:
10290|  6.88k|{
10291|  6.88k|    opj_cp_t * l_cp = &(p_j2k->m_cp);
10292|  6.88k|    opj_image_t * l_image = p_j2k->m_private_image;
10293|  6.88k|    OPJ_BOOL ret;
10294|  6.88k|    OPJ_UINT32 it_comp;
10295|       |
10296|  6.88k|    if (p_j2k->m_cp.tw == 1 && p_j2k->m_cp.th == 1 &&
  ------------------
  |  Branch (10296:9): [True: 4.28k, False: 2.59k]
  |  Branch (10296:32): [True: 3.94k, False: 345]
  ------------------
10297|  6.88k|            p_j2k->m_cp.tcps[0].m_data != NULL) {
  ------------------
  |  Branch (10297:13): [True: 0, False: 3.94k]
  ------------------
10298|       |        /* In the case of a single-tiled image whose codestream we have already */
10299|       |        /* ingested, go on */
10300|      0|    }
10301|       |    /* Check if we are read the main header */
10302|  6.88k|    else if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_TPHSOT) {
  ------------------
  |  Branch (10302:14): [True: 0, False: 6.88k]
  ------------------
10303|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10304|      0|                      "Need to decode the main header before begin to decode the remaining codestream.\n");
10305|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10306|      0|    }
10307|       |
10308|       |    /* Update the comps[].factor member of the output image with the one */
10309|       |    /* of m_reduce */
10310|  32.8k|    for (it_comp = 0; it_comp < p_image->numcomps; ++it_comp) {
  ------------------
  |  Branch (10310:23): [True: 25.9k, False: 6.88k]
  ------------------
10311|  25.9k|        p_image->comps[it_comp].factor = p_j2k->m_cp.m_specific_param.m_dec.m_reduce;
10312|  25.9k|    }
10313|       |
10314|  6.88k|    if (!p_start_x && !p_start_y && !p_end_x && !p_end_y) {
  ------------------
  |  Branch (10314:9): [True: 6.40k, False: 477]
  |  Branch (10314:23): [True: 6.37k, False: 25]
  |  Branch (10314:37): [True: 0, False: 6.37k]
  |  Branch (10314:49): [True: 0, False: 0]
  ------------------
10315|      0|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|      0|#define EVT_INFO    4   /**< Debug event type */
  ------------------
10316|      0|                      "No decoded area parameters, set the decoded area to the whole image\n");
10317|       |
10318|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_x = 0;
10319|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_y = 0;
10320|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = l_cp->tw;
10321|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = l_cp->th;
10322|       |
10323|      0|        p_image->x0 = l_image->x0;
10324|      0|        p_image->y0 = l_image->y0;
10325|      0|        p_image->x1 = l_image->x1;
10326|      0|        p_image->y1 = l_image->y1;
10327|       |
10328|      0|        return opj_j2k_update_image_dimensions(p_image, p_manager);
10329|      0|    }
10330|       |
10331|       |    /* ----- */
10332|       |    /* Check if the positions provided by the user are correct */
10333|       |
10334|       |    /* Left */
10335|  6.88k|    if (p_start_x < 0) {
  ------------------
  |  Branch (10335:9): [True: 0, False: 6.88k]
  ------------------
10336|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10337|      0|                      "Left position of the decoded area (region_x0=%d) should be >= 0.\n",
10338|      0|                      p_start_x);
10339|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10340|  6.88k|    } else if ((OPJ_UINT32)p_start_x > l_image->x1) {
  ------------------
  |  Branch (10340:16): [True: 0, False: 6.88k]
  ------------------
10341|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10342|      0|                      "Left position of the decoded area (region_x0=%d) is outside the image area (Xsiz=%d).\n",
10343|      0|                      p_start_x, l_image->x1);
10344|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10345|  6.88k|    } else if ((OPJ_UINT32)p_start_x < l_image->x0) {
  ------------------
  |  Branch (10345:16): [True: 0, False: 6.88k]
  ------------------
10346|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10347|      0|                      "Left position of the decoded area (region_x0=%d) is outside the image area (XOsiz=%d).\n",
10348|      0|                      p_start_x, l_image->x0);
10349|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_x = 0;
10350|      0|        p_image->x0 = l_image->x0;
10351|  6.88k|    } else {
10352|  6.88k|        p_j2k->m_specific_param.m_decoder.m_start_tile_x = ((OPJ_UINT32)p_start_x -
10353|  6.88k|                l_cp->tx0) / l_cp->tdx;
10354|  6.88k|        p_image->x0 = (OPJ_UINT32)p_start_x;
10355|  6.88k|    }
10356|       |
10357|       |    /* Up */
10358|  6.88k|    if (p_start_y < 0) {
  ------------------
  |  Branch (10358:9): [True: 0, False: 6.88k]
  ------------------
10359|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10360|      0|                      "Up position of the decoded area (region_y0=%d) should be >= 0.\n",
10361|      0|                      p_start_y);
10362|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10363|  6.88k|    } else if ((OPJ_UINT32)p_start_y > l_image->y1) {
  ------------------
  |  Branch (10363:16): [True: 0, False: 6.88k]
  ------------------
10364|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10365|      0|                      "Up position of the decoded area (region_y0=%d) is outside the image area (Ysiz=%d).\n",
10366|      0|                      p_start_y, l_image->y1);
10367|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10368|  6.88k|    } else if ((OPJ_UINT32)p_start_y < l_image->y0) {
  ------------------
  |  Branch (10368:16): [True: 0, False: 6.88k]
  ------------------
10369|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10370|      0|                      "Up position of the decoded area (region_y0=%d) is outside the image area (YOsiz=%d).\n",
10371|      0|                      p_start_y, l_image->y0);
10372|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_y = 0;
10373|      0|        p_image->y0 = l_image->y0;
10374|  6.88k|    } else {
10375|  6.88k|        p_j2k->m_specific_param.m_decoder.m_start_tile_y = ((OPJ_UINT32)p_start_y -
10376|  6.88k|                l_cp->ty0) / l_cp->tdy;
10377|  6.88k|        p_image->y0 = (OPJ_UINT32)p_start_y;
10378|  6.88k|    }
10379|       |
10380|       |    /* Right */
10381|  6.88k|    if (p_end_x <= 0) {
  ------------------
  |  Branch (10381:9): [True: 0, False: 6.88k]
  ------------------
10382|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10383|      0|                      "Right position of the decoded area (region_x1=%d) should be > 0.\n",
10384|      0|                      p_end_x);
10385|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10386|  6.88k|    } else if ((OPJ_UINT32)p_end_x < l_image->x0) {
  ------------------
  |  Branch (10386:16): [True: 0, False: 6.88k]
  ------------------
10387|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10388|      0|                      "Right position of the decoded area (region_x1=%d) is outside the image area (XOsiz=%d).\n",
10389|      0|                      p_end_x, l_image->x0);
10390|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10391|  6.88k|    } else if ((OPJ_UINT32)p_end_x > l_image->x1) {
  ------------------
  |  Branch (10391:16): [True: 0, False: 6.88k]
  ------------------
10392|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10393|      0|                      "Right position of the decoded area (region_x1=%d) is outside the image area (Xsiz=%d).\n",
10394|      0|                      p_end_x, l_image->x1);
10395|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = l_cp->tw;
10396|      0|        p_image->x1 = l_image->x1;
10397|  6.88k|    } else {
10398|  6.88k|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = (OPJ_UINT32)opj_int_ceildiv(
10399|  6.88k|                    p_end_x - (OPJ_INT32)l_cp->tx0, (OPJ_INT32)l_cp->tdx);
10400|  6.88k|        p_image->x1 = (OPJ_UINT32)p_end_x;
10401|  6.88k|    }
10402|       |
10403|       |    /* Bottom */
10404|  6.88k|    if (p_end_y <= 0) {
  ------------------
  |  Branch (10404:9): [True: 0, False: 6.88k]
  ------------------
10405|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10406|      0|                      "Bottom position of the decoded area (region_y1=%d) should be > 0.\n",
10407|      0|                      p_end_y);
10408|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10409|  6.88k|    } else if ((OPJ_UINT32)p_end_y < l_image->y0) {
  ------------------
  |  Branch (10409:16): [True: 0, False: 6.88k]
  ------------------
10410|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10411|      0|                      "Bottom position of the decoded area (region_y1=%d) is outside the image area (YOsiz=%d).\n",
10412|      0|                      p_end_y, l_image->y0);
10413|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10414|      0|    }
10415|  6.88k|    if ((OPJ_UINT32)p_end_y > l_image->y1) {
  ------------------
  |  Branch (10415:9): [True: 0, False: 6.88k]
  ------------------
10416|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10417|      0|                      "Bottom position of the decoded area (region_y1=%d) is outside the image area (Ysiz=%d).\n",
10418|      0|                      p_end_y, l_image->y1);
10419|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = l_cp->th;
10420|      0|        p_image->y1 = l_image->y1;
10421|  6.88k|    } else {
10422|  6.88k|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = (OPJ_UINT32)opj_int_ceildiv(
10423|  6.88k|                    p_end_y - (OPJ_INT32)l_cp->ty0, (OPJ_INT32)l_cp->tdy);
10424|  6.88k|        p_image->y1 = (OPJ_UINT32)p_end_y;
10425|  6.88k|    }
10426|       |    /* ----- */
10427|       |
10428|  6.88k|    p_j2k->m_specific_param.m_decoder.m_discard_tiles = 1;
10429|       |
10430|  6.88k|    ret = opj_j2k_update_image_dimensions(p_image, p_manager);
10431|       |
10432|  6.88k|    if (ret) {
  ------------------
  |  Branch (10432:9): [True: 6.88k, False: 0]
  ------------------
10433|  6.88k|        opj_event_msg(p_manager, EVT_INFO, "Setting decoding area to %d,%d,%d,%d\n",
  ------------------
  |  |   68|  6.88k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
10434|  6.88k|                      p_image->x0, p_image->y0, p_image->x1, p_image->y1);
10435|  6.88k|    }
10436|       |
10437|  6.88k|    return ret;
10438|  6.88k|}
opj_j2k_create_decompress:
10441|  9.22k|{
10442|  9.22k|    opj_j2k_t *l_j2k = (opj_j2k_t*) opj_calloc(1, sizeof(opj_j2k_t));
10443|  9.22k|    if (!l_j2k) {
  ------------------
  |  Branch (10443:9): [True: 0, False: 9.22k]
  ------------------
10444|      0|        return 00;
10445|      0|    }
10446|       |
10447|  9.22k|    l_j2k->m_is_decoder = 1;
10448|  9.22k|    l_j2k->m_cp.m_is_decoder = 1;
10449|       |    /* in the absence of JP2 boxes, consider different bit depth / sign */
10450|       |    /* per component is allowed */
10451|  9.22k|    l_j2k->m_cp.allow_different_bit_depth_sign = 1;
10452|       |
10453|       |    /* Default to using strict mode. */
10454|  9.22k|    l_j2k->m_cp.strict = OPJ_TRUE;
  ------------------
  |  |  117|  9.22k|#define OPJ_TRUE 1
  ------------------
10455|       |
10456|       |#ifdef OPJ_DISABLE_TPSOT_FIX
10457|       |    l_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction_checked = 1;
10458|       |#endif
10459|       |
10460|  9.22k|    l_j2k->m_specific_param.m_decoder.m_default_tcp = (opj_tcp_t*) opj_calloc(1,
10461|  9.22k|            sizeof(opj_tcp_t));
10462|  9.22k|    if (!l_j2k->m_specific_param.m_decoder.m_default_tcp) {
  ------------------
  |  Branch (10462:9): [True: 0, False: 9.22k]
  ------------------
10463|      0|        opj_j2k_destroy(l_j2k);
10464|      0|        return 00;
10465|      0|    }
10466|       |
10467|  9.22k|    l_j2k->m_specific_param.m_decoder.m_header_data = (OPJ_BYTE *) opj_calloc(1,
10468|  9.22k|            OPJ_J2K_DEFAULT_HEADER_SIZE);
  ------------------
  |  |  157|  9.22k|#define OPJ_J2K_DEFAULT_HEADER_SIZE         1000
  ------------------
10469|  9.22k|    if (! l_j2k->m_specific_param.m_decoder.m_header_data) {
  ------------------
  |  Branch (10469:9): [True: 0, False: 9.22k]
  ------------------
10470|      0|        opj_j2k_destroy(l_j2k);
10471|      0|        return 00;
10472|      0|    }
10473|       |
10474|  9.22k|    l_j2k->m_specific_param.m_decoder.m_header_data_size =
10475|  9.22k|        OPJ_J2K_DEFAULT_HEADER_SIZE;
  ------------------
  |  |  157|  9.22k|#define OPJ_J2K_DEFAULT_HEADER_SIZE         1000
  ------------------
10476|       |
10477|  9.22k|    l_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec = -1 ;
10478|       |
10479|  9.22k|    l_j2k->m_specific_param.m_decoder.m_last_sot_read_pos = 0 ;
10480|       |
10481|       |    /* codestream index creation */
10482|  9.22k|    l_j2k->cstr_index = opj_j2k_create_cstr_index();
10483|  9.22k|    if (!l_j2k->cstr_index) {
  ------------------
  |  Branch (10483:9): [True: 0, False: 9.22k]
  ------------------
10484|      0|        opj_j2k_destroy(l_j2k);
10485|      0|        return 00;
10486|      0|    }
10487|       |
10488|       |    /* validation list creation */
10489|  9.22k|    l_j2k->m_validation_list = opj_procedure_list_create();
10490|  9.22k|    if (! l_j2k->m_validation_list) {
  ------------------
  |  Branch (10490:9): [True: 0, False: 9.22k]
  ------------------
10491|      0|        opj_j2k_destroy(l_j2k);
10492|      0|        return 00;
10493|      0|    }
10494|       |
10495|       |    /* execution list creation */
10496|  9.22k|    l_j2k->m_procedure_list = opj_procedure_list_create();
10497|  9.22k|    if (! l_j2k->m_procedure_list) {
  ------------------
  |  Branch (10497:9): [True: 0, False: 9.22k]
  ------------------
10498|      0|        opj_j2k_destroy(l_j2k);
10499|      0|        return 00;
10500|      0|    }
10501|       |
10502|  9.22k|    l_j2k->m_tp = opj_thread_pool_create(opj_j2k_get_default_thread_count());
10503|  9.22k|    if (!l_j2k->m_tp) {
  ------------------
  |  Branch (10503:9): [True: 0, False: 9.22k]
  ------------------
10504|      0|        l_j2k->m_tp = opj_thread_pool_create(0);
10505|      0|    }
10506|  9.22k|    if (!l_j2k->m_tp) {
  ------------------
  |  Branch (10506:9): [True: 0, False: 9.22k]
  ------------------
10507|      0|        opj_j2k_destroy(l_j2k);
10508|      0|        return NULL;
10509|      0|    }
10510|       |
10511|  9.22k|    return l_j2k;
10512|  9.22k|}
opj_j2k_decode:
11995|  6.88k|{
11996|  6.88k|    if (!p_image) {
  ------------------
  |  Branch (11996:9): [True: 0, False: 6.88k]
  ------------------
11997|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11998|      0|    }
11999|       |
12000|       |    /* Heuristics to detect sequence opj_read_header(), opj_set_decoded_resolution_factor() */
12001|       |    /* and finally opj_decode_image() without manual setting of comps[].factor */
12002|       |    /* We could potentially always execute it, if we don't allow people to do */
12003|       |    /* opj_read_header(), modify x0,y0,x1,y1 of returned image an call opj_decode_image() */
12004|  6.88k|    if (p_j2k->m_cp.m_specific_param.m_dec.m_reduce > 0 &&
  ------------------
  |  Branch (12004:9): [True: 0, False: 6.88k]
  ------------------
12005|  6.88k|            p_j2k->m_private_image != NULL &&
  ------------------
  |  Branch (12005:13): [True: 0, False: 0]
  ------------------
12006|  6.88k|            p_j2k->m_private_image->numcomps > 0 &&
  ------------------
  |  Branch (12006:13): [True: 0, False: 0]
  ------------------
12007|  6.88k|            p_j2k->m_private_image->comps[0].factor ==
  ------------------
  |  Branch (12007:13): [True: 0, False: 0]
  ------------------
12008|      0|            p_j2k->m_cp.m_specific_param.m_dec.m_reduce &&
12009|  6.88k|            p_image->numcomps > 0 &&
  ------------------
  |  Branch (12009:13): [True: 0, False: 0]
  ------------------
12010|  6.88k|            p_image->comps[0].factor == 0 &&
  ------------------
  |  Branch (12010:13): [True: 0, False: 0]
  ------------------
12011|       |            /* Don't mess with image dimension if the user has allocated it */
12012|  6.88k|            p_image->comps[0].data == NULL) {
  ------------------
  |  Branch (12012:13): [True: 0, False: 0]
  ------------------
12013|      0|        OPJ_UINT32 it_comp;
12014|       |
12015|       |        /* Update the comps[].factor member of the output image with the one */
12016|       |        /* of m_reduce */
12017|      0|        for (it_comp = 0; it_comp < p_image->numcomps; ++it_comp) {
  ------------------
  |  Branch (12017:27): [True: 0, False: 0]
  ------------------
12018|      0|            p_image->comps[it_comp].factor = p_j2k->m_cp.m_specific_param.m_dec.m_reduce;
12019|      0|        }
12020|      0|        if (!opj_j2k_update_image_dimensions(p_image, p_manager)) {
  ------------------
  |  Branch (12020:13): [True: 0, False: 0]
  ------------------
12021|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12022|      0|        }
12023|      0|    }
12024|       |
12025|  6.88k|    if (p_j2k->m_output_image == NULL) {
  ------------------
  |  Branch (12025:9): [True: 6.88k, False: 0]
  ------------------
12026|  6.88k|        p_j2k->m_output_image = opj_image_create0();
12027|  6.88k|        if (!(p_j2k->m_output_image)) {
  ------------------
  |  Branch (12027:13): [True: 0, False: 6.88k]
  ------------------
12028|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12029|      0|        }
12030|  6.88k|    }
12031|  6.88k|    opj_copy_image_header(p_image, p_j2k->m_output_image);
12032|       |
12033|       |    /* customization of the decoding */
12034|  6.88k|    if (!opj_j2k_setup_decoding(p_j2k, p_manager)) {
  ------------------
  |  Branch (12034:9): [True: 0, False: 6.88k]
  ------------------
12035|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12036|      0|    }
12037|       |
12038|       |    /* Decode the codestream */
12039|  6.88k|    if (! opj_j2k_exec(p_j2k, p_j2k->m_procedure_list, p_stream, p_manager)) {
  ------------------
  |  Branch (12039:9): [True: 2.42k, False: 4.45k]
  ------------------
12040|  2.42k|        opj_image_destroy(p_j2k->m_private_image);
12041|  2.42k|        p_j2k->m_private_image = NULL;
12042|  2.42k|        return OPJ_FALSE;
  ------------------
  |  |  118|  2.42k|#define OPJ_FALSE 0
  ------------------
12043|  2.42k|    }
12044|       |
12045|       |    /* Move data and copy one information from codec to output image*/
12046|  4.45k|    return opj_j2k_move_data_from_codec_to_output_image(p_j2k, p_image);
12047|  6.88k|}
j2k.c:opj_j2k_get_default_thread_count:
 6730|  9.22k|{
 6731|  9.22k|    const char* num_threads_str = getenv("OPJ_NUM_THREADS");
 6732|  9.22k|    int num_cpus;
 6733|  9.22k|    int num_threads;
 6734|       |
 6735|  9.22k|    if (num_threads_str == NULL || !opj_has_thread_support()) {
  ------------------
  |  Branch (6735:9): [True: 9.22k, False: 0]
  |  Branch (6735:36): [True: 0, False: 0]
  ------------------
 6736|  9.22k|        return 0;
 6737|  9.22k|    }
 6738|      0|    num_cpus = opj_get_num_cpus();
 6739|      0|    if (strcmp(num_threads_str, "ALL_CPUS") == 0) {
  ------------------
  |  Branch (6739:9): [True: 0, False: 0]
  ------------------
 6740|      0|        return num_cpus;
 6741|      0|    }
 6742|      0|    if (num_cpus == 0) {
  ------------------
  |  Branch (6742:9): [True: 0, False: 0]
  ------------------
 6743|      0|        num_cpus = 32;
 6744|      0|    }
 6745|      0|    num_threads = atoi(num_threads_str);
 6746|      0|    if (num_threads < 0) {
  ------------------
  |  Branch (6746:9): [True: 0, False: 0]
  ------------------
 6747|      0|        num_threads = 0;
 6748|      0|    } else if (num_threads > 2 * num_cpus) {
  ------------------
  |  Branch (6748:16): [True: 0, False: 0]
  ------------------
 6749|      0|        num_threads = 2 * num_cpus;
 6750|      0|    }
 6751|      0|    return num_threads;
 6752|      0|}
j2k.c:opj_j2k_setup_header_reading:
 8483|  8.04k|{
 8484|       |    /* preconditions*/
 8485|  8.04k|    assert(p_j2k != 00);
 8486|  8.04k|    assert(p_manager != 00);
 8487|       |
 8488|  8.04k|    if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,
  ------------------
  |  Branch (8488:9): [True: 0, False: 8.04k]
  ------------------
 8489|  8.04k|                                           (opj_procedure)opj_j2k_read_header_procedure, p_manager)) {
 8490|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8491|      0|    }
 8492|       |
 8493|       |    /* DEVELOPER CORNER, add your custom procedures */
 8494|  8.04k|    if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,
  ------------------
  |  Branch (8494:9): [True: 0, False: 8.04k]
  ------------------
 8495|  8.04k|                                           (opj_procedure)opj_j2k_copy_default_tcp_and_create_tcd, p_manager))  {
 8496|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8497|      0|    }
 8498|       |
 8499|  8.04k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.04k|#define OPJ_TRUE 1
  ------------------
 8500|  8.04k|}
j2k.c:opj_j2k_read_header_procedure:
 8832|  8.04k|{
 8833|  8.04k|    OPJ_UINT32 l_current_marker;
 8834|  8.04k|    OPJ_UINT32 l_marker_size;
 8835|  8.04k|    const opj_dec_memory_marker_handler_t * l_marker_handler = 00;
 8836|  8.04k|    OPJ_BOOL l_has_siz = 0;
 8837|  8.04k|    OPJ_BOOL l_has_cod = 0;
 8838|  8.04k|    OPJ_BOOL l_has_qcd = 0;
 8839|       |
 8840|       |    /* preconditions */
 8841|  8.04k|    assert(p_stream != 00);
 8842|  8.04k|    assert(p_j2k != 00);
 8843|  8.04k|    assert(p_manager != 00);
 8844|       |
 8845|       |    /*  We enter in the main header */
 8846|  8.04k|    p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_MHSOC;
 8847|       |
 8848|       |    /* Try to read the SOC marker, the codestream must begin with SOC marker */
 8849|  8.04k|    if (! opj_j2k_read_soc(p_j2k, p_stream, p_manager)) {
  ------------------
  |  Branch (8849:9): [True: 76, False: 7.97k]
  ------------------
 8850|     76|        opj_event_msg(p_manager, EVT_ERROR, "Expected a SOC marker \n");
  ------------------
  |  |   66|     76|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8851|     76|        return OPJ_FALSE;
  ------------------
  |  |  118|     76|#define OPJ_FALSE 0
  ------------------
 8852|     76|    }
 8853|       |
 8854|       |    /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */
 8855|  7.97k|    if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (8855:9): [True: 2, False: 7.96k]
  ------------------
 8856|  7.97k|                             p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 8857|      2|        opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8858|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 8859|      2|    }
 8860|       |
 8861|       |    /* Read 2 bytes as the new marker ID */
 8862|  7.96k|    opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|  7.96k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 8863|  7.96k|                   &l_current_marker, 2);
 8864|       |
 8865|       |    /* Try to read until the SOT is detected */
 8866|   144k|    while (l_current_marker != J2K_MS_SOT) {
  ------------------
  |  |   73|   144k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (8866:12): [True: 139k, False: 4.94k]
  ------------------
 8867|       |
 8868|       |        /* Check if the current marker ID is valid */
 8869|   139k|        if (l_current_marker < 0xff00) {
  ------------------
  |  Branch (8869:13): [True: 154, False: 139k]
  ------------------
 8870|    154|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    154|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8871|    154|                          "A marker ID was expected (0xff--) instead of %.8x\n", l_current_marker);
 8872|    154|            return OPJ_FALSE;
  ------------------
  |  |  118|    154|#define OPJ_FALSE 0
  ------------------
 8873|    154|        }
 8874|       |
 8875|       |        /* Get the marker handler from the marker ID */
 8876|   139k|        l_marker_handler = opj_j2k_get_marker_handler(l_current_marker);
 8877|       |
 8878|       |        /* Manage case where marker is unknown */
 8879|   139k|        if (l_marker_handler->id == J2K_MS_UNK) {
  ------------------
  |  |   99|   139k|#define J2K_MS_UNK 0        /**< UNKNOWN marker value */
  ------------------
  |  Branch (8879:13): [True: 45.0k, False: 94.1k]
  ------------------
 8880|  45.0k|            if (! opj_j2k_read_unk(p_j2k, p_stream, &l_current_marker, p_manager)) {
  ------------------
  |  Branch (8880:17): [True: 154, False: 44.8k]
  ------------------
 8881|    154|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    154|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8882|    154|                              "Unknown marker has been detected and generated error.\n");
 8883|    154|                return OPJ_FALSE;
  ------------------
  |  |  118|    154|#define OPJ_FALSE 0
  ------------------
 8884|    154|            }
 8885|       |
 8886|  44.8k|            if (l_current_marker == J2K_MS_SOT) {
  ------------------
  |  |   73|  44.8k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (8886:17): [True: 1.99k, False: 42.8k]
  ------------------
 8887|  1.99k|                break;    /* SOT marker is detected main header is completely read */
 8888|  42.8k|            } else { /* Get the marker handler from the marker ID */
 8889|  42.8k|                l_marker_handler = opj_j2k_get_marker_handler(l_current_marker);
 8890|  42.8k|            }
 8891|  44.8k|        }
 8892|       |
 8893|   137k|        if (l_marker_handler->id == J2K_MS_SIZ) {
  ------------------
  |  |   77|   137k|#define J2K_MS_SIZ 0xff51   /**< SIZ marker value */
  ------------------
  |  Branch (8893:13): [True: 7.92k, False: 129k]
  ------------------
 8894|       |            /* Mark required SIZ marker as found */
 8895|  7.92k|            l_has_siz = 1;
 8896|  7.92k|        }
 8897|   137k|        if (l_marker_handler->id == J2K_MS_COD) {
  ------------------
  |  |   78|   137k|#define J2K_MS_COD 0xff52   /**< COD marker value */
  ------------------
  |  Branch (8897:13): [True: 7.95k, False: 129k]
  ------------------
 8898|       |            /* Mark required COD marker as found */
 8899|  7.95k|            l_has_cod = 1;
 8900|  7.95k|        }
 8901|   137k|        if (l_marker_handler->id == J2K_MS_QCD) {
  ------------------
  |  |   82|   137k|#define J2K_MS_QCD 0xff5c   /**< QCD marker value */
  ------------------
  |  Branch (8901:13): [True: 71.9k, False: 65.1k]
  ------------------
 8902|       |            /* Mark required QCD marker as found */
 8903|  71.9k|            l_has_qcd = 1;
 8904|  71.9k|        }
 8905|       |
 8906|       |        /* Check if the marker is known and if it is the right place to find it */
 8907|   137k|        if (!(p_j2k->m_specific_param.m_decoder.m_state & l_marker_handler->states)) {
  ------------------
  |  Branch (8907:13): [True: 9, False: 137k]
  ------------------
 8908|      9|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      9|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8909|      9|                          "Marker is not compliant with its position\n");
 8910|      9|            return OPJ_FALSE;
  ------------------
  |  |  118|      9|#define OPJ_FALSE 0
  ------------------
 8911|      9|        }
 8912|       |
 8913|       |        /* Try to read 2 bytes (the marker size) from stream and copy them into the buffer */
 8914|   137k|        if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (8914:13): [True: 23, False: 137k]
  ------------------
 8915|   137k|                                 p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 8916|     23|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|     23|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8917|     23|            return OPJ_FALSE;
  ------------------
  |  |  118|     23|#define OPJ_FALSE 0
  ------------------
 8918|     23|        }
 8919|       |
 8920|       |        /* read 2 bytes as the marker size */
 8921|   137k|        opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data, &l_marker_size,
  ------------------
  |  |   65|   137k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 8922|   137k|                       2);
 8923|   137k|        if (l_marker_size < 2) {
  ------------------
  |  Branch (8923:13): [True: 10, False: 137k]
  ------------------
 8924|     10|            opj_event_msg(p_manager, EVT_ERROR, "Invalid marker size\n");
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8925|     10|            return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
 8926|     10|        }
 8927|   137k|        l_marker_size -= 2; /* Subtract the size of the marker ID already read */
 8928|       |
 8929|       |        /* Check if the marker size is compatible with the header data size */
 8930|   137k|        if (l_marker_size > p_j2k->m_specific_param.m_decoder.m_header_data_size) {
  ------------------
  |  Branch (8930:13): [True: 103, False: 136k]
  ------------------
 8931|    103|            OPJ_BYTE *new_header_data = (OPJ_BYTE *) opj_realloc(
 8932|    103|                                            p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size);
 8933|    103|            if (! new_header_data) {
  ------------------
  |  Branch (8933:17): [True: 0, False: 103]
  ------------------
 8934|      0|                opj_free(p_j2k->m_specific_param.m_decoder.m_header_data);
 8935|      0|                p_j2k->m_specific_param.m_decoder.m_header_data = NULL;
 8936|      0|                p_j2k->m_specific_param.m_decoder.m_header_data_size = 0;
 8937|      0|                opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read header\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8938|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8939|      0|            }
 8940|    103|            p_j2k->m_specific_param.m_decoder.m_header_data = new_header_data;
 8941|    103|            p_j2k->m_specific_param.m_decoder.m_header_data_size = l_marker_size;
 8942|    103|        }
 8943|       |
 8944|       |        /* Try to read the rest of the marker segment from stream and copy them into the buffer */
 8945|   137k|        if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (8945:13): [True: 122, False: 136k]
  ------------------
 8946|   137k|                                 p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size,
 8947|   137k|                                 p_manager) != l_marker_size) {
 8948|    122|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|    122|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8949|    122|            return OPJ_FALSE;
  ------------------
  |  |  118|    122|#define OPJ_FALSE 0
  ------------------
 8950|    122|        }
 8951|       |
 8952|       |        /* Read the marker segment with the correct marker handler */
 8953|   136k|        if (!(*(l_marker_handler->handler))(p_j2k,
  ------------------
  |  Branch (8953:13): [True: 460, False: 136k]
  ------------------
 8954|   136k|                                            p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size, p_manager)) {
 8955|    460|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    460|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8956|    460|                          "Marker handler function failed to read the marker segment\n");
 8957|    460|            return OPJ_FALSE;
  ------------------
  |  |  118|    460|#define OPJ_FALSE 0
  ------------------
 8958|    460|        }
 8959|       |
 8960|       |        /* Add the marker to the codestream index*/
 8961|   136k|        if (OPJ_FALSE == opj_j2k_add_mhmarker(
  ------------------
  |  |  118|   136k|#define OPJ_FALSE 0
  ------------------
  |  Branch (8961:13): [True: 0, False: 136k]
  ------------------
 8962|   136k|                    p_j2k->cstr_index,
 8963|   136k|                    l_marker_handler->id,
 8964|   136k|                    (OPJ_UINT32) opj_stream_tell(p_stream) - l_marker_size - 4,
 8965|   136k|                    l_marker_size + 4)) {
 8966|      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 */
  ------------------
 8967|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8968|      0|        }
 8969|       |
 8970|       |        /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */
 8971|   136k|        if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (8971:13): [True: 98, False: 136k]
  ------------------
 8972|   136k|                                 p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 8973|     98|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|     98|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8974|     98|            return OPJ_FALSE;
  ------------------
  |  |  118|     98|#define OPJ_FALSE 0
  ------------------
 8975|     98|        }
 8976|       |
 8977|       |        /* read 2 bytes as the new marker ID */
 8978|   136k|        opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|   136k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 8979|   136k|                       &l_current_marker, 2);
 8980|   136k|    }
 8981|       |
 8982|  6.93k|    if (l_has_siz == 0) {
  ------------------
  |  Branch (8982:9): [True: 1, False: 6.93k]
  ------------------
 8983|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8984|      1|                      "required SIZ marker not found in main header\n");
 8985|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 8986|      1|    }
 8987|  6.93k|    if (l_has_cod == 0) {
  ------------------
  |  Branch (8987:9): [True: 6, False: 6.93k]
  ------------------
 8988|      6|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8989|      6|                      "required COD marker not found in main header\n");
 8990|      6|        return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
 8991|      6|    }
 8992|  6.93k|    if (l_has_qcd == 0) {
  ------------------
  |  Branch (8992:9): [True: 3, False: 6.92k]
  ------------------
 8993|      3|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8994|      3|                      "required QCD marker not found in main header\n");
 8995|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 8996|      3|    }
 8997|       |
 8998|  6.92k|    if (! opj_j2k_merge_ppm(&(p_j2k->m_cp), p_manager)) {
  ------------------
  |  Branch (8998:9): [True: 49, False: 6.88k]
  ------------------
 8999|     49|        opj_event_msg(p_manager, EVT_ERROR, "Failed to merge PPM data\n");
  ------------------
  |  |   66|     49|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9000|     49|        return OPJ_FALSE;
  ------------------
  |  |  118|     49|#define OPJ_FALSE 0
  ------------------
 9001|     49|    }
 9002|       |
 9003|  6.88k|    opj_event_msg(p_manager, EVT_INFO, "Main header has been correctly decoded.\n");
  ------------------
  |  |   68|  6.88k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 9004|       |
 9005|       |    /* Position of the last element if the main header */
 9006|  6.88k|    p_j2k->cstr_index->main_head_end = (OPJ_UINT32) opj_stream_tell(p_stream) - 2;
 9007|       |
 9008|       |    /* Next step: read a tile-part header */
 9009|  6.88k|    p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPHSOT;
 9010|       |
 9011|  6.88k|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.88k|#define OPJ_TRUE 1
  ------------------
 9012|  6.92k|}
j2k.c:opj_j2k_read_soc:
 1931|  8.04k|{
 1932|  8.04k|    OPJ_BYTE l_data [2];
 1933|  8.04k|    OPJ_UINT32 l_marker;
 1934|       |
 1935|       |    /* preconditions */
 1936|  8.04k|    assert(p_j2k != 00);
 1937|  8.04k|    assert(p_manager != 00);
 1938|  8.04k|    assert(p_stream != 00);
 1939|       |
 1940|  8.04k|    if (opj_stream_read_data(p_stream, l_data, 2, p_manager) != 2) {
  ------------------
  |  Branch (1940:9): [True: 55, False: 7.99k]
  ------------------
 1941|     55|        return OPJ_FALSE;
  ------------------
  |  |  118|     55|#define OPJ_FALSE 0
  ------------------
 1942|     55|    }
 1943|       |
 1944|  7.99k|    opj_read_bytes(l_data, &l_marker, 2);
  ------------------
  |  |   65|  7.99k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1945|  7.99k|    if (l_marker != J2K_MS_SOC) {
  ------------------
  |  |   72|  7.99k|#define J2K_MS_SOC 0xff4f   /**< SOC marker value */
  ------------------
  |  Branch (1945:9): [True: 21, False: 7.97k]
  ------------------
 1946|     21|        return OPJ_FALSE;
  ------------------
  |  |  118|     21|#define OPJ_FALSE 0
  ------------------
 1947|     21|    }
 1948|       |
 1949|       |    /* Next marker should be a SIZ marker in the main header */
 1950|  7.97k|    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|  7.97k|    p_j2k->cstr_index->main_head_start = opj_stream_tell(p_stream) - 2;
 1954|       |
 1955|  7.97k|    opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|  7.97k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 1956|  7.97k|                  "Start to read j2k main header (%" PRId64 ").\n",
 1957|  7.97k|                  p_j2k->cstr_index->main_head_start);
 1958|       |
 1959|       |    /* Add the marker to the codestream index*/
 1960|  7.97k|    if (OPJ_FALSE == opj_j2k_add_mhmarker(p_j2k->cstr_index, J2K_MS_SOC,
  ------------------
  |  |  118|  7.97k|#define OPJ_FALSE 0
  ------------------
                  if (OPJ_FALSE == opj_j2k_add_mhmarker(p_j2k->cstr_index, J2K_MS_SOC,
  ------------------
  |  |   72|  7.97k|#define J2K_MS_SOC 0xff4f   /**< SOC marker value */
  ------------------
  |  Branch (1960:9): [True: 0, False: 7.97k]
  ------------------
 1961|  7.97k|                                          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|  7.97k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.97k|#define OPJ_TRUE 1
  ------------------
 1966|  7.97k|}
j2k.c:opj_j2k_read_unk:
 5672|  45.0k|{
 5673|  45.0k|    OPJ_UINT32 l_unknown_marker;
 5674|  45.0k|    const opj_dec_memory_marker_handler_t * l_marker_handler;
 5675|  45.0k|    OPJ_UINT32 l_size_unk = 2;
 5676|       |
 5677|       |    /* preconditions*/
 5678|  45.0k|    assert(p_j2k != 00);
 5679|  45.0k|    assert(p_manager != 00);
 5680|  45.0k|    assert(p_stream != 00);
 5681|       |
 5682|  45.0k|    opj_event_msg(p_manager, EVT_WARNING, "Unknown marker\n");
  ------------------
  |  |   67|  45.0k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 5683|       |
 5684|  1.75M|    for (;;) {
 5685|       |        /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer*/
 5686|  1.75M|        if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (5686:13): [True: 138, False: 1.75M]
  ------------------
 5687|  1.75M|                                 p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 5688|    138|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|    138|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5689|    138|            return OPJ_FALSE;
  ------------------
  |  |  118|    138|#define OPJ_FALSE 0
  ------------------
 5690|    138|        }
 5691|       |
 5692|       |        /* read 2 bytes as the new marker ID*/
 5693|  1.75M|        opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|  1.75M|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5694|  1.75M|                       &l_unknown_marker, 2);
 5695|       |
 5696|  1.75M|        if (!(l_unknown_marker < 0xff00)) {
  ------------------
  |  Branch (5696:13): [True: 204k, False: 1.55M]
  ------------------
 5697|       |
 5698|       |            /* Get the marker handler from the marker ID*/
 5699|   204k|            l_marker_handler = opj_j2k_get_marker_handler(l_unknown_marker);
 5700|       |
 5701|   204k|            if (!(p_j2k->m_specific_param.m_decoder.m_state & l_marker_handler->states)) {
  ------------------
  |  Branch (5701:17): [True: 16, False: 204k]
  ------------------
 5702|     16|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     16|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5703|     16|                              "Marker is not compliant with its position\n");
 5704|     16|                return OPJ_FALSE;
  ------------------
  |  |  118|     16|#define OPJ_FALSE 0
  ------------------
 5705|   204k|            } else {
 5706|   204k|                if (l_marker_handler->id != J2K_MS_UNK) {
  ------------------
  |  |   99|   204k|#define J2K_MS_UNK 0        /**< UNKNOWN marker value */
  ------------------
  |  Branch (5706:21): [True: 44.8k, False: 159k]
  ------------------
 5707|       |                    /* Add the marker to the codestream index*/
 5708|  44.8k|                    if (l_marker_handler->id != J2K_MS_SOT) {
  ------------------
  |  |   73|  44.8k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (5708:25): [True: 42.8k, False: 1.99k]
  ------------------
 5709|  42.8k|                        OPJ_BOOL res = opj_j2k_add_mhmarker(p_j2k->cstr_index, J2K_MS_UNK,
  ------------------
  |  |   99|  42.8k|#define J2K_MS_UNK 0        /**< UNKNOWN marker value */
  ------------------
 5710|  42.8k|                                                            (OPJ_UINT32) opj_stream_tell(p_stream) - l_size_unk,
 5711|  42.8k|                                                            l_size_unk);
 5712|  42.8k|                        if (res == OPJ_FALSE) {
  ------------------
  |  |  118|  42.8k|#define OPJ_FALSE 0
  ------------------
  |  Branch (5712:29): [True: 0, False: 42.8k]
  ------------------
 5713|      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 */
  ------------------
 5714|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5715|      0|                        }
 5716|  42.8k|                    }
 5717|  44.8k|                    break; /* next marker is known and well located */
 5718|   159k|                } else {
 5719|   159k|                    l_size_unk += 2;
 5720|   159k|                }
 5721|   204k|            }
 5722|   204k|        }
 5723|  1.75M|    }
 5724|       |
 5725|  44.8k|    *output_marker = l_marker_handler->id ;
 5726|       |
 5727|  44.8k|    return OPJ_TRUE;
  ------------------
  |  |  117|  44.8k|#define OPJ_TRUE 1
  ------------------
 5728|  45.0k|}
j2k.c:opj_j2k_add_mhmarker:
 8326|   187k|{
 8327|   187k|    assert(cstr_index != 00);
 8328|       |
 8329|       |    /* expand the list? */
 8330|   187k|    if ((cstr_index->marknum + 1) > cstr_index->maxmarknum) {
  ------------------
  |  Branch (8330:9): [True: 1.42k, False: 185k]
  ------------------
 8331|  1.42k|        opj_marker_info_t *new_marker;
 8332|  1.42k|        cstr_index->maxmarknum = (OPJ_UINT32)(100 + (OPJ_FLOAT32)
 8333|  1.42k|                                              cstr_index->maxmarknum);
 8334|  1.42k|        new_marker = (opj_marker_info_t *) opj_realloc(cstr_index->marker,
 8335|  1.42k|                     cstr_index->maxmarknum * sizeof(opj_marker_info_t));
 8336|  1.42k|        if (! new_marker) {
  ------------------
  |  Branch (8336:13): [True: 0, False: 1.42k]
  ------------------
 8337|      0|            opj_free(cstr_index->marker);
 8338|      0|            cstr_index->marker = NULL;
 8339|      0|            cstr_index->maxmarknum = 0;
 8340|      0|            cstr_index->marknum = 0;
 8341|       |            /* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add mh marker\n"); */
 8342|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8343|      0|        }
 8344|  1.42k|        cstr_index->marker = new_marker;
 8345|  1.42k|    }
 8346|       |
 8347|       |    /* add the marker */
 8348|   187k|    cstr_index->marker[cstr_index->marknum].type = (OPJ_UINT16)type;
 8349|   187k|    cstr_index->marker[cstr_index->marknum].pos = (OPJ_INT32)pos;
 8350|   187k|    cstr_index->marker[cstr_index->marknum].len = (OPJ_INT32)len;
 8351|   187k|    cstr_index->marknum++;
 8352|   187k|    return OPJ_TRUE;
  ------------------
  |  |  117|   187k|#define OPJ_TRUE 1
  ------------------
 8353|   187k|}
j2k.c:opj_j2k_merge_ppm:
 3923|  6.92k|{
 3924|  6.92k|    OPJ_UINT32 i, l_ppm_data_size, l_N_ppm_remaining;
 3925|       |
 3926|       |    /* preconditions */
 3927|  6.92k|    assert(p_cp != 00);
 3928|  6.92k|    assert(p_manager != 00);
 3929|  6.92k|    assert(p_cp->ppm_buffer == NULL);
 3930|       |
 3931|  6.92k|    if (p_cp->ppm == 0U) {
  ------------------
  |  Branch (3931:9): [True: 6.85k, False: 73]
  ------------------
 3932|  6.85k|        return OPJ_TRUE;
  ------------------
  |  |  117|  6.85k|#define OPJ_TRUE 1
  ------------------
 3933|  6.85k|    }
 3934|       |
 3935|     73|    l_ppm_data_size = 0U;
 3936|     73|    l_N_ppm_remaining = 0U;
 3937|  4.77k|    for (i = 0U; i < p_cp->ppm_markers_count; ++i) {
  ------------------
  |  Branch (3937:18): [True: 4.69k, False: 72]
  ------------------
 3938|  4.69k|        if (p_cp->ppm_markers[i].m_data !=
  ------------------
  |  Branch (3938:13): [True: 173, False: 4.52k]
  ------------------
 3939|  4.69k|                NULL) { /* standard doesn't seem to require contiguous Zppm */
 3940|    173|            OPJ_UINT32 l_N_ppm;
 3941|    173|            OPJ_UINT32 l_data_size = p_cp->ppm_markers[i].m_data_size;
 3942|    173|            const OPJ_BYTE* l_data = p_cp->ppm_markers[i].m_data;
 3943|       |
 3944|    173|            if (l_N_ppm_remaining >= l_data_size) {
  ------------------
  |  Branch (3944:17): [True: 80, False: 93]
  ------------------
 3945|     80|                l_N_ppm_remaining -= l_data_size;
 3946|     80|                l_data_size = 0U;
 3947|     93|            } else {
 3948|     93|                l_data += l_N_ppm_remaining;
 3949|     93|                l_data_size -= l_N_ppm_remaining;
 3950|     93|                l_N_ppm_remaining = 0U;
 3951|     93|            }
 3952|       |
 3953|    173|            if (l_data_size > 0U) {
  ------------------
  |  Branch (3953:17): [True: 93, False: 80]
  ------------------
 3954|    343|                do {
 3955|       |                    /* read Nppm */
 3956|    343|                    if (l_data_size < 4U) {
  ------------------
  |  Branch (3956:25): [True: 1, False: 342]
  ------------------
 3957|       |                        /* clean up to be done on l_cp destruction */
 3958|      1|                        opj_event_msg(p_manager, EVT_ERROR, "Not enough bytes to read Nppm\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3959|      1|                        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 3960|      1|                    }
 3961|    342|                    opj_read_bytes(l_data, &l_N_ppm, 4);
  ------------------
  |  |   65|    342|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3962|    342|                    l_data += 4;
 3963|    342|                    l_data_size -= 4;
 3964|    342|                    l_ppm_data_size +=
 3965|    342|                        l_N_ppm; /* can't overflow, max 256 markers of max 65536 bytes, that is when PPM markers are not corrupted which is checked elsewhere */
 3966|       |
 3967|    342|                    if (l_data_size >= l_N_ppm) {
  ------------------
  |  Branch (3967:25): [True: 274, False: 68]
  ------------------
 3968|    274|                        l_data_size -= l_N_ppm;
 3969|    274|                        l_data += l_N_ppm;
 3970|    274|                    } else {
 3971|     68|                        l_N_ppm_remaining = l_N_ppm - l_data_size;
 3972|     68|                        l_data_size = 0U;
 3973|     68|                    }
 3974|    342|                } while (l_data_size > 0U);
  ------------------
  |  Branch (3974:26): [True: 250, False: 92]
  ------------------
 3975|     93|            }
 3976|    173|        }
 3977|  4.69k|    }
 3978|       |
 3979|     72|    if (l_N_ppm_remaining != 0U) {
  ------------------
  |  Branch (3979:9): [True: 47, False: 25]
  ------------------
 3980|       |        /* clean up to be done on l_cp destruction */
 3981|     47|        opj_event_msg(p_manager, EVT_ERROR, "Corrupted PPM markers\n");
  ------------------
  |  |   66|     47|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3982|     47|        return OPJ_FALSE;
  ------------------
  |  |  118|     47|#define OPJ_FALSE 0
  ------------------
 3983|     47|    }
 3984|       |
 3985|     25|    p_cp->ppm_buffer = (OPJ_BYTE *) opj_malloc(l_ppm_data_size);
 3986|     25|    if (p_cp->ppm_buffer == 00) {
  ------------------
  |  Branch (3986:9): [True: 1, False: 24]
  ------------------
 3987|      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 */
  ------------------
 3988|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 3989|      1|    }
 3990|     24|    p_cp->ppm_len = l_ppm_data_size;
 3991|     24|    l_ppm_data_size = 0U;
 3992|     24|    l_N_ppm_remaining = 0U;
 3993|  1.16k|    for (i = 0U; i < p_cp->ppm_markers_count; ++i) {
  ------------------
  |  Branch (3993:18): [True: 1.14k, False: 24]
  ------------------
 3994|  1.14k|        if (p_cp->ppm_markers[i].m_data !=
  ------------------
  |  Branch (3994:13): [True: 46, False: 1.09k]
  ------------------
 3995|  1.14k|                NULL) { /* standard doesn't seem to require contiguous Zppm */
 3996|     46|            OPJ_UINT32 l_N_ppm;
 3997|     46|            OPJ_UINT32 l_data_size = p_cp->ppm_markers[i].m_data_size;
 3998|     46|            const OPJ_BYTE* l_data = p_cp->ppm_markers[i].m_data;
 3999|       |
 4000|     46|            if (l_N_ppm_remaining >= l_data_size) {
  ------------------
  |  Branch (4000:17): [True: 10, False: 36]
  ------------------
 4001|     10|                memcpy(p_cp->ppm_buffer + l_ppm_data_size, l_data, l_data_size);
 4002|     10|                l_ppm_data_size += l_data_size;
 4003|     10|                l_N_ppm_remaining -= l_data_size;
 4004|     10|                l_data_size = 0U;
 4005|     36|            } else {
 4006|     36|                memcpy(p_cp->ppm_buffer + l_ppm_data_size, l_data, l_N_ppm_remaining);
 4007|     36|                l_ppm_data_size += l_N_ppm_remaining;
 4008|     36|                l_data += l_N_ppm_remaining;
 4009|     36|                l_data_size -= l_N_ppm_remaining;
 4010|     36|                l_N_ppm_remaining = 0U;
 4011|     36|            }
 4012|       |
 4013|     46|            if (l_data_size > 0U) {
  ------------------
  |  Branch (4013:17): [True: 36, False: 10]
  ------------------
 4014|    138|                do {
 4015|       |                    /* read Nppm */
 4016|    138|                    if (l_data_size < 4U) {
  ------------------
  |  Branch (4016:25): [True: 0, False: 138]
  ------------------
 4017|       |                        /* clean up to be done on l_cp destruction */
 4018|      0|                        opj_event_msg(p_manager, EVT_ERROR, "Not enough bytes to read Nppm\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4019|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4020|      0|                    }
 4021|    138|                    opj_read_bytes(l_data, &l_N_ppm, 4);
  ------------------
  |  |   65|    138|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4022|    138|                    l_data += 4;
 4023|    138|                    l_data_size -= 4;
 4024|       |
 4025|    138|                    if (l_data_size >= l_N_ppm) {
  ------------------
  |  Branch (4025:25): [True: 125, False: 13]
  ------------------
 4026|    125|                        memcpy(p_cp->ppm_buffer + l_ppm_data_size, l_data, l_N_ppm);
 4027|    125|                        l_ppm_data_size += l_N_ppm;
 4028|    125|                        l_data_size -= l_N_ppm;
 4029|    125|                        l_data += l_N_ppm;
 4030|    125|                    } else {
 4031|     13|                        memcpy(p_cp->ppm_buffer + l_ppm_data_size, l_data, l_data_size);
 4032|     13|                        l_ppm_data_size += l_data_size;
 4033|     13|                        l_N_ppm_remaining = l_N_ppm - l_data_size;
 4034|     13|                        l_data_size = 0U;
 4035|     13|                    }
 4036|    138|                } while (l_data_size > 0U);
  ------------------
  |  Branch (4036:26): [True: 102, False: 36]
  ------------------
 4037|     36|            }
 4038|     46|            opj_free(p_cp->ppm_markers[i].m_data);
 4039|     46|            p_cp->ppm_markers[i].m_data = NULL;
 4040|     46|            p_cp->ppm_markers[i].m_data_size = 0U;
 4041|     46|        }
 4042|  1.14k|    }
 4043|       |
 4044|     24|    p_cp->ppm_data = p_cp->ppm_buffer;
 4045|     24|    p_cp->ppm_data_size = p_cp->ppm_len;
 4046|       |
 4047|     24|    p_cp->ppm_markers_count = 0U;
 4048|     24|    opj_free(p_cp->ppm_markers);
 4049|     24|    p_cp->ppm_markers = NULL;
 4050|       |
 4051|     24|    return OPJ_TRUE;
  ------------------
  |  |  117|     24|#define OPJ_TRUE 1
  ------------------
 4052|     24|}
j2k.c:opj_j2k_copy_default_tcp_and_create_tcd:
 9049|  6.88k|{
 9050|  6.88k|    opj_tcp_t * l_tcp = 00;
 9051|  6.88k|    opj_tcp_t * l_default_tcp = 00;
 9052|  6.88k|    OPJ_UINT32 l_nb_tiles;
 9053|  6.88k|    OPJ_UINT32 i, j;
 9054|  6.88k|    opj_tccp_t *l_current_tccp = 00;
 9055|  6.88k|    OPJ_UINT32 l_tccp_size;
 9056|  6.88k|    OPJ_UINT32 l_mct_size;
 9057|  6.88k|    opj_image_t * l_image;
 9058|  6.88k|    OPJ_UINT32 l_mcc_records_size, l_mct_records_size;
 9059|  6.88k|    opj_mct_data_t * l_src_mct_rec, *l_dest_mct_rec;
 9060|  6.88k|    opj_simple_mcc_decorrelation_data_t * l_src_mcc_rec, *l_dest_mcc_rec;
 9061|  6.88k|    OPJ_UINT32 l_offset;
 9062|       |
 9063|       |    /* preconditions */
 9064|  6.88k|    assert(p_j2k != 00);
 9065|  6.88k|    assert(p_stream != 00);
 9066|  6.88k|    assert(p_manager != 00);
 9067|       |
 9068|  6.88k|    OPJ_UNUSED(p_stream);
  ------------------
  |  |  219|  6.88k|#define OPJ_UNUSED(x) (void)x
  ------------------
 9069|       |
 9070|  6.88k|    l_image = p_j2k->m_private_image;
 9071|  6.88k|    l_nb_tiles = p_j2k->m_cp.th * p_j2k->m_cp.tw;
 9072|  6.88k|    l_tcp = p_j2k->m_cp.tcps;
 9073|  6.88k|    l_tccp_size = l_image->numcomps * (OPJ_UINT32)sizeof(opj_tccp_t);
 9074|  6.88k|    l_default_tcp = p_j2k->m_specific_param.m_decoder.m_default_tcp;
 9075|  6.88k|    l_mct_size = l_image->numcomps * l_image->numcomps * (OPJ_UINT32)sizeof(
 9076|  6.88k|                     OPJ_FLOAT32);
 9077|       |
 9078|       |    /* For each tile */
 9079|  1.15M|    for (i = 0; i < l_nb_tiles; ++i) {
  ------------------
  |  Branch (9079:17): [True: 1.14M, False: 6.88k]
  ------------------
 9080|       |        /* keep the tile-compo coding parameters pointer of the current tile coding parameters*/
 9081|  1.14M|        l_current_tccp = l_tcp->tccps;
 9082|       |        /*Copy default coding parameters into the current tile coding parameters*/
 9083|  1.14M|        memcpy(l_tcp, l_default_tcp, sizeof(opj_tcp_t));
 9084|       |        /* Initialize some values of the current tile coding parameters*/
 9085|  1.14M|        l_tcp->cod = 0;
 9086|  1.14M|        l_tcp->ppt = 0;
 9087|  1.14M|        l_tcp->ppt_data = 00;
 9088|  1.14M|        l_tcp->m_current_tile_part_number = -1;
 9089|       |        /* Remove memory not owned by this tile in case of early error return. */
 9090|  1.14M|        l_tcp->m_mct_decoding_matrix = 00;
 9091|  1.14M|        l_tcp->m_nb_max_mct_records = 0;
 9092|  1.14M|        l_tcp->m_mct_records = 00;
 9093|  1.14M|        l_tcp->m_nb_max_mcc_records = 0;
 9094|  1.14M|        l_tcp->m_mcc_records = 00;
 9095|       |        /* Reconnect the tile-compo coding parameters pointer to the current tile coding parameters*/
 9096|  1.14M|        l_tcp->tccps = l_current_tccp;
 9097|       |
 9098|       |        /* Get the mct_decoding_matrix of the dflt_tile_cp and copy them into the current tile cp*/
 9099|  1.14M|        if (l_default_tcp->m_mct_decoding_matrix) {
  ------------------
  |  Branch (9099:13): [True: 0, False: 1.14M]
  ------------------
 9100|      0|            l_tcp->m_mct_decoding_matrix = (OPJ_FLOAT32*)opj_malloc(l_mct_size);
 9101|      0|            if (! l_tcp->m_mct_decoding_matrix) {
  ------------------
  |  Branch (9101:17): [True: 0, False: 0]
  ------------------
 9102|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9103|      0|            }
 9104|      0|            memcpy(l_tcp->m_mct_decoding_matrix, l_default_tcp->m_mct_decoding_matrix,
 9105|      0|                   l_mct_size);
 9106|      0|        }
 9107|       |
 9108|       |        /* Get the mct_record of the dflt_tile_cp and copy them into the current tile cp*/
 9109|  1.14M|        l_mct_records_size = l_default_tcp->m_nb_max_mct_records * (OPJ_UINT32)sizeof(
 9110|  1.14M|                                 opj_mct_data_t);
 9111|  1.14M|        l_tcp->m_mct_records = (opj_mct_data_t*)opj_malloc(l_mct_records_size);
 9112|  1.14M|        if (! l_tcp->m_mct_records) {
  ------------------
  |  Branch (9112:13): [True: 0, False: 1.14M]
  ------------------
 9113|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9114|      0|        }
 9115|  1.14M|        memcpy(l_tcp->m_mct_records, l_default_tcp->m_mct_records, l_mct_records_size);
 9116|       |
 9117|       |        /* Copy the mct record data from dflt_tile_cp to the current tile*/
 9118|  1.14M|        l_src_mct_rec = l_default_tcp->m_mct_records;
 9119|  1.14M|        l_dest_mct_rec = l_tcp->m_mct_records;
 9120|       |
 9121|  1.29M|        for (j = 0; j < l_default_tcp->m_nb_mct_records; ++j) {
  ------------------
  |  Branch (9121:21): [True: 153k, False: 1.14M]
  ------------------
 9122|       |
 9123|   153k|            if (l_src_mct_rec->m_data) {
  ------------------
  |  Branch (9123:17): [True: 3.99k, False: 149k]
  ------------------
 9124|       |
 9125|  3.99k|                l_dest_mct_rec->m_data = (OPJ_BYTE*) opj_malloc(l_src_mct_rec->m_data_size);
 9126|  3.99k|                if (! l_dest_mct_rec->m_data) {
  ------------------
  |  Branch (9126:21): [True: 0, False: 3.99k]
  ------------------
 9127|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9128|      0|                }
 9129|  3.99k|                memcpy(l_dest_mct_rec->m_data, l_src_mct_rec->m_data,
 9130|  3.99k|                       l_src_mct_rec->m_data_size);
 9131|  3.99k|            }
 9132|       |
 9133|   153k|            ++l_src_mct_rec;
 9134|   153k|            ++l_dest_mct_rec;
 9135|       |            /* Update with each pass to free exactly what has been allocated on early return. */
 9136|   153k|            l_tcp->m_nb_max_mct_records += 1;
 9137|   153k|        }
 9138|       |
 9139|       |        /* Get the mcc_record of the dflt_tile_cp and copy them into the current tile cp*/
 9140|  1.14M|        l_mcc_records_size = l_default_tcp->m_nb_max_mcc_records * (OPJ_UINT32)sizeof(
 9141|  1.14M|                                 opj_simple_mcc_decorrelation_data_t);
 9142|  1.14M|        l_tcp->m_mcc_records = (opj_simple_mcc_decorrelation_data_t*) opj_malloc(
 9143|  1.14M|                                   l_mcc_records_size);
 9144|  1.14M|        if (! l_tcp->m_mcc_records) {
  ------------------
  |  Branch (9144:13): [True: 0, False: 1.14M]
  ------------------
 9145|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9146|      0|        }
 9147|  1.14M|        memcpy(l_tcp->m_mcc_records, l_default_tcp->m_mcc_records, l_mcc_records_size);
 9148|  1.14M|        l_tcp->m_nb_max_mcc_records = l_default_tcp->m_nb_max_mcc_records;
 9149|       |
 9150|       |        /* Copy the mcc record data from dflt_tile_cp to the current tile*/
 9151|  1.14M|        l_src_mcc_rec = l_default_tcp->m_mcc_records;
 9152|  1.14M|        l_dest_mcc_rec = l_tcp->m_mcc_records;
 9153|       |
 9154|  12.5M|        for (j = 0; j < l_default_tcp->m_nb_max_mcc_records; ++j) {
  ------------------
  |  Branch (9154:21): [True: 11.4M, False: 1.14M]
  ------------------
 9155|       |
 9156|  11.4M|            if (l_src_mcc_rec->m_decorrelation_array) {
  ------------------
  |  Branch (9156:17): [True: 1.14k, False: 11.4M]
  ------------------
 9157|  1.14k|                l_offset = (OPJ_UINT32)(l_src_mcc_rec->m_decorrelation_array -
 9158|  1.14k|                                        l_default_tcp->m_mct_records);
 9159|  1.14k|                l_dest_mcc_rec->m_decorrelation_array = l_tcp->m_mct_records + l_offset;
 9160|  1.14k|            }
 9161|       |
 9162|  11.4M|            if (l_src_mcc_rec->m_offset_array) {
  ------------------
  |  Branch (9162:17): [True: 1.26k, False: 11.4M]
  ------------------
 9163|  1.26k|                l_offset = (OPJ_UINT32)(l_src_mcc_rec->m_offset_array -
 9164|  1.26k|                                        l_default_tcp->m_mct_records);
 9165|  1.26k|                l_dest_mcc_rec->m_offset_array = l_tcp->m_mct_records + l_offset;
 9166|  1.26k|            }
 9167|       |
 9168|  11.4M|            ++l_src_mcc_rec;
 9169|  11.4M|            ++l_dest_mcc_rec;
 9170|  11.4M|        }
 9171|       |
 9172|       |        /* Copy all the dflt_tile_compo_cp to the current tile cp */
 9173|  1.14M|        memcpy(l_current_tccp, l_default_tcp->tccps, l_tccp_size);
 9174|       |
 9175|       |        /* Move to next tile cp*/
 9176|  1.14M|        ++l_tcp;
 9177|  1.14M|    }
 9178|       |
 9179|       |    /* Create the current tile decoder*/
 9180|  6.88k|    p_j2k->m_tcd = opj_tcd_create(OPJ_TRUE);
  ------------------
  |  |  117|  6.88k|#define OPJ_TRUE 1
  ------------------
 9181|  6.88k|    if (! p_j2k->m_tcd) {
  ------------------
  |  Branch (9181:9): [True: 0, False: 6.88k]
  ------------------
 9182|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9183|      0|    }
 9184|       |
 9185|  6.88k|    if (!opj_tcd_init(p_j2k->m_tcd, l_image, &(p_j2k->m_cp), p_j2k->m_tp)) {
  ------------------
  |  Branch (9185:9): [True: 0, False: 6.88k]
  ------------------
 9186|      0|        opj_tcd_destroy(p_j2k->m_tcd);
 9187|      0|        p_j2k->m_tcd = 00;
 9188|      0|        opj_event_msg(p_manager, EVT_ERROR, "Cannot decode tile, memory error\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9189|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9190|      0|    }
 9191|       |
 9192|  6.88k|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.88k|#define OPJ_TRUE 1
  ------------------
 9193|  6.88k|}
j2k.c:opj_j2k_setup_decoding_validation:
 8504|  8.04k|{
 8505|       |    /* preconditions*/
 8506|  8.04k|    assert(p_j2k != 00);
 8507|  8.04k|    assert(p_manager != 00);
 8508|       |
 8509|  8.04k|    if (! opj_procedure_list_add_procedure(p_j2k->m_validation_list,
  ------------------
  |  Branch (8509:9): [True: 0, False: 8.04k]
  ------------------
 8510|  8.04k|                                           (opj_procedure)opj_j2k_build_decoder, p_manager)) {
 8511|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8512|      0|    }
 8513|  8.04k|    if (! opj_procedure_list_add_procedure(p_j2k->m_validation_list,
  ------------------
  |  Branch (8513:9): [True: 0, False: 8.04k]
  ------------------
 8514|  8.04k|                                           (opj_procedure)opj_j2k_decoding_validation, p_manager)) {
 8515|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8516|      0|    }
 8517|       |
 8518|       |    /* DEVELOPER CORNER, add your custom validation procedure */
 8519|  8.04k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.04k|#define OPJ_TRUE 1
  ------------------
 8520|  8.04k|}
j2k.c:opj_j2k_build_decoder:
 8724|  8.04k|{
 8725|       |    /* add here initialization of cp
 8726|       |       copy paste of setup_decoder */
 8727|  8.04k|    (void)p_j2k;
 8728|  8.04k|    (void)p_stream;
 8729|  8.04k|    (void)p_manager;
 8730|  8.04k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.04k|#define OPJ_TRUE 1
  ------------------
 8731|  8.04k|}
j2k.c:opj_j2k_decoding_validation:
 8800|  8.04k|{
 8801|  8.04k|    OPJ_BOOL l_is_valid = OPJ_TRUE;
  ------------------
  |  |  117|  8.04k|#define OPJ_TRUE 1
  ------------------
 8802|       |
 8803|       |    /* preconditions*/
 8804|  8.04k|    assert(p_j2k != 00);
 8805|  8.04k|    assert(p_stream != 00);
 8806|  8.04k|    assert(p_manager != 00);
 8807|       |
 8808|  8.04k|    OPJ_UNUSED(p_stream);
  ------------------
  |  |  219|  8.04k|#define OPJ_UNUSED(x) (void)x
  ------------------
 8809|  8.04k|    OPJ_UNUSED(p_manager);
  ------------------
  |  |  219|  8.04k|#define OPJ_UNUSED(x) (void)x
  ------------------
 8810|       |
 8811|       |    /* STATE checking */
 8812|       |    /* make sure the state is at 0 */
 8813|       |#ifdef TODO_MSD
 8814|       |    l_is_valid &= (p_j2k->m_specific_param.m_decoder.m_state == J2K_DEC_STATE_NONE);
 8815|       |#endif
 8816|  8.04k|    l_is_valid &= (p_j2k->m_specific_param.m_decoder.m_state == 0x0000);
 8817|       |
 8818|       |    /* POINTER validation */
 8819|       |    /* make sure a p_j2k codec is present */
 8820|       |    /* make sure a procedure list is present */
 8821|  8.04k|    l_is_valid &= (p_j2k->m_procedure_list != 00);
 8822|       |    /* make sure a validation list is present */
 8823|  8.04k|    l_is_valid &= (p_j2k->m_validation_list != 00);
 8824|       |
 8825|       |    /* PARAMETER VALIDATION */
 8826|  8.04k|    return l_is_valid;
 8827|  8.04k|}
j2k.c:opj_j2k_exec:
 9018|  22.9k|{
 9019|  22.9k|    OPJ_BOOL(** l_procedure)(opj_j2k_t *, opj_stream_private_t *,
 9020|  22.9k|                             opj_event_mgr_t *) = 00;
 9021|  22.9k|    OPJ_BOOL l_result = OPJ_TRUE;
  ------------------
  |  |  117|  22.9k|#define OPJ_TRUE 1
  ------------------
 9022|  22.9k|    OPJ_UINT32 l_nb_proc, i;
 9023|       |
 9024|       |    /* preconditions*/
 9025|  22.9k|    assert(p_procedure_list != 00);
 9026|  22.9k|    assert(p_j2k != 00);
 9027|  22.9k|    assert(p_stream != 00);
 9028|  22.9k|    assert(p_manager != 00);
 9029|       |
 9030|  22.9k|    l_nb_proc = opj_procedure_list_get_nb_procedures(p_procedure_list);
 9031|  22.9k|    l_procedure = (OPJ_BOOL(**)(opj_j2k_t *, opj_stream_private_t *,
 9032|  22.9k|                                opj_event_mgr_t *)) opj_procedure_list_get_first_procedure(p_procedure_list);
 9033|       |
 9034|  62.0k|    for (i = 0; i < l_nb_proc; ++i) {
  ------------------
  |  Branch (9034:17): [True: 39.0k, False: 22.9k]
  ------------------
 9035|  39.0k|        l_result = l_result && ((*l_procedure)(p_j2k, p_stream, p_manager));
  ------------------
  |  Branch (9035:20): [True: 37.9k, False: 1.16k]
  |  Branch (9035:32): [True: 34.3k, False: 3.59k]
  ------------------
 9036|  39.0k|        ++l_procedure;
 9037|  39.0k|    }
 9038|       |
 9039|       |    /* and clear the procedure list at the end.*/
 9040|  22.9k|    opj_procedure_list_clear(p_procedure_list);
 9041|  22.9k|    return l_result;
 9042|  22.9k|}
j2k.c:opj_j2k_tcp_destroy:
 9317|  1.42M|{
 9318|  1.42M|    if (p_tcp == 00) {
  ------------------
  |  Branch (9318:9): [True: 0, False: 1.42M]
  ------------------
 9319|      0|        return;
 9320|      0|    }
 9321|       |
 9322|  1.42M|    if (p_tcp->ppt_markers != 00) {
  ------------------
  |  Branch (9322:9): [True: 16, False: 1.42M]
  ------------------
 9323|     16|        OPJ_UINT32 i;
 9324|  1.98k|        for (i = 0U; i < p_tcp->ppt_markers_count; ++i) {
  ------------------
  |  Branch (9324:22): [True: 1.97k, False: 16]
  ------------------
 9325|  1.97k|            if (p_tcp->ppt_markers[i].m_data != NULL) {
  ------------------
  |  Branch (9325:17): [True: 36, False: 1.93k]
  ------------------
 9326|     36|                opj_free(p_tcp->ppt_markers[i].m_data);
 9327|     36|            }
 9328|  1.97k|        }
 9329|     16|        p_tcp->ppt_markers_count = 0U;
 9330|     16|        opj_free(p_tcp->ppt_markers);
 9331|     16|        p_tcp->ppt_markers = NULL;
 9332|     16|    }
 9333|       |
 9334|  1.42M|    if (p_tcp->ppt_buffer != 00) {
  ------------------
  |  Branch (9334:9): [True: 17, False: 1.42M]
  ------------------
 9335|     17|        opj_free(p_tcp->ppt_buffer);
 9336|     17|        p_tcp->ppt_buffer = 00;
 9337|     17|    }
 9338|       |
 9339|  1.42M|    if (p_tcp->tccps != 00) {
  ------------------
  |  Branch (9339:9): [True: 1.42M, False: 3.34k]
  ------------------
 9340|  1.42M|        opj_free(p_tcp->tccps);
 9341|  1.42M|        p_tcp->tccps = 00;
 9342|  1.42M|    }
 9343|       |
 9344|  1.42M|    if (p_tcp->m_mct_coding_matrix != 00) {
  ------------------
  |  Branch (9344:9): [True: 0, False: 1.42M]
  ------------------
 9345|      0|        opj_free(p_tcp->m_mct_coding_matrix);
 9346|      0|        p_tcp->m_mct_coding_matrix = 00;
 9347|      0|    }
 9348|       |
 9349|  1.42M|    if (p_tcp->m_mct_decoding_matrix != 00) {
  ------------------
  |  Branch (9349:9): [True: 0, False: 1.42M]
  ------------------
 9350|      0|        opj_free(p_tcp->m_mct_decoding_matrix);
 9351|      0|        p_tcp->m_mct_decoding_matrix = 00;
 9352|      0|    }
 9353|       |
 9354|  1.42M|    if (p_tcp->m_mcc_records) {
  ------------------
  |  Branch (9354:9): [True: 1.15M, False: 277k]
  ------------------
 9355|  1.15M|        opj_free(p_tcp->m_mcc_records);
 9356|  1.15M|        p_tcp->m_mcc_records = 00;
 9357|  1.15M|        p_tcp->m_nb_max_mcc_records = 0;
 9358|  1.15M|        p_tcp->m_nb_mcc_records = 0;
 9359|  1.15M|    }
 9360|       |
 9361|  1.42M|    if (p_tcp->m_mct_records) {
  ------------------
  |  Branch (9361:9): [True: 1.15M, False: 277k]
  ------------------
 9362|  1.15M|        opj_mct_data_t * l_mct_data = p_tcp->m_mct_records;
 9363|  1.15M|        OPJ_UINT32 i;
 9364|       |
 9365|  1.30M|        for (i = 0; i < p_tcp->m_nb_mct_records; ++i) {
  ------------------
  |  Branch (9365:21): [True: 153k, False: 1.15M]
  ------------------
 9366|   153k|            if (l_mct_data->m_data) {
  ------------------
  |  Branch (9366:17): [True: 4.13k, False: 149k]
  ------------------
 9367|  4.13k|                opj_free(l_mct_data->m_data);
 9368|  4.13k|                l_mct_data->m_data = 00;
 9369|  4.13k|            }
 9370|       |
 9371|   153k|            ++l_mct_data;
 9372|   153k|        }
 9373|       |
 9374|  1.15M|        opj_free(p_tcp->m_mct_records);
 9375|  1.15M|        p_tcp->m_mct_records = 00;
 9376|  1.15M|    }
 9377|       |
 9378|  1.42M|    if (p_tcp->mct_norms != 00) {
  ------------------
  |  Branch (9378:9): [True: 0, False: 1.42M]
  ------------------
 9379|      0|        opj_free(p_tcp->mct_norms);
 9380|      0|        p_tcp->mct_norms = 00;
 9381|      0|    }
 9382|       |
 9383|  1.42M|    opj_j2k_tcp_data_destroy(p_tcp);
 9384|       |
 9385|  1.42M|}
j2k.c:opj_j2k_cp_destroy:
 9397|  9.22k|{
 9398|  9.22k|    OPJ_UINT32 l_nb_tiles;
 9399|  9.22k|    opj_tcp_t * l_current_tile = 00;
 9400|       |
 9401|  9.22k|    if (p_cp == 00) {
  ------------------
  |  Branch (9401:9): [True: 0, False: 9.22k]
  ------------------
 9402|      0|        return;
 9403|      0|    }
 9404|  9.22k|    if (p_cp->tcps != 00) {
  ------------------
  |  Branch (9404:9): [True: 7.56k, False: 1.65k]
  ------------------
 9405|  7.56k|        OPJ_UINT32 i;
 9406|  7.56k|        l_current_tile = p_cp->tcps;
 9407|  7.56k|        l_nb_tiles = p_cp->th * p_cp->tw;
 9408|       |
 9409|  1.42M|        for (i = 0U; i < l_nb_tiles; ++i) {
  ------------------
  |  Branch (9409:22): [True: 1.41M, False: 7.56k]
  ------------------
 9410|  1.41M|            opj_j2k_tcp_destroy(l_current_tile);
 9411|  1.41M|            ++l_current_tile;
 9412|  1.41M|        }
 9413|  7.56k|        opj_free(p_cp->tcps);
 9414|  7.56k|        p_cp->tcps = 00;
 9415|  7.56k|    }
 9416|  9.22k|    if (p_cp->ppm_markers != 00) {
  ------------------
  |  Branch (9416:9): [True: 64, False: 9.16k]
  ------------------
 9417|     64|        OPJ_UINT32 i;
 9418|  6.28k|        for (i = 0U; i < p_cp->ppm_markers_count; ++i) {
  ------------------
  |  Branch (9418:22): [True: 6.21k, False: 64]
  ------------------
 9419|  6.21k|            if (p_cp->ppm_markers[i].m_data != NULL) {
  ------------------
  |  Branch (9419:17): [True: 172, False: 6.04k]
  ------------------
 9420|    172|                opj_free(p_cp->ppm_markers[i].m_data);
 9421|    172|            }
 9422|  6.21k|        }
 9423|     64|        p_cp->ppm_markers_count = 0U;
 9424|     64|        opj_free(p_cp->ppm_markers);
 9425|     64|        p_cp->ppm_markers = NULL;
 9426|     64|    }
 9427|  9.22k|    opj_free(p_cp->ppm_buffer);
 9428|  9.22k|    p_cp->ppm_buffer = 00;
 9429|  9.22k|    p_cp->ppm_data =
 9430|  9.22k|        NULL; /* ppm_data belongs to the allocated buffer pointed by ppm_buffer */
 9431|  9.22k|    opj_free(p_cp->comment);
 9432|  9.22k|    p_cp->comment = 00;
 9433|  9.22k|    if (! p_cp->m_is_decoder) {
  ------------------
  |  Branch (9433:9): [True: 0, False: 9.22k]
  ------------------
 9434|      0|        opj_free(p_cp->m_specific_param.m_enc.m_matrice);
 9435|      0|        p_cp->m_specific_param.m_enc.m_matrice = 00;
 9436|      0|    }
 9437|  9.22k|}
j2k.c:opj_j2k_get_marker_handler:
 9197|   398k|{
 9198|   398k|    const opj_dec_memory_marker_handler_t *e;
 9199|  6.53M|    for (e = j2k_memory_marker_handler_tab; e->id != 0; ++e) {
  ------------------
  |  Branch (9199:45): [True: 6.33M, False: 204k]
  ------------------
 9200|  6.33M|        if (e->id == p_id) {
  ------------------
  |  Branch (9200:13): [True: 193k, False: 6.14M]
  ------------------
 9201|   193k|            break; /* we find a handler corresponding to the marker ID*/
 9202|   193k|        }
 9203|  6.33M|    }
 9204|   398k|    return e;
 9205|   398k|}
j2k.c:opj_j2k_read_sot:
 4378|  7.44k|{
 4379|  7.44k|    opj_cp_t *l_cp = 00;
 4380|  7.44k|    opj_tcp_t *l_tcp = 00;
 4381|  7.44k|    OPJ_UINT32 l_tot_len, l_num_parts = 0;
 4382|  7.44k|    OPJ_UINT32 l_current_part;
 4383|  7.44k|    OPJ_UINT32 l_tile_x, l_tile_y;
 4384|       |
 4385|       |    /* preconditions */
 4386|       |
 4387|  7.44k|    assert(p_j2k != 00);
 4388|  7.44k|    assert(p_manager != 00);
 4389|       |
 4390|  7.44k|    if (! opj_j2k_get_sot_values(p_header_data, p_header_size,
  ------------------
  |  Branch (4390:9): [True: 10, False: 7.43k]
  ------------------
 4391|  7.44k|                                 &(p_j2k->m_current_tile_number), &l_tot_len, &l_current_part, &l_num_parts,
 4392|  7.44k|                                 p_manager)) {
 4393|     10|        opj_event_msg(p_manager, EVT_ERROR, "Error reading SOT marker\n");
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4394|     10|        return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
 4395|     10|    }
 4396|       |#ifdef DEBUG_VERBOSE
 4397|       |    fprintf(stderr, "SOT %d %d %d %d\n",
 4398|       |            p_j2k->m_current_tile_number, l_tot_len, l_current_part, l_num_parts);
 4399|       |#endif
 4400|       |
 4401|  7.43k|    l_cp = &(p_j2k->m_cp);
 4402|       |
 4403|       |    /* testcase 2.pdf.SIGFPE.706.1112 */
 4404|  7.43k|    if (p_j2k->m_current_tile_number >= l_cp->tw * l_cp->th) {
  ------------------
  |  Branch (4404:9): [True: 18, False: 7.42k]
  ------------------
 4405|     18|        opj_event_msg(p_manager, EVT_ERROR, "Invalid tile number %d\n",
  ------------------
  |  |   66|     18|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4406|     18|                      p_j2k->m_current_tile_number);
 4407|     18|        return OPJ_FALSE;
  ------------------
  |  |  118|     18|#define OPJ_FALSE 0
  ------------------
 4408|     18|    }
 4409|       |
 4410|  7.42k|    l_tcp = &l_cp->tcps[p_j2k->m_current_tile_number];
 4411|  7.42k|    l_tile_x = p_j2k->m_current_tile_number % l_cp->tw;
 4412|  7.42k|    l_tile_y = p_j2k->m_current_tile_number / l_cp->tw;
 4413|       |
 4414|  7.42k|    if (p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec < 0 ||
  ------------------
  |  Branch (4414:9): [True: 7.42k, False: 0]
  ------------------
 4415|  7.42k|            p_j2k->m_current_tile_number == (OPJ_UINT32)
  ------------------
  |  Branch (4415:13): [True: 0, False: 0]
  ------------------
 4416|  7.42k|            p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec) {
 4417|       |        /* Do only this check if we decode all tile part headers, or if */
 4418|       |        /* we decode one precise tile. Otherwise the m_current_tile_part_number */
 4419|       |        /* might not be valid */
 4420|       |        /* Fixes issue with id_000020,sig_06,src_001958,op_flip4,pos_149 */
 4421|       |        /* of https://github.com/uclouvain/openjpeg/issues/939 */
 4422|       |        /* We must avoid reading twice the same tile part number for a given tile */
 4423|       |        /* so as to avoid various issues, like opj_j2k_merge_ppt being called */
 4424|       |        /* several times. */
 4425|       |        /* ISO 15444-1 A.4.2 Start of tile-part (SOT) mandates that tile parts */
 4426|       |        /* should appear in increasing order. */
 4427|  7.42k|        if (l_tcp->m_current_tile_part_number + 1 != (OPJ_INT32)l_current_part) {
  ------------------
  |  Branch (4427:13): [True: 21, False: 7.40k]
  ------------------
 4428|     21|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     21|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4429|     21|                          "Invalid tile part index for tile number %d. "
 4430|     21|                          "Got %d, expected %d\n",
 4431|     21|                          p_j2k->m_current_tile_number,
 4432|     21|                          l_current_part,
 4433|     21|                          l_tcp->m_current_tile_part_number + 1);
 4434|     21|            return OPJ_FALSE;
  ------------------
  |  |  118|     21|#define OPJ_FALSE 0
  ------------------
 4435|     21|        }
 4436|  7.42k|    }
 4437|       |
 4438|  7.40k|    l_tcp->m_current_tile_part_number = (OPJ_INT32) l_current_part;
 4439|       |
 4440|       |#ifdef USE_JPWL
 4441|       |    if (l_cp->correct) {
 4442|       |
 4443|       |        OPJ_UINT32 tileno = p_j2k->m_current_tile_number;
 4444|       |        static OPJ_UINT32 backup_tileno = 0;
 4445|       |
 4446|       |        /* tileno is negative or larger than the number of tiles!!! */
 4447|       |        if (tileno > (l_cp->tw * l_cp->th)) {
 4448|       |            opj_event_msg(p_manager, EVT_ERROR,
 4449|       |                          "JPWL: bad tile number (%d out of a maximum of %d)\n",
 4450|       |                          tileno, (l_cp->tw * l_cp->th));
 4451|       |            if (!JPWL_ASSUME) {
 4452|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 4453|       |                return OPJ_FALSE;
 4454|       |            }
 4455|       |            /* we try to correct */
 4456|       |            tileno = backup_tileno;
 4457|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust this\n"
 4458|       |                          "- setting tile number to %d\n",
 4459|       |                          tileno);
 4460|       |        }
 4461|       |
 4462|       |        /* keep your private count of tiles */
 4463|       |        backup_tileno++;
 4464|       |    };
 4465|       |#endif /* USE_JPWL */
 4466|       |
 4467|       |    /* look for the tile in the list of already processed tile (in parts). */
 4468|       |    /* Optimization possible here with a more complex data structure and with the removing of tiles */
 4469|       |    /* since the time taken by this function can only grow at the time */
 4470|       |
 4471|       |    /* PSot should be equal to zero or >=14 or <= 2^32-1 */
 4472|  7.40k|    if ((l_tot_len != 0) && (l_tot_len < 14)) {
  ------------------
  |  Branch (4472:9): [True: 989, False: 6.41k]
  |  Branch (4472:29): [True: 10, False: 979]
  ------------------
 4473|     10|        if (l_tot_len ==
  ------------------
  |  Branch (4473:13): [True: 8, False: 2]
  ------------------
 4474|     10|                12) { /* MSD: Special case for the PHR data which are read by kakadu*/
 4475|      8|            opj_event_msg(p_manager, EVT_WARNING, "Empty SOT marker detected: Psot=%d.\n",
  ------------------
  |  |   67|      8|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 4476|      8|                          l_tot_len);
 4477|      8|        } else {
 4478|      2|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4479|      2|                          "Psot value is not correct regards to the JPEG2000 norm: %d.\n", l_tot_len);
 4480|      2|            return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 4481|      2|        }
 4482|     10|    }
 4483|       |
 4484|       |#ifdef USE_JPWL
 4485|       |    if (l_cp->correct) {
 4486|       |
 4487|       |        /* totlen is negative or larger than the bytes left!!! */
 4488|       |        if (/*(l_tot_len < 0) ||*/ (l_tot_len >
 4489|       |                                    p_header_size)) {   /* FIXME it seems correct; for info in V1 -> (p_stream_numbytesleft(p_stream) + 8))) { */
 4490|       |            opj_event_msg(p_manager, EVT_ERROR,
 4491|       |                          "JPWL: bad tile byte size (%d bytes against %d bytes left)\n",
 4492|       |                          l_tot_len,
 4493|       |                          p_header_size);  /* FIXME it seems correct; for info in V1 -> p_stream_numbytesleft(p_stream) + 8); */
 4494|       |            if (!JPWL_ASSUME) {
 4495|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 4496|       |                return OPJ_FALSE;
 4497|       |            }
 4498|       |            /* we try to correct */
 4499|       |            l_tot_len = 0;
 4500|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust this\n"
 4501|       |                          "- setting Psot to %d => assuming it is the last tile\n",
 4502|       |                          l_tot_len);
 4503|       |        }
 4504|       |    };
 4505|       |#endif /* USE_JPWL */
 4506|       |
 4507|       |    /* Ref A.4.2: Psot could be equal zero if it is the last tile-part of the codestream.*/
 4508|  7.39k|    if (!l_tot_len) {
  ------------------
  |  Branch (4508:9): [True: 6.41k, False: 987]
  ------------------
 4509|  6.41k|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|  6.41k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 4510|  6.41k|                      "Psot value of the current tile-part is equal to zero, "
 4511|  6.41k|                      "we assuming it is the last tile-part of the codestream.\n");
 4512|  6.41k|        p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
 4513|  6.41k|    }
 4514|       |
 4515|  7.39k|    if (l_tcp->m_nb_tile_parts != 0 && l_current_part >= l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (4515:9): [True: 22, False: 7.37k]
  |  Branch (4515:40): [True: 1, False: 21]
  ------------------
 4516|       |        /* Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2851 */
 4517|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4518|      1|                      "In SOT marker, TPSot (%d) is not valid regards to the previous "
 4519|      1|                      "number of tile-part (%d), giving up\n", l_current_part,
 4520|      1|                      l_tcp->m_nb_tile_parts);
 4521|      1|        p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
 4522|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 4523|      1|    }
 4524|       |
 4525|  7.39k|    if (l_num_parts !=
  ------------------
  |  Branch (4525:9): [True: 4.15k, False: 3.24k]
  ------------------
 4526|  7.39k|            0) { /* Number of tile-part header is provided by this tile-part header */
 4527|  4.15k|        l_num_parts += p_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction;
 4528|       |        /* Useful to manage the case of textGBR.jp2 file because two values of TNSot are allowed: the correct numbers of
 4529|       |         * tile-parts for that tile and zero (A.4.2 of 15444-1 : 2002). */
 4530|  4.15k|        if (l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (4530:13): [True: 20, False: 4.13k]
  ------------------
 4531|     20|            if (l_current_part >= l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (4531:17): [True: 0, False: 20]
  ------------------
 4532|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4533|      0|                              "In SOT marker, TPSot (%d) is not valid regards to the current "
 4534|      0|                              "number of tile-part (%d), giving up\n", l_current_part,
 4535|      0|                              l_tcp->m_nb_tile_parts);
 4536|      0|                p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
 4537|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4538|      0|            }
 4539|     20|        }
 4540|  4.15k|        if (l_current_part >= l_num_parts) {
  ------------------
  |  Branch (4540:13): [True: 1, False: 4.14k]
  ------------------
 4541|       |            /* testcase 451.pdf.SIGSEGV.ce9.3723 */
 4542|      1|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4543|      1|                          "In SOT marker, TPSot (%d) is not valid regards to the current "
 4544|      1|                          "number of tile-part (header) (%d), giving up\n", l_current_part, l_num_parts);
 4545|      1|            p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
 4546|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 4547|      1|        }
 4548|  4.14k|        l_tcp->m_nb_tile_parts = l_num_parts;
 4549|  4.14k|    }
 4550|       |
 4551|       |    /* If know the number of tile part header we will check if we didn't read the last*/
 4552|  7.39k|    if (l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (4552:9): [True: 4.15k, False: 3.24k]
  ------------------
 4553|  4.15k|        if (l_tcp->m_nb_tile_parts == (l_current_part + 1)) {
  ------------------
  |  Branch (4553:13): [True: 1.59k, False: 2.55k]
  ------------------
 4554|  1.59k|            p_j2k->m_specific_param.m_decoder.m_can_decode =
 4555|  1.59k|                1; /* Process the last tile-part header*/
 4556|  1.59k|        }
 4557|  4.15k|    }
 4558|       |
 4559|  7.39k|    if (!p_j2k->m_specific_param.m_decoder.m_last_tile_part) {
  ------------------
  |  Branch (4559:9): [True: 987, False: 6.40k]
  ------------------
 4560|       |        /* Keep the size of data to skip after this marker */
 4561|    987|        p_j2k->m_specific_param.m_decoder.m_sot_length = l_tot_len -
 4562|    987|                12; /* SOT_marker_size = 12 */
 4563|  6.40k|    } else {
 4564|       |        /* FIXME: need to be computed from the number of bytes remaining in the codestream */
 4565|  6.40k|        p_j2k->m_specific_param.m_decoder.m_sot_length = 0;
 4566|  6.40k|    }
 4567|       |
 4568|  7.39k|    p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPH;
 4569|       |
 4570|       |    /* Check if the current tile is outside the area we want decode or not corresponding to the tile index*/
 4571|  7.39k|    if (p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec == -1) {
  ------------------
  |  Branch (4571:9): [True: 7.39k, False: 0]
  ------------------
 4572|  7.39k|        p_j2k->m_specific_param.m_decoder.m_skip_data =
 4573|  7.39k|            (l_tile_x < p_j2k->m_specific_param.m_decoder.m_start_tile_x)
  ------------------
  |  Branch (4573:13): [True: 0, False: 7.39k]
  ------------------
 4574|  7.39k|            || (l_tile_x >= p_j2k->m_specific_param.m_decoder.m_end_tile_x)
  ------------------
  |  Branch (4574:16): [True: 137, False: 7.25k]
  ------------------
 4575|  7.39k|            || (l_tile_y < p_j2k->m_specific_param.m_decoder.m_start_tile_y)
  ------------------
  |  Branch (4575:16): [True: 0, False: 7.25k]
  ------------------
 4576|  7.39k|            || (l_tile_y >= p_j2k->m_specific_param.m_decoder.m_end_tile_y);
  ------------------
  |  Branch (4576:16): [True: 30, False: 7.22k]
  ------------------
 4577|  7.39k|    } else {
 4578|      0|        assert(p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec >= 0);
 4579|      0|        p_j2k->m_specific_param.m_decoder.m_skip_data =
 4580|      0|            (p_j2k->m_current_tile_number != (OPJ_UINT32)
 4581|      0|             p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec);
 4582|      0|    }
 4583|       |
 4584|       |    /* Index */
 4585|  7.39k|    if (p_j2k->cstr_index) {
  ------------------
  |  Branch (4585:9): [True: 7.39k, False: 0]
  ------------------
 4586|  7.39k|        assert(p_j2k->cstr_index->tile_index != 00);
 4587|  7.39k|        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tileno =
 4588|  7.39k|            p_j2k->m_current_tile_number;
 4589|  7.39k|        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_tpsno =
 4590|  7.39k|            l_current_part;
 4591|       |
 4592|  7.39k|        if (l_num_parts != 0) {
  ------------------
  |  Branch (4592:13): [True: 4.14k, False: 3.24k]
  ------------------
 4593|  4.14k|            p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].nb_tps =
 4594|  4.14k|                l_num_parts;
 4595|  4.14k|            p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps =
 4596|  4.14k|                l_num_parts;
 4597|       |
 4598|  4.14k|            if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index) {
  ------------------
  |  Branch (4598:17): [True: 4.13k, False: 19]
  ------------------
 4599|  4.13k|                p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index =
 4600|  4.13k|                    (opj_tp_index_t*)opj_calloc(l_num_parts, sizeof(opj_tp_index_t));
 4601|  4.13k|                if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index) {
  ------------------
  |  Branch (4601:21): [True: 0, False: 4.13k]
  ------------------
 4602|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4603|      0|                                  "Not enough memory to read SOT marker. Tile index allocation failed\n");
 4604|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4605|      0|                }
 4606|  4.13k|            } else {
 4607|     19|                opj_tp_index_t *new_tp_index = (opj_tp_index_t *) opj_realloc(
 4608|     19|                                                   p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index,
 4609|     19|                                                   l_num_parts * sizeof(opj_tp_index_t));
 4610|     19|                if (! new_tp_index) {
  ------------------
  |  Branch (4610:21): [True: 0, False: 19]
  ------------------
 4611|      0|                    opj_free(p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index);
 4612|      0|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index = NULL;
 4613|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4614|      0|                                  "Not enough memory to read SOT marker. Tile index allocation failed\n");
 4615|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4616|      0|                }
 4617|     19|                p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index =
 4618|     19|                    new_tp_index;
 4619|     19|            }
 4620|  4.14k|        } else {
 4621|  3.24k|            /*if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index)*/ {
 4622|       |
 4623|  3.24k|                if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index) {
  ------------------
  |  Branch (4623:21): [True: 3.24k, False: 1]
  ------------------
 4624|  3.24k|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps = 10;
 4625|  3.24k|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index =
 4626|  3.24k|                        (opj_tp_index_t*)opj_calloc(
 4627|  3.24k|                            p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps,
 4628|  3.24k|                            sizeof(opj_tp_index_t));
 4629|  3.24k|                    if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index) {
  ------------------
  |  Branch (4629:25): [True: 0, False: 3.24k]
  ------------------
 4630|      0|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps = 0;
 4631|      0|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4632|      0|                                      "Not enough memory to read SOT marker. Tile index allocation failed\n");
 4633|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4634|      0|                    }
 4635|  3.24k|                }
 4636|       |
 4637|  3.24k|                if (l_current_part >=
  ------------------
  |  Branch (4637:21): [True: 0, False: 3.24k]
  ------------------
 4638|  3.24k|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps) {
 4639|      0|                    opj_tp_index_t *new_tp_index;
 4640|      0|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps =
 4641|      0|                        l_current_part + 1;
 4642|      0|                    new_tp_index = (opj_tp_index_t *) opj_realloc(
 4643|      0|                                       p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index,
 4644|      0|                                       p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps *
 4645|      0|                                       sizeof(opj_tp_index_t));
 4646|      0|                    if (! new_tp_index) {
  ------------------
  |  Branch (4646:25): [True: 0, False: 0]
  ------------------
 4647|      0|                        opj_free(p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index);
 4648|      0|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index = NULL;
 4649|      0|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps = 0;
 4650|      0|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4651|      0|                                      "Not enough memory to read SOT marker. Tile index allocation failed\n");
 4652|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4653|      0|                    }
 4654|      0|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index =
 4655|      0|                        new_tp_index;
 4656|      0|                }
 4657|  3.24k|            }
 4658|       |
 4659|  3.24k|        }
 4660|       |
 4661|  7.39k|    }
 4662|       |
 4663|       |    /* FIXME move this onto a separate method to call before reading any SOT, remove part about main_end header, use a index struct inside p_j2k */
 4664|       |    /* if (p_j2k->cstr_info) {
 4665|       |       if (l_tcp->first) {
 4666|       |       if (tileno == 0) {
 4667|       |       p_j2k->cstr_info->main_head_end = p_stream_tell(p_stream) - 13;
 4668|       |       }
 4669|       |
 4670|       |       p_j2k->cstr_info->tile[tileno].tileno = tileno;
 4671|       |       p_j2k->cstr_info->tile[tileno].start_pos = p_stream_tell(p_stream) - 12;
 4672|       |       p_j2k->cstr_info->tile[tileno].end_pos = p_j2k->cstr_info->tile[tileno].start_pos + totlen - 1;
 4673|       |       p_j2k->cstr_info->tile[tileno].num_tps = numparts;
 4674|       |
 4675|       |       if (numparts) {
 4676|       |       p_j2k->cstr_info->tile[tileno].tp = (opj_tp_info_t *) opj_malloc(numparts * sizeof(opj_tp_info_t));
 4677|       |       }
 4678|       |       else {
 4679|       |       p_j2k->cstr_info->tile[tileno].tp = (opj_tp_info_t *) opj_malloc(10 * sizeof(opj_tp_info_t)); // Fixme (10)
 4680|       |       }
 4681|       |       }
 4682|       |       else {
 4683|       |       p_j2k->cstr_info->tile[tileno].end_pos += totlen;
 4684|       |       }
 4685|       |
 4686|       |       p_j2k->cstr_info->tile[tileno].tp[partno].tp_start_pos = p_stream_tell(p_stream) - 12;
 4687|       |       p_j2k->cstr_info->tile[tileno].tp[partno].tp_end_pos =
 4688|       |       p_j2k->cstr_info->tile[tileno].tp[partno].tp_start_pos + totlen - 1;
 4689|       |       }*/
 4690|  7.39k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.39k|#define OPJ_TRUE 1
  ------------------
 4691|  7.39k|}
j2k.c:opj_j2k_get_sot_values:
 4352|  8.05k|{
 4353|       |    /* preconditions */
 4354|  8.05k|    assert(p_header_data != 00);
 4355|  8.05k|    assert(p_manager != 00);
 4356|       |
 4357|       |    /* Size of this marker is fixed = 12 (we have already read marker and its size)*/
 4358|  8.05k|    if (p_header_size != 8) {
  ------------------
  |  Branch (4358:9): [True: 10, False: 8.04k]
  ------------------
 4359|     10|        opj_event_msg(p_manager, EVT_ERROR, "Error reading SOT marker\n");
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4360|     10|        return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
 4361|     10|    }
 4362|       |
 4363|  8.04k|    opj_read_bytes(p_header_data, p_tile_no, 2);    /* Isot */
  ------------------
  |  |   65|  8.04k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4364|  8.04k|    p_header_data += 2;
 4365|  8.04k|    opj_read_bytes(p_header_data, p_tot_len, 4);    /* Psot */
  ------------------
  |  |   65|  8.04k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4366|  8.04k|    p_header_data += 4;
 4367|  8.04k|    opj_read_bytes(p_header_data, p_current_part, 1); /* TPsot */
  ------------------
  |  |   65|  8.04k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4368|  8.04k|    ++p_header_data;
 4369|  8.04k|    opj_read_bytes(p_header_data, p_num_parts, 1);  /* TNsot */
  ------------------
  |  |   65|  8.04k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4370|  8.04k|    ++p_header_data;
 4371|  8.04k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.04k|#define OPJ_TRUE 1
  ------------------
 4372|  8.05k|}
j2k.c:opj_j2k_read_cod:
 2667|  10.0k|{
 2668|       |    /* loop */
 2669|  10.0k|    OPJ_UINT32 i;
 2670|  10.0k|    OPJ_UINT32 l_tmp;
 2671|  10.0k|    opj_cp_t *l_cp = 00;
 2672|  10.0k|    opj_tcp_t *l_tcp = 00;
 2673|  10.0k|    opj_image_t *l_image = 00;
 2674|       |
 2675|       |    /* preconditions */
 2676|  10.0k|    assert(p_header_data != 00);
 2677|  10.0k|    assert(p_j2k != 00);
 2678|  10.0k|    assert(p_manager != 00);
 2679|       |
 2680|  10.0k|    l_image = p_j2k->m_private_image;
 2681|  10.0k|    l_cp = &(p_j2k->m_cp);
 2682|       |
 2683|       |    /* If we are in the first tile-part header of the current tile */
 2684|  10.0k|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ?
  ------------------
  |  Branch (2684:13): [True: 2.10k, False: 7.94k]
  ------------------
 2685|  2.10k|            &l_cp->tcps[p_j2k->m_current_tile_number] :
 2686|  10.0k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 2687|       |
 2688|       |#if 0
 2689|       |    /* This check was added per https://github.com/uclouvain/openjpeg/commit/daed8cc9195555e101ab708a501af2dfe6d5e001 */
 2690|       |    /* but this is no longer necessary to handle issue476.jp2 */
 2691|       |    /* and this actually cause issues on legit files. See https://github.com/uclouvain/openjpeg/issues/1043 */
 2692|       |    /* Only one COD per tile */
 2693|       |    if (l_tcp->cod) {
 2694|       |        opj_event_msg(p_manager, EVT_ERROR,
 2695|       |                      "COD marker already read. No more than one COD marker per tile.\n");
 2696|       |        return OPJ_FALSE;
 2697|       |    }
 2698|       |#endif
 2699|  10.0k|    l_tcp->cod = 1;
 2700|       |
 2701|       |    /* Make sure room is sufficient */
 2702|  10.0k|    if (p_header_size < 5) {
  ------------------
  |  Branch (2702:9): [True: 3, False: 10.0k]
  ------------------
 2703|      3|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COD marker\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2704|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 2705|      3|    }
 2706|       |
 2707|  10.0k|    opj_read_bytes(p_header_data, &l_tcp->csty, 1);         /* Scod */
  ------------------
  |  |   65|  10.0k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2708|  10.0k|    ++p_header_data;
 2709|       |    /* Make sure we know how to decode this */
 2710|  10.0k|    if ((l_tcp->csty & ~(OPJ_UINT32)(J2K_CP_CSTY_PRT | J2K_CP_CSTY_SOP |
  ------------------
  |  |   54|  10.0k|#define J2K_CP_CSTY_PRT 0x01
  ------------------
                  if ((l_tcp->csty & ~(OPJ_UINT32)(J2K_CP_CSTY_PRT | J2K_CP_CSTY_SOP |
  ------------------
  |  |   55|  10.0k|#define J2K_CP_CSTY_SOP 0x02
  ------------------
  |  Branch (2710:9): [True: 1, False: 10.0k]
  ------------------
 2711|  10.0k|                                     J2K_CP_CSTY_EPH)) != 0U) {
  ------------------
  |  |   56|  10.0k|#define J2K_CP_CSTY_EPH 0x04
  ------------------
 2712|      1|        opj_event_msg(p_manager, EVT_ERROR, "Unknown Scod value in COD marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2713|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 2714|      1|    }
 2715|  10.0k|    opj_read_bytes(p_header_data, &l_tmp, 1);                       /* SGcod (A) */
  ------------------
  |  |   65|  10.0k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2716|  10.0k|    ++p_header_data;
 2717|  10.0k|    l_tcp->prg = (OPJ_PROG_ORDER) l_tmp;
 2718|       |    /* Make sure progression order is valid */
 2719|  10.0k|    if (l_tcp->prg > OPJ_CPRL) {
  ------------------
  |  Branch (2719:9): [True: 311, False: 9.72k]
  ------------------
 2720|    311|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    311|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2721|    311|                      "Unknown progression order in COD marker\n");
 2722|    311|        l_tcp->prg = OPJ_PROG_UNKNOWN;
 2723|    311|    }
 2724|  10.0k|    opj_read_bytes(p_header_data, &l_tcp->numlayers, 2);    /* SGcod (B) */
  ------------------
  |  |   65|  10.0k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2725|  10.0k|    p_header_data += 2;
 2726|       |
 2727|  10.0k|    if ((l_tcp->numlayers < 1U) || (l_tcp->numlayers > 65535U)) {
  ------------------
  |  Branch (2727:9): [True: 1, False: 10.0k]
  |  Branch (2727:36): [True: 0, False: 10.0k]
  ------------------
 2728|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2729|      1|                      "Invalid number of layers in COD marker : %d not in range [1-65535]\n",
 2730|      1|                      l_tcp->numlayers);
 2731|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 2732|      1|    }
 2733|       |
 2734|       |    /* If user didn't set a number layer to decode take the max specify in the codestream. */
 2735|  10.0k|    if (l_cp->m_specific_param.m_dec.m_layer) {
  ------------------
  |  Branch (2735:9): [True: 0, False: 10.0k]
  ------------------
 2736|      0|        l_tcp->num_layers_to_decode = l_cp->m_specific_param.m_dec.m_layer;
 2737|  10.0k|    } else {
 2738|  10.0k|        l_tcp->num_layers_to_decode = l_tcp->numlayers;
 2739|  10.0k|    }
 2740|       |
 2741|  10.0k|    opj_read_bytes(p_header_data, &l_tcp->mct, 1);          /* SGcod (C) */
  ------------------
  |  |   65|  10.0k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2742|  10.0k|    ++p_header_data;
 2743|       |
 2744|  10.0k|    if (l_tcp->mct > 1) {
  ------------------
  |  Branch (2744:9): [True: 7, False: 10.0k]
  ------------------
 2745|      7|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      7|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2746|      7|                      "Invalid multiple component transformation\n");
 2747|      7|        return OPJ_FALSE;
  ------------------
  |  |  118|      7|#define OPJ_FALSE 0
  ------------------
 2748|      7|    }
 2749|       |
 2750|  10.0k|    p_header_size -= 5;
 2751|  92.3k|    for (i = 0; i < l_image->numcomps; ++i) {
  ------------------
  |  Branch (2751:17): [True: 82.2k, False: 10.0k]
  ------------------
 2752|  82.2k|        l_tcp->tccps[i].csty = l_tcp->csty & J2K_CCP_CSTY_PRT;
  ------------------
  |  |   57|  82.2k|#define J2K_CCP_CSTY_PRT 0x01
  ------------------
 2753|  82.2k|    }
 2754|       |
 2755|  10.0k|    if (! opj_j2k_read_SPCod_SPCoc(p_j2k, 0, p_header_data, &p_header_size,
  ------------------
  |  Branch (2755:9): [True: 23, False: 10.0k]
  ------------------
 2756|  10.0k|                                   p_manager)) {
 2757|     23|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COD marker\n");
  ------------------
  |  |   66|     23|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2758|     23|        return OPJ_FALSE;
  ------------------
  |  |  118|     23|#define OPJ_FALSE 0
  ------------------
 2759|     23|    }
 2760|       |
 2761|  10.0k|    if (p_header_size != 0) {
  ------------------
  |  Branch (2761:9): [True: 2, False: 10.0k]
  ------------------
 2762|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COD marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2763|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 2764|      2|    }
 2765|       |
 2766|       |    /* Apply the coding style to other components of the current tile or the m_default_tcp*/
 2767|  10.0k|    opj_j2k_copy_tile_component_parameters(p_j2k);
 2768|       |
 2769|       |    /* Index */
 2770|       |#ifdef WIP_REMOVE_MSD
 2771|       |    if (p_j2k->cstr_info) {
 2772|       |        /*opj_codestream_info_t *l_cstr_info = p_j2k->cstr_info;*/
 2773|       |        p_j2k->cstr_info->prog = l_tcp->prg;
 2774|       |        p_j2k->cstr_info->numlayers = l_tcp->numlayers;
 2775|       |        p_j2k->cstr_info->numdecompos = (OPJ_INT32*) opj_malloc(
 2776|       |                                            l_image->numcomps * sizeof(OPJ_UINT32));
 2777|       |        if (!p_j2k->cstr_info->numdecompos) {
 2778|       |            return OPJ_FALSE;
 2779|       |        }
 2780|       |        for (i = 0; i < l_image->numcomps; ++i) {
 2781|       |            p_j2k->cstr_info->numdecompos[i] = l_tcp->tccps[i].numresolutions - 1;
 2782|       |        }
 2783|       |    }
 2784|       |#endif
 2785|       |
 2786|  10.0k|    return OPJ_TRUE;
  ------------------
  |  |  117|  10.0k|#define OPJ_TRUE 1
  ------------------
 2787|  10.0k|}
j2k.c:opj_j2k_read_SPCod_SPCoc:
10683|  10.4k|{
10684|  10.4k|    OPJ_UINT32 i, l_tmp;
10685|  10.4k|    opj_cp_t *l_cp = NULL;
10686|  10.4k|    opj_tcp_t *l_tcp = NULL;
10687|  10.4k|    opj_tccp_t *l_tccp = NULL;
10688|  10.4k|    OPJ_BYTE * l_current_ptr = NULL;
10689|       |
10690|       |    /* preconditions */
10691|  10.4k|    assert(p_j2k != 00);
10692|  10.4k|    assert(p_manager != 00);
10693|  10.4k|    assert(p_header_data != 00);
10694|       |
10695|  10.4k|    l_cp = &(p_j2k->m_cp);
10696|  10.4k|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ?
  ------------------
  |  Branch (10696:13): [True: 2.12k, False: 8.29k]
  ------------------
10697|  2.12k|            &l_cp->tcps[p_j2k->m_current_tile_number] :
10698|  10.4k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
10699|       |
10700|       |    /* precondition again */
10701|  10.4k|    assert(compno < p_j2k->m_private_image->numcomps);
10702|       |
10703|  10.4k|    l_tccp = &l_tcp->tccps[compno];
10704|  10.4k|    l_current_ptr = p_header_data;
10705|       |
10706|       |    /* make sure room is sufficient */
10707|  10.4k|    if (*p_header_size < 5) {
  ------------------
  |  Branch (10707:9): [True: 2, False: 10.4k]
  ------------------
10708|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading SPCod SPCoc element\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10709|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
10710|      2|    }
10711|       |
10712|       |    /* SPcod (D) / SPcoc (A) */
10713|  10.4k|    opj_read_bytes(l_current_ptr, &l_tccp->numresolutions, 1);
  ------------------
  |  |   65|  10.4k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10714|  10.4k|    ++l_tccp->numresolutions;  /* tccp->numresolutions = read() + 1 */
10715|  10.4k|    if (l_tccp->numresolutions > OPJ_J2K_MAXRLVLS) {
  ------------------
  |  |  152|  10.4k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  ------------------
  |  Branch (10715:9): [True: 1, False: 10.4k]
  ------------------
10716|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10717|      1|                      "Invalid value for numresolutions : %d, max value is set in openjpeg.h at %d\n",
10718|      1|                      l_tccp->numresolutions, OPJ_J2K_MAXRLVLS);
  ------------------
  |  |  152|      1|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  ------------------
10719|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
10720|      1|    }
10721|  10.4k|    ++l_current_ptr;
10722|       |
10723|       |    /* If user wants to remove more resolutions than the codestream contains, return error */
10724|  10.4k|    if (l_cp->m_specific_param.m_dec.m_reduce >= l_tccp->numresolutions) {
  ------------------
  |  Branch (10724:9): [True: 0, False: 10.4k]
  ------------------
10725|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10726|      0|                      "Error decoding component %d.\nThe number of resolutions "
10727|      0|                      "to remove (%d) is greater or equal than the number "
10728|      0|                      "of resolutions of this component (%d)\nModify the cp_reduce parameter.\n\n",
10729|      0|                      compno, l_cp->m_specific_param.m_dec.m_reduce, l_tccp->numresolutions);
10730|      0|        p_j2k->m_specific_param.m_decoder.m_state |=
10731|      0|            0x8000;/* FIXME J2K_DEC_STATE_ERR;*/
10732|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10733|      0|    }
10734|       |
10735|       |    /* SPcod (E) / SPcoc (B) */
10736|  10.4k|    opj_read_bytes(l_current_ptr, &l_tccp->cblkw, 1);
  ------------------
  |  |   65|  10.4k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10737|  10.4k|    ++l_current_ptr;
10738|  10.4k|    l_tccp->cblkw += 2;
10739|       |
10740|       |    /* SPcod (F) / SPcoc (C) */
10741|  10.4k|    opj_read_bytes(l_current_ptr, &l_tccp->cblkh, 1);
  ------------------
  |  |   65|  10.4k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10742|  10.4k|    ++l_current_ptr;
10743|  10.4k|    l_tccp->cblkh += 2;
10744|       |
10745|  10.4k|    if ((l_tccp->cblkw > 10) || (l_tccp->cblkh > 10) ||
  ------------------
  |  Branch (10745:9): [True: 2, False: 10.4k]
  |  Branch (10745:33): [True: 6, False: 10.4k]
  ------------------
10746|  10.4k|            ((l_tccp->cblkw + l_tccp->cblkh) > 12)) {
  ------------------
  |  Branch (10746:13): [True: 1, False: 10.4k]
  ------------------
10747|      9|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      9|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10748|      9|                      "Error reading SPCod SPCoc element, Invalid cblkw/cblkh combination\n");
10749|      9|        return OPJ_FALSE;
  ------------------
  |  |  118|      9|#define OPJ_FALSE 0
  ------------------
10750|      9|    }
10751|       |
10752|       |    /* SPcod (G) / SPcoc (D) */
10753|  10.4k|    opj_read_bytes(l_current_ptr, &l_tccp->cblksty, 1);
  ------------------
  |  |   65|  10.4k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10754|  10.4k|    ++l_current_ptr;
10755|  10.4k|    if ((l_tccp->cblksty & J2K_CCP_CBLKSTY_HTMIXED) != 0) {
  ------------------
  |  |   65|  10.4k|#define J2K_CCP_CBLKSTY_HTMIXED 0x80  /**< MIXED mode HT codeblocks */
  ------------------
  |  Branch (10755:9): [True: 2, False: 10.4k]
  ------------------
10756|       |        /* We do not support HT mixed mode yet.  For conformance, it should be supported.*/
10757|      2|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10758|      2|                      "Error reading SPCod SPCoc element. Unsupported Mixed HT code-block style found\n");
10759|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
10760|      2|    }
10761|       |
10762|       |    /* SPcod (H) / SPcoc (E) */
10763|  10.4k|    opj_read_bytes(l_current_ptr, &l_tccp->qmfbid, 1);
  ------------------
  |  |   65|  10.4k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10764|  10.4k|    ++l_current_ptr;
10765|       |
10766|  10.4k|    if (l_tccp->qmfbid > 1) {
  ------------------
  |  Branch (10766:9): [True: 10, False: 10.4k]
  ------------------
10767|     10|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10768|     10|                      "Error reading SPCod SPCoc element, Invalid transformation found\n");
10769|     10|        return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
10770|     10|    }
10771|       |
10772|  10.4k|    *p_header_size = *p_header_size - 5;
10773|       |
10774|       |    /* use custom precinct size ? */
10775|  10.4k|    if (l_tccp->csty & J2K_CCP_CSTY_PRT) {
  ------------------
  |  |   57|  10.4k|#define J2K_CCP_CSTY_PRT 0x01
  ------------------
  |  Branch (10775:9): [True: 312, False: 10.0k]
  ------------------
10776|    312|        if (*p_header_size < l_tccp->numresolutions) {
  ------------------
  |  Branch (10776:13): [True: 1, False: 311]
  ------------------
10777|      1|            opj_event_msg(p_manager, EVT_ERROR, "Error reading SPCod SPCoc element\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10778|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
10779|      1|        }
10780|       |
10781|       |        /* SPcod (I_i) / SPcoc (F_i) */
10782|    963|        for (i = 0; i < l_tccp->numresolutions; ++i) {
  ------------------
  |  Branch (10782:21): [True: 660, False: 303]
  ------------------
10783|    660|            opj_read_bytes(l_current_ptr, &l_tmp, 1);
  ------------------
  |  |   65|    660|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10784|    660|            ++l_current_ptr;
10785|       |            /* Precinct exponent 0 is only allowed for lowest resolution level (Table A.21) */
10786|    660|            if ((i != 0) && (((l_tmp & 0xf) == 0) || ((l_tmp >> 4) == 0))) {
  ------------------
  |  Branch (10786:17): [True: 349, False: 311]
  |  Branch (10786:30): [True: 4, False: 345]
  |  Branch (10786:54): [True: 4, False: 341]
  ------------------
10787|      8|                opj_event_msg(p_manager, EVT_ERROR, "Invalid precinct size\n");
  ------------------
  |  |   66|      8|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10788|      8|                return OPJ_FALSE;
  ------------------
  |  |  118|      8|#define OPJ_FALSE 0
  ------------------
10789|      8|            }
10790|    652|            l_tccp->prcw[i] = l_tmp & 0xf;
10791|    652|            l_tccp->prch[i] = l_tmp >> 4;
10792|    652|        }
10793|       |
10794|    303|        *p_header_size = *p_header_size - l_tccp->numresolutions;
10795|  10.0k|    } else {
10796|       |        /* set default size for the precinct width and height */
10797|  53.0k|        for (i = 0; i < l_tccp->numresolutions; ++i) {
  ------------------
  |  Branch (10797:21): [True: 42.9k, False: 10.0k]
  ------------------
10798|  42.9k|            l_tccp->prcw[i] = 15;
10799|  42.9k|            l_tccp->prch[i] = 15;
10800|  42.9k|        }
10801|  10.0k|    }
10802|       |
10803|       |#ifdef WIP_REMOVE_MSD
10804|       |    /* INDEX >> */
10805|       |    if (p_j2k->cstr_info && compno == 0) {
10806|       |        OPJ_UINT32 l_data_size = l_tccp->numresolutions * sizeof(OPJ_UINT32);
10807|       |
10808|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].cblkh =
10809|       |            l_tccp->cblkh;
10810|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].cblkw =
10811|       |            l_tccp->cblkw;
10812|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].numresolutions
10813|       |            = l_tccp->numresolutions;
10814|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].cblksty =
10815|       |            l_tccp->cblksty;
10816|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].qmfbid =
10817|       |            l_tccp->qmfbid;
10818|       |
10819|       |        memcpy(p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].pdx, l_tccp->prcw,
10820|       |               l_data_size);
10821|       |        memcpy(p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].pdy, l_tccp->prch,
10822|       |               l_data_size);
10823|       |    }
10824|       |    /* << INDEX */
10825|       |#endif
10826|       |
10827|  10.3k|    return OPJ_TRUE;
  ------------------
  |  |  117|  10.3k|#define OPJ_TRUE 1
  ------------------
10828|  10.4k|}
j2k.c:opj_j2k_copy_tile_component_parameters:
10831|  10.0k|{
10832|       |    /* loop */
10833|  10.0k|    OPJ_UINT32 i;
10834|  10.0k|    opj_cp_t *l_cp = NULL;
10835|  10.0k|    opj_tcp_t *l_tcp = NULL;
10836|  10.0k|    opj_tccp_t *l_ref_tccp = NULL, *l_copied_tccp = NULL;
10837|  10.0k|    OPJ_UINT32 l_prc_size;
10838|       |
10839|       |    /* preconditions */
10840|  10.0k|    assert(p_j2k != 00);
10841|       |
10842|  10.0k|    l_cp = &(p_j2k->m_cp);
10843|  10.0k|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH)
  ------------------
  |  Branch (10843:13): [True: 2.09k, False: 7.90k]
  ------------------
10844|  10.0k|            ?
10845|  2.09k|            &l_cp->tcps[p_j2k->m_current_tile_number] :
10846|  10.0k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
10847|       |
10848|  10.0k|    l_ref_tccp = &l_tcp->tccps[0];
10849|  10.0k|    l_copied_tccp = l_ref_tccp + 1;
10850|  10.0k|    l_prc_size = l_ref_tccp->numresolutions * (OPJ_UINT32)sizeof(OPJ_UINT32);
10851|       |
10852|  82.0k|    for (i = 1; i < p_j2k->m_private_image->numcomps; ++i) {
  ------------------
  |  Branch (10852:17): [True: 72.0k, False: 10.0k]
  ------------------
10853|  72.0k|        l_copied_tccp->numresolutions = l_ref_tccp->numresolutions;
10854|  72.0k|        l_copied_tccp->cblkw = l_ref_tccp->cblkw;
10855|  72.0k|        l_copied_tccp->cblkh = l_ref_tccp->cblkh;
10856|  72.0k|        l_copied_tccp->cblksty = l_ref_tccp->cblksty;
10857|  72.0k|        l_copied_tccp->qmfbid = l_ref_tccp->qmfbid;
10858|  72.0k|        memcpy(l_copied_tccp->prcw, l_ref_tccp->prcw, l_prc_size);
10859|  72.0k|        memcpy(l_copied_tccp->prch, l_ref_tccp->prch, l_prc_size);
10860|  72.0k|        ++l_copied_tccp;
10861|  72.0k|    }
10862|  10.0k|}
j2k.c:opj_j2k_read_coc:
 2944|    411|{
 2945|    411|    opj_cp_t *l_cp = NULL;
 2946|    411|    opj_tcp_t *l_tcp = NULL;
 2947|    411|    opj_image_t *l_image = NULL;
 2948|    411|    OPJ_UINT32 l_comp_room;
 2949|    411|    OPJ_UINT32 l_comp_no;
 2950|       |
 2951|       |    /* preconditions */
 2952|    411|    assert(p_header_data != 00);
 2953|    411|    assert(p_j2k != 00);
 2954|    411|    assert(p_manager != 00);
 2955|       |
 2956|    411|    l_cp = &(p_j2k->m_cp);
 2957|    411|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH)
  ------------------
  |  Branch (2957:13): [True: 28, False: 383]
  ------------------
 2958|    411|            ?
 2959|     28|            &l_cp->tcps[p_j2k->m_current_tile_number] :
 2960|    411|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 2961|    411|    l_image = p_j2k->m_private_image;
 2962|       |
 2963|    411|    l_comp_room = l_image->numcomps <= 256 ? 1 : 2;
  ------------------
  |  Branch (2963:19): [True: 411, False: 0]
  ------------------
 2964|       |
 2965|       |    /* make sure room is sufficient*/
 2966|    411|    if (p_header_size < l_comp_room + 1) {
  ------------------
  |  Branch (2966:9): [True: 2, False: 409]
  ------------------
 2967|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COC marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2968|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 2969|      2|    }
 2970|    409|    p_header_size -= l_comp_room + 1;
 2971|       |
 2972|    409|    opj_read_bytes(p_header_data, &l_comp_no,
  ------------------
  |  |   65|    409|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2973|    409|                   l_comp_room);                 /* Ccoc */
 2974|    409|    p_header_data += l_comp_room;
 2975|    409|    if (l_comp_no >= l_image->numcomps) {
  ------------------
  |  Branch (2975:9): [True: 12, False: 397]
  ------------------
 2976|     12|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     12|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2977|     12|                      "Error reading COC marker (bad number of components)\n");
 2978|     12|        return OPJ_FALSE;
  ------------------
  |  |  118|     12|#define OPJ_FALSE 0
  ------------------
 2979|     12|    }
 2980|       |
 2981|    397|    opj_read_bytes(p_header_data, &l_tcp->tccps[l_comp_no].csty,
  ------------------
  |  |   65|    397|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2982|    397|                   1);                  /* Scoc */
 2983|    397|    ++p_header_data ;
 2984|       |
 2985|    397|    if (! opj_j2k_read_SPCod_SPCoc(p_j2k, l_comp_no, p_header_data, &p_header_size,
  ------------------
  |  Branch (2985:9): [True: 10, False: 387]
  ------------------
 2986|    397|                                   p_manager)) {
 2987|     10|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COC marker\n");
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2988|     10|        return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
 2989|     10|    }
 2990|       |
 2991|    387|    if (p_header_size != 0) {
  ------------------
  |  Branch (2991:9): [True: 10, False: 377]
  ------------------
 2992|     10|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COC marker\n");
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2993|     10|        return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
 2994|     10|    }
 2995|    377|    return OPJ_TRUE;
  ------------------
  |  |  117|    377|#define OPJ_TRUE 1
  ------------------
 2996|    387|}
j2k.c:opj_j2k_read_rgn:
 5180|    331|{
 5181|    331|    OPJ_UINT32 l_nb_comp;
 5182|    331|    opj_image_t * l_image = 00;
 5183|       |
 5184|    331|    opj_cp_t *l_cp = 00;
 5185|    331|    opj_tcp_t *l_tcp = 00;
 5186|    331|    OPJ_UINT32 l_comp_room, l_comp_no, l_roi_sty;
 5187|       |
 5188|       |    /* preconditions*/
 5189|    331|    assert(p_header_data != 00);
 5190|    331|    assert(p_j2k != 00);
 5191|    331|    assert(p_manager != 00);
 5192|       |
 5193|    331|    l_image = p_j2k->m_private_image;
 5194|    331|    l_nb_comp = l_image->numcomps;
 5195|       |
 5196|    331|    if (l_nb_comp <= 256) {
  ------------------
  |  Branch (5196:9): [True: 331, False: 0]
  ------------------
 5197|    331|        l_comp_room = 1;
 5198|    331|    } else {
 5199|      0|        l_comp_room = 2;
 5200|      0|    }
 5201|       |
 5202|    331|    if (p_header_size != 2 + l_comp_room) {
  ------------------
  |  Branch (5202:9): [True: 4, False: 327]
  ------------------
 5203|      4|        opj_event_msg(p_manager, EVT_ERROR, "Error reading RGN marker\n");
  ------------------
  |  |   66|      4|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5204|      4|        return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
 5205|      4|    }
 5206|       |
 5207|    327|    l_cp = &(p_j2k->m_cp);
 5208|    327|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ?
  ------------------
  |  Branch (5208:13): [True: 10, False: 317]
  ------------------
 5209|     10|            &l_cp->tcps[p_j2k->m_current_tile_number] :
 5210|    327|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 5211|       |
 5212|    327|    opj_read_bytes(p_header_data, &l_comp_no, l_comp_room);         /* Crgn */
  ------------------
  |  |   65|    327|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5213|    327|    p_header_data += l_comp_room;
 5214|    327|    opj_read_bytes(p_header_data, &l_roi_sty,
  ------------------
  |  |   65|    327|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5215|    327|                   1);                                     /* Srgn */
 5216|    327|    ++p_header_data;
 5217|       |
 5218|       |#ifdef USE_JPWL
 5219|       |    if (l_cp->correct) {
 5220|       |        /* totlen is negative or larger than the bytes left!!! */
 5221|       |        if (l_comp_room >= l_nb_comp) {
 5222|       |            opj_event_msg(p_manager, EVT_ERROR,
 5223|       |                          "JPWL: bad component number in RGN (%d when there are only %d)\n",
 5224|       |                          l_comp_room, l_nb_comp);
 5225|       |            if (!JPWL_ASSUME) {
 5226|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 5227|       |                return OPJ_FALSE;
 5228|       |            }
 5229|       |        }
 5230|       |    };
 5231|       |#endif /* USE_JPWL */
 5232|       |
 5233|       |    /* testcase 3635.pdf.asan.77.2930 */
 5234|    327|    if (l_comp_no >= l_nb_comp) {
  ------------------
  |  Branch (5234:9): [True: 1, False: 326]
  ------------------
 5235|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5236|      1|                      "bad component number in RGN (%d when there are only %d)\n",
 5237|      1|                      l_comp_no, l_nb_comp);
 5238|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 5239|      1|    }
 5240|       |
 5241|    326|    opj_read_bytes(p_header_data,
  ------------------
  |  |   65|    326|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5242|    326|                   (OPJ_UINT32 *)(&(l_tcp->tccps[l_comp_no].roishift)), 1);  /* SPrgn */
 5243|    326|    ++p_header_data;
 5244|       |
 5245|    326|    return OPJ_TRUE;
  ------------------
  |  |  117|    326|#define OPJ_TRUE 1
  ------------------
 5246|       |
 5247|    327|}
j2k.c:opj_j2k_read_qcd:
 3071|  73.3k|{
 3072|       |    /* preconditions */
 3073|  73.3k|    assert(p_header_data != 00);
 3074|  73.3k|    assert(p_j2k != 00);
 3075|  73.3k|    assert(p_manager != 00);
 3076|       |
 3077|  73.3k|    if (! opj_j2k_read_SQcd_SQcc(p_j2k, 0, p_header_data, &p_header_size,
  ------------------
  |  Branch (3077:9): [True: 1, False: 73.3k]
  ------------------
 3078|  73.3k|                                 p_manager)) {
 3079|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading QCD marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3080|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 3081|      1|    }
 3082|       |
 3083|  73.3k|    if (p_header_size != 0) {
  ------------------
  |  Branch (3083:9): [True: 20, False: 73.2k]
  ------------------
 3084|     20|        opj_event_msg(p_manager, EVT_ERROR, "Error reading QCD marker\n");
  ------------------
  |  |   66|     20|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3085|     20|        return OPJ_FALSE;
  ------------------
  |  |  118|     20|#define OPJ_FALSE 0
  ------------------
 3086|     20|    }
 3087|       |
 3088|       |    /* Apply the quantization parameters to other components of the current tile or the m_default_tcp */
 3089|  73.2k|    opj_j2k_copy_tile_quantization_parameters(p_j2k);
 3090|       |
 3091|  73.2k|    return OPJ_TRUE;
  ------------------
  |  |  117|  73.2k|#define OPJ_TRUE 1
  ------------------
 3092|  73.3k|}
j2k.c:opj_j2k_read_SQcd_SQcc:
11024|  73.5k|{
11025|       |    /* loop*/
11026|  73.5k|    OPJ_UINT32 l_band_no;
11027|  73.5k|    opj_cp_t *l_cp = 00;
11028|  73.5k|    opj_tcp_t *l_tcp = 00;
11029|  73.5k|    opj_tccp_t *l_tccp = 00;
11030|  73.5k|    OPJ_BYTE * l_current_ptr = 00;
11031|  73.5k|    OPJ_UINT32 l_tmp, l_num_band;
11032|       |
11033|       |    /* preconditions*/
11034|  73.5k|    assert(p_j2k != 00);
11035|  73.5k|    assert(p_manager != 00);
11036|  73.5k|    assert(p_header_data != 00);
11037|       |
11038|  73.5k|    l_cp = &(p_j2k->m_cp);
11039|       |    /* come from tile part header or main header ?*/
11040|  73.5k|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH)
  ------------------
  |  Branch (11040:13): [True: 1.47k, False: 72.0k]
  ------------------
11041|  73.5k|            ?
11042|  1.47k|            &l_cp->tcps[p_j2k->m_current_tile_number] :
11043|  73.5k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
11044|       |
11045|       |    /* precondition again*/
11046|  73.5k|    assert(p_comp_no <  p_j2k->m_private_image->numcomps);
11047|       |
11048|  73.5k|    l_tccp = &l_tcp->tccps[p_comp_no];
11049|  73.5k|    l_current_ptr = p_header_data;
11050|       |
11051|  73.5k|    if (*p_header_size < 1) {
  ------------------
  |  Branch (11051:9): [True: 1, False: 73.5k]
  ------------------
11052|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading SQcd or SQcc element\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11053|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
11054|      1|    }
11055|  73.5k|    *p_header_size -= 1;
11056|       |
11057|  73.5k|    opj_read_bytes(l_current_ptr, &l_tmp, 1);                       /* Sqcx */
  ------------------
  |  |   65|  73.5k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
11058|  73.5k|    ++l_current_ptr;
11059|       |
11060|  73.5k|    l_tccp->qntsty = l_tmp & 0x1f;
11061|  73.5k|    l_tccp->numgbits = l_tmp >> 5;
11062|  73.5k|    if (l_tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) {
  ------------------
  |  |   67|  73.5k|#define J2K_CCP_QNTSTY_SIQNT 1
  ------------------
  |  Branch (11062:9): [True: 1.81k, False: 71.7k]
  ------------------
11063|  1.81k|        l_num_band = 1;
11064|  71.7k|    } else {
11065|  71.7k|        l_num_band = (l_tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) ?
  ------------------
  |  |   66|  71.7k|#define J2K_CCP_QNTSTY_NOQNT 0
  ------------------
  |  Branch (11065:22): [True: 57.5k, False: 14.1k]
  ------------------
11066|  57.5k|                     (*p_header_size) :
11067|  71.7k|                     (*p_header_size) / 2;
11068|       |
11069|  71.7k|        if (l_num_band > OPJ_J2K_MAXBANDS) {
  ------------------
  |  |  153|  71.7k|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  152|  71.7k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
  |  Branch (11069:13): [True: 432, False: 71.2k]
  ------------------
11070|    432|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    432|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
11071|    432|                          "While reading CCP_QNTSTY element inside QCD or QCC marker segment, "
11072|    432|                          "number of subbands (%d) is greater to OPJ_J2K_MAXBANDS (%d). So we limit the number of elements stored to "
11073|    432|                          "OPJ_J2K_MAXBANDS (%d) and skip the rest. \n", l_num_band, OPJ_J2K_MAXBANDS,
  ------------------
  |  |  153|    432|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  152|    432|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
11074|    432|                          OPJ_J2K_MAXBANDS);
  ------------------
  |  |  153|    432|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  152|    432|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
11075|       |            /*return OPJ_FALSE;*/
11076|    432|        }
11077|  71.7k|    }
11078|       |
11079|       |#ifdef USE_JPWL
11080|       |    if (l_cp->correct) {
11081|       |
11082|       |        /* if JPWL is on, we check whether there are too many subbands */
11083|       |        if (/*(l_num_band < 0) ||*/ (l_num_band >= OPJ_J2K_MAXBANDS)) {
11084|       |            opj_event_msg(p_manager, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
11085|       |                          "JPWL: bad number of subbands in Sqcx (%d)\n",
11086|       |                          l_num_band);
11087|       |            if (!JPWL_ASSUME) {
11088|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
11089|       |                return OPJ_FALSE;
11090|       |            }
11091|       |            /* we try to correct */
11092|       |            l_num_band = 1;
11093|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust them\n"
11094|       |                          "- setting number of bands to %d => HYPOTHESIS!!!\n",
11095|       |                          l_num_band);
11096|       |        };
11097|       |
11098|       |    };
11099|       |#endif /* USE_JPWL */
11100|       |
11101|  73.5k|    if (l_tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) {
  ------------------
  |  |   66|  73.5k|#define J2K_CCP_QNTSTY_NOQNT 0
  ------------------
  |  Branch (11101:9): [True: 57.5k, False: 15.9k]
  ------------------
11102|   331k|        for (l_band_no = 0; l_band_no < l_num_band; l_band_no++) {
  ------------------
  |  Branch (11102:29): [True: 274k, False: 57.5k]
  ------------------
11103|   274k|            opj_read_bytes(l_current_ptr, &l_tmp, 1);                       /* SPqcx_i */
  ------------------
  |  |   65|   274k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
11104|   274k|            ++l_current_ptr;
11105|   274k|            if (l_band_no < OPJ_J2K_MAXBANDS) {
  ------------------
  |  |  153|   274k|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  152|   274k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
  |  Branch (11105:17): [True: 96.9k, False: 177k]
  ------------------
11106|  96.9k|                l_tccp->stepsizes[l_band_no].expn = (OPJ_INT32)(l_tmp >> 3);
11107|  96.9k|                l_tccp->stepsizes[l_band_no].mant = 0;
11108|  96.9k|            }
11109|   274k|        }
11110|  57.5k|        *p_header_size = *p_header_size - l_num_band;
11111|  57.5k|    } else {
11112|   202k|        for (l_band_no = 0; l_band_no < l_num_band; l_band_no++) {
  ------------------
  |  Branch (11112:29): [True: 186k, False: 15.9k]
  ------------------
11113|   186k|            opj_read_bytes(l_current_ptr, &l_tmp, 2);                       /* SPqcx_i */
  ------------------
  |  |   65|   186k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
11114|   186k|            l_current_ptr += 2;
11115|   186k|            if (l_band_no < OPJ_J2K_MAXBANDS) {
  ------------------
  |  |  153|   186k|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  152|   186k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
  |  Branch (11115:17): [True: 85.8k, False: 100k]
  ------------------
11116|  85.8k|                l_tccp->stepsizes[l_band_no].expn = (OPJ_INT32)(l_tmp >> 11);
11117|  85.8k|                l_tccp->stepsizes[l_band_no].mant = l_tmp & 0x7ff;
11118|  85.8k|            }
11119|   186k|        }
11120|  15.9k|        *p_header_size = *p_header_size - 2 * l_num_band;
11121|  15.9k|    }
11122|       |
11123|       |    /* Add Antonin : if scalar_derived -> compute other stepsizes */
11124|  73.5k|    if (l_tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) {
  ------------------
  |  |   67|  73.5k|#define J2K_CCP_QNTSTY_SIQNT 1
  ------------------
  |  Branch (11124:9): [True: 1.81k, False: 71.7k]
  ------------------
11125|   176k|        for (l_band_no = 1; l_band_no < OPJ_J2K_MAXBANDS; l_band_no++) {
  ------------------
  |  |  153|   176k|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  152|   176k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
  |  Branch (11125:29): [True: 174k, False: 1.81k]
  ------------------
11126|   174k|            l_tccp->stepsizes[l_band_no].expn =
11127|   174k|                ((OPJ_INT32)(l_tccp->stepsizes[0].expn) - (OPJ_INT32)((l_band_no - 1) / 3) > 0)
  ------------------
  |  Branch (11127:17): [True: 103k, False: 71.1k]
  ------------------
11128|   174k|                ?
11129|   103k|                (OPJ_INT32)(l_tccp->stepsizes[0].expn) - (OPJ_INT32)((l_band_no - 1) / 3) : 0;
11130|   174k|            l_tccp->stepsizes[l_band_no].mant = l_tccp->stepsizes[0].mant;
11131|   174k|        }
11132|  1.81k|    }
11133|       |
11134|  73.5k|    return OPJ_TRUE;
  ------------------
  |  |  117|  73.5k|#define OPJ_TRUE 1
  ------------------
11135|  73.5k|}
j2k.c:opj_j2k_copy_tile_quantization_parameters:
11138|  73.2k|{
11139|  73.2k|    OPJ_UINT32 i;
11140|  73.2k|    opj_cp_t *l_cp = NULL;
11141|  73.2k|    opj_tcp_t *l_tcp = NULL;
11142|  73.2k|    opj_tccp_t *l_ref_tccp = NULL;
11143|  73.2k|    opj_tccp_t *l_copied_tccp = NULL;
11144|  73.2k|    OPJ_UINT32 l_size;
11145|       |
11146|       |    /* preconditions */
11147|  73.2k|    assert(p_j2k != 00);
11148|       |
11149|  73.2k|    l_cp = &(p_j2k->m_cp);
11150|  73.2k|    l_tcp = p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH ?
  ------------------
  |  Branch (11150:13): [True: 1.43k, False: 71.8k]
  ------------------
11151|  1.43k|            &l_cp->tcps[p_j2k->m_current_tile_number] :
11152|  73.2k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
11153|       |
11154|  73.2k|    l_ref_tccp = &l_tcp->tccps[0];
11155|  73.2k|    l_copied_tccp = l_ref_tccp + 1;
11156|  73.2k|    l_size = OPJ_J2K_MAXBANDS * sizeof(opj_stepsize_t);
  ------------------
  |  |  153|  73.2k|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  152|  73.2k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
11157|       |
11158|   273k|    for (i = 1; i < p_j2k->m_private_image->numcomps; ++i) {
  ------------------
  |  Branch (11158:17): [True: 199k, False: 73.2k]
  ------------------
11159|   199k|        l_copied_tccp->qntsty = l_ref_tccp->qntsty;
11160|   199k|        l_copied_tccp->numgbits = l_ref_tccp->numgbits;
11161|   199k|        memcpy(l_copied_tccp->stepsizes, l_ref_tccp->stepsizes, l_size);
11162|   199k|        ++l_copied_tccp;
11163|   199k|    }
11164|  73.2k|}
j2k.c:opj_j2k_read_qcc:
 3213|    227|{
 3214|    227|    OPJ_UINT32 l_num_comp, l_comp_no;
 3215|       |
 3216|       |    /* preconditions */
 3217|    227|    assert(p_header_data != 00);
 3218|    227|    assert(p_j2k != 00);
 3219|    227|    assert(p_manager != 00);
 3220|       |
 3221|    227|    l_num_comp = p_j2k->m_private_image->numcomps;
 3222|       |
 3223|    227|    if (l_num_comp <= 256) {
  ------------------
  |  Branch (3223:9): [True: 227, False: 0]
  ------------------
 3224|    227|        if (p_header_size < 1) {
  ------------------
  |  Branch (3224:13): [True: 1, False: 226]
  ------------------
 3225|      1|            opj_event_msg(p_manager, EVT_ERROR, "Error reading QCC marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3226|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 3227|      1|        }
 3228|    226|        opj_read_bytes(p_header_data, &l_comp_no, 1);
  ------------------
  |  |   65|    226|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3229|    226|        ++p_header_data;
 3230|    226|        --p_header_size;
 3231|    226|    } else {
 3232|      0|        if (p_header_size < 2) {
  ------------------
  |  Branch (3232:13): [True: 0, False: 0]
  ------------------
 3233|      0|            opj_event_msg(p_manager, EVT_ERROR, "Error reading QCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3234|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3235|      0|        }
 3236|      0|        opj_read_bytes(p_header_data, &l_comp_no, 2);
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3237|      0|        p_header_data += 2;
 3238|      0|        p_header_size -= 2;
 3239|      0|    }
 3240|       |
 3241|       |#ifdef USE_JPWL
 3242|       |    if (p_j2k->m_cp.correct) {
 3243|       |
 3244|       |        static OPJ_UINT32 backup_compno = 0;
 3245|       |
 3246|       |        /* compno is negative or larger than the number of components!!! */
 3247|       |        if (/*(l_comp_no < 0) ||*/ (l_comp_no >= l_num_comp)) {
 3248|       |            opj_event_msg(p_manager, EVT_ERROR,
 3249|       |                          "JPWL: bad component number in QCC (%d out of a maximum of %d)\n",
 3250|       |                          l_comp_no, l_num_comp);
 3251|       |            if (!JPWL_ASSUME) {
 3252|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 3253|       |                return OPJ_FALSE;
 3254|       |            }
 3255|       |            /* we try to correct */
 3256|       |            l_comp_no = backup_compno % l_num_comp;
 3257|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust this\n"
 3258|       |                          "- setting component number to %d\n",
 3259|       |                          l_comp_no);
 3260|       |        }
 3261|       |
 3262|       |        /* keep your private count of tiles */
 3263|       |        backup_compno++;
 3264|       |    };
 3265|       |#endif /* USE_JPWL */
 3266|       |
 3267|    226|    if (l_comp_no >= p_j2k->m_private_image->numcomps) {
  ------------------
  |  Branch (3267:9): [True: 6, False: 220]
  ------------------
 3268|      6|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3269|      6|                      "Invalid component number: %d, regarding the number of components %d\n",
 3270|      6|                      l_comp_no, p_j2k->m_private_image->numcomps);
 3271|      6|        return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
 3272|      6|    }
 3273|       |
 3274|    220|    if (! opj_j2k_read_SQcd_SQcc(p_j2k, l_comp_no, p_header_data, &p_header_size,
  ------------------
  |  Branch (3274:9): [True: 0, False: 220]
  ------------------
 3275|    220|                                 p_manager)) {
 3276|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading QCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3277|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3278|      0|    }
 3279|       |
 3280|    220|    if (p_header_size != 0) {
  ------------------
  |  Branch (3280:9): [True: 5, False: 215]
  ------------------
 3281|      5|        opj_event_msg(p_manager, EVT_ERROR, "Error reading QCC marker\n");
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3282|      5|        return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 3283|      5|    }
 3284|       |
 3285|    215|    return OPJ_TRUE;
  ------------------
  |  |  117|    215|#define OPJ_TRUE 1
  ------------------
 3286|    220|}
j2k.c:opj_j2k_read_poc:
 3528|    717|{
 3529|    717|    OPJ_UINT32 i, l_nb_comp, l_tmp;
 3530|    717|    opj_image_t * l_image = 00;
 3531|    717|    OPJ_UINT32 l_old_poc_nb, l_current_poc_nb, l_current_poc_remaining;
 3532|    717|    OPJ_UINT32 l_chunk_size, l_comp_room;
 3533|       |
 3534|    717|    opj_cp_t *l_cp = 00;
 3535|    717|    opj_tcp_t *l_tcp = 00;
 3536|    717|    opj_poc_t *l_current_poc = 00;
 3537|       |
 3538|       |    /* preconditions */
 3539|    717|    assert(p_header_data != 00);
 3540|    717|    assert(p_j2k != 00);
 3541|    717|    assert(p_manager != 00);
 3542|       |
 3543|    717|    l_image = p_j2k->m_private_image;
 3544|    717|    l_nb_comp = l_image->numcomps;
 3545|    717|    if (l_nb_comp <= 256) {
  ------------------
  |  Branch (3545:9): [True: 717, False: 0]
  ------------------
 3546|    717|        l_comp_room = 1;
 3547|    717|    } else {
 3548|      0|        l_comp_room = 2;
 3549|      0|    }
 3550|    717|    l_chunk_size = 5 + 2 * l_comp_room;
 3551|    717|    l_current_poc_nb = p_header_size / l_chunk_size;
 3552|    717|    l_current_poc_remaining = p_header_size % l_chunk_size;
 3553|       |
 3554|    717|    if ((l_current_poc_nb <= 0) || (l_current_poc_remaining != 0)) {
  ------------------
  |  Branch (3554:9): [True: 2, False: 715]
  |  Branch (3554:36): [True: 1, False: 714]
  ------------------
 3555|      3|        opj_event_msg(p_manager, EVT_ERROR, "Error reading POC marker\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3556|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 3557|      3|    }
 3558|       |
 3559|    714|    l_cp = &(p_j2k->m_cp);
 3560|    714|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ?
  ------------------
  |  Branch (3560:13): [True: 10, False: 704]
  ------------------
 3561|     10|            &l_cp->tcps[p_j2k->m_current_tile_number] :
 3562|    714|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 3563|    714|    l_old_poc_nb = l_tcp->POC ? l_tcp->numpocs + 1 : 0;
  ------------------
  |  Branch (3563:20): [True: 254, False: 460]
  ------------------
 3564|    714|    l_current_poc_nb += l_old_poc_nb;
 3565|       |
 3566|    714|    if (l_current_poc_nb >= J2K_MAX_POCS) {
  ------------------
  |  |  114|    714|#define J2K_MAX_POCS    32      /**< Maximum number of POCs */
  ------------------
  |  Branch (3566:9): [True: 2, False: 712]
  ------------------
 3567|      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 */
  ------------------
 3568|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 3569|      2|    }
 3570|       |
 3571|       |    /* now poc is in use.*/
 3572|    712|    l_tcp->POC = 1;
 3573|       |
 3574|    712|    l_current_poc = &l_tcp->pocs[l_old_poc_nb];
 3575|  5.21k|    for (i = l_old_poc_nb; i < l_current_poc_nb; ++i) {
  ------------------
  |  Branch (3575:28): [True: 4.50k, False: 712]
  ------------------
 3576|  4.50k|        opj_read_bytes(p_header_data, &(l_current_poc->resno0),
  ------------------
  |  |   65|  4.50k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3577|  4.50k|                       1);                               /* RSpoc_i */
 3578|  4.50k|        ++p_header_data;
 3579|  4.50k|        opj_read_bytes(p_header_data, &(l_current_poc->compno0),
  ------------------
  |  |   65|  4.50k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3580|  4.50k|                       l_comp_room);  /* CSpoc_i */
 3581|  4.50k|        p_header_data += l_comp_room;
 3582|  4.50k|        opj_read_bytes(p_header_data, &(l_current_poc->layno1),
  ------------------
  |  |   65|  4.50k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3583|  4.50k|                       2);                               /* LYEpoc_i */
 3584|       |        /* make sure layer end is in acceptable bounds */
 3585|  4.50k|        l_current_poc->layno1 = opj_uint_min(l_current_poc->layno1, l_tcp->numlayers);
 3586|  4.50k|        p_header_data += 2;
 3587|  4.50k|        opj_read_bytes(p_header_data, &(l_current_poc->resno1),
  ------------------
  |  |   65|  4.50k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3588|  4.50k|                       1);                               /* REpoc_i */
 3589|  4.50k|        ++p_header_data;
 3590|  4.50k|        opj_read_bytes(p_header_data, &(l_current_poc->compno1),
  ------------------
  |  |   65|  4.50k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3591|  4.50k|                       l_comp_room);  /* CEpoc_i */
 3592|  4.50k|        p_header_data += l_comp_room;
 3593|  4.50k|        opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|  4.50k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3594|  4.50k|                       1);                                                                 /* Ppoc_i */
 3595|  4.50k|        ++p_header_data;
 3596|  4.50k|        l_current_poc->prg = (OPJ_PROG_ORDER) l_tmp;
 3597|       |        /* make sure comp is in acceptable bounds */
 3598|  4.50k|        l_current_poc->compno1 = opj_uint_min(l_current_poc->compno1, l_nb_comp);
 3599|  4.50k|        ++l_current_poc;
 3600|  4.50k|    }
 3601|       |
 3602|    712|    l_tcp->numpocs = l_current_poc_nb - 1;
 3603|    712|    return OPJ_TRUE;
  ------------------
  |  |  117|    712|#define OPJ_TRUE 1
  ------------------
 3604|    714|}
j2k.c:opj_j2k_read_siz:
 2079|  7.88k|{
 2080|  7.88k|    OPJ_UINT32 i;
 2081|  7.88k|    OPJ_UINT32 l_nb_comp;
 2082|  7.88k|    OPJ_UINT32 l_nb_comp_remain;
 2083|  7.88k|    OPJ_UINT32 l_remaining_size;
 2084|  7.88k|    OPJ_UINT32 l_nb_tiles;
 2085|  7.88k|    OPJ_UINT32 l_tmp, l_tx1, l_ty1;
 2086|  7.88k|    OPJ_UINT32 l_prec0, l_sgnd0;
 2087|  7.88k|    opj_image_t *l_image = 00;
 2088|  7.88k|    opj_cp_t *l_cp = 00;
 2089|  7.88k|    opj_image_comp_t * l_img_comp = 00;
 2090|  7.88k|    opj_tcp_t * l_current_tile_param = 00;
 2091|       |
 2092|       |    /* preconditions */
 2093|  7.88k|    assert(p_j2k != 00);
 2094|  7.88k|    assert(p_manager != 00);
 2095|  7.88k|    assert(p_header_data != 00);
 2096|       |
 2097|  7.88k|    l_image = p_j2k->m_private_image;
 2098|  7.88k|    l_cp = &(p_j2k->m_cp);
 2099|       |
 2100|       |    /* minimum size == 39 - 3 (= minimum component parameter) */
 2101|  7.88k|    if (p_header_size < 36) {
  ------------------
  |  Branch (2101:9): [True: 6, False: 7.87k]
  ------------------
 2102|      6|        opj_event_msg(p_manager, EVT_ERROR, "Error with SIZ marker size\n");
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2103|      6|        return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
 2104|      6|    }
 2105|       |
 2106|  7.87k|    l_remaining_size = p_header_size - 36;
 2107|  7.87k|    l_nb_comp = l_remaining_size / 3;
 2108|  7.87k|    l_nb_comp_remain = l_remaining_size % 3;
 2109|  7.87k|    if (l_nb_comp_remain != 0) {
  ------------------
  |  Branch (2109:9): [True: 5, False: 7.86k]
  ------------------
 2110|      5|        opj_event_msg(p_manager, EVT_ERROR, "Error with SIZ marker size\n");
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2111|      5|        return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 2112|      5|    }
 2113|       |
 2114|  7.86k|    opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|  7.86k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2115|  7.86k|                   2);                                                /* Rsiz (capabilities) */
 2116|  7.86k|    p_header_data += 2;
 2117|  7.86k|    l_cp->rsiz = (OPJ_UINT16) l_tmp;
 2118|  7.86k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_image->x1, 4);   /* Xsiz */
  ------------------
  |  |   65|  7.86k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2119|  7.86k|    p_header_data += 4;
 2120|  7.86k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_image->y1, 4);   /* Ysiz */
  ------------------
  |  |   65|  7.86k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2121|  7.86k|    p_header_data += 4;
 2122|  7.86k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_image->x0, 4);   /* X0siz */
  ------------------
  |  |   65|  7.86k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2123|  7.86k|    p_header_data += 4;
 2124|  7.86k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_image->y0, 4);   /* Y0siz */
  ------------------
  |  |   65|  7.86k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2125|  7.86k|    p_header_data += 4;
 2126|  7.86k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_cp->tdx,
  ------------------
  |  |   65|  7.86k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2127|  7.86k|                   4);             /* XTsiz */
 2128|  7.86k|    p_header_data += 4;
 2129|  7.86k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_cp->tdy,
  ------------------
  |  |   65|  7.86k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2130|  7.86k|                   4);             /* YTsiz */
 2131|  7.86k|    p_header_data += 4;
 2132|  7.86k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_cp->tx0,
  ------------------
  |  |   65|  7.86k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2133|  7.86k|                   4);             /* XT0siz */
 2134|  7.86k|    p_header_data += 4;
 2135|  7.86k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_cp->ty0,
  ------------------
  |  |   65|  7.86k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2136|  7.86k|                   4);             /* YT0siz */
 2137|  7.86k|    p_header_data += 4;
 2138|  7.86k|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_tmp,
  ------------------
  |  |   65|  7.86k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2139|  7.86k|                   2);                 /* Csiz */
 2140|  7.86k|    p_header_data += 2;
 2141|  7.86k|    if (l_tmp < 16385) {
  ------------------
  |  Branch (2141:9): [True: 7.85k, False: 10]
  ------------------
 2142|  7.85k|        l_image->numcomps = (OPJ_UINT16) l_tmp;
 2143|  7.85k|    } else {
 2144|     10|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2145|     10|                      "Error with SIZ marker: number of component is illegal -> %d\n", l_tmp);
 2146|     10|        return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
 2147|     10|    }
 2148|       |
 2149|  7.85k|    if (l_image->numcomps != l_nb_comp) {
  ------------------
  |  Branch (2149:9): [True: 15, False: 7.84k]
  ------------------
 2150|     15|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     15|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2151|     15|                      "Error with SIZ marker: number of component is not compatible with the remaining number of parameters ( %d vs %d)\n",
 2152|     15|                      l_image->numcomps, l_nb_comp);
 2153|     15|        return OPJ_FALSE;
  ------------------
  |  |  118|     15|#define OPJ_FALSE 0
  ------------------
 2154|     15|    }
 2155|       |
 2156|       |    /* testcase 4035.pdf.SIGSEGV.d8b.3375 */
 2157|       |    /* testcase issue427-null-image-size.jp2 */
 2158|  7.84k|    if ((l_image->x0 >= l_image->x1) || (l_image->y0 >= l_image->y1)) {
  ------------------
  |  Branch (2158:9): [True: 4, False: 7.84k]
  |  Branch (2158:41): [True: 10, False: 7.83k]
  ------------------
 2159|     14|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     14|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2160|     14|                      "Error with SIZ marker: negative or zero image size (%" PRId64 " x %" PRId64
 2161|     14|                      ")\n", (OPJ_INT64)l_image->x1 - l_image->x0,
 2162|     14|                      (OPJ_INT64)l_image->y1 - l_image->y0);
 2163|     14|        return OPJ_FALSE;
  ------------------
  |  |  118|     14|#define OPJ_FALSE 0
  ------------------
 2164|     14|    }
 2165|       |    /* testcase 2539.pdf.SIGFPE.706.1712 (also 3622.pdf.SIGFPE.706.2916 and 4008.pdf.SIGFPE.706.3345 and maybe more) */
 2166|  7.83k|    if ((l_cp->tdx == 0U) || (l_cp->tdy == 0U)) {
  ------------------
  |  Branch (2166:9): [True: 1, False: 7.82k]
  |  Branch (2166:30): [True: 2, False: 7.82k]
  ------------------
 2167|      3|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2168|      3|                      "Error with SIZ marker: invalid tile size (tdx: %d, tdy: %d)\n", l_cp->tdx,
 2169|      3|                      l_cp->tdy);
 2170|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 2171|      3|    }
 2172|       |
 2173|       |    /* testcase issue427-illegal-tile-offset.jp2 */
 2174|  7.82k|    l_tx1 = opj_uint_adds(l_cp->tx0, l_cp->tdx); /* manage overflow */
 2175|  7.82k|    l_ty1 = opj_uint_adds(l_cp->ty0, l_cp->tdy); /* manage overflow */
 2176|  7.82k|    if ((l_cp->tx0 > l_image->x0) || (l_cp->ty0 > l_image->y0) ||
  ------------------
  |  Branch (2176:9): [True: 39, False: 7.78k]
  |  Branch (2176:38): [True: 27, False: 7.76k]
  ------------------
 2177|  7.82k|            (l_tx1 <= l_image->x0) || (l_ty1 <= l_image->y0)) {
  ------------------
  |  Branch (2177:13): [True: 4, False: 7.75k]
  |  Branch (2177:39): [True: 9, False: 7.74k]
  ------------------
 2178|     79|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     79|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2179|     79|                      "Error with SIZ marker: illegal tile offset\n");
 2180|     79|        return OPJ_FALSE;
  ------------------
  |  |  118|     79|#define OPJ_FALSE 0
  ------------------
 2181|     79|    }
 2182|  7.74k|    if (!p_j2k->dump_state) {
  ------------------
  |  Branch (2182:9): [True: 7.74k, False: 0]
  ------------------
 2183|  7.74k|        OPJ_UINT32 siz_w, siz_h;
 2184|       |
 2185|  7.74k|        siz_w = l_image->x1 - l_image->x0;
 2186|  7.74k|        siz_h = l_image->y1 - l_image->y0;
 2187|       |
 2188|  7.74k|        if (p_j2k->ihdr_w > 0 && p_j2k->ihdr_h > 0
  ------------------
  |  Branch (2188:13): [True: 7.74k, False: 0]
  |  Branch (2188:34): [True: 7.74k, False: 0]
  ------------------
 2189|  7.74k|                && (p_j2k->ihdr_w != siz_w || p_j2k->ihdr_h != siz_h)) {
  ------------------
  |  Branch (2189:21): [True: 49, False: 7.69k]
  |  Branch (2189:47): [True: 64, False: 7.63k]
  ------------------
 2190|    113|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    113|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2191|    113|                          "Error with SIZ marker: IHDR w(%u) h(%u) vs. SIZ w(%u) h(%u)\n", p_j2k->ihdr_w,
 2192|    113|                          p_j2k->ihdr_h, siz_w, siz_h);
 2193|    113|            return OPJ_FALSE;
  ------------------
  |  |  118|    113|#define OPJ_FALSE 0
  ------------------
 2194|    113|        }
 2195|  7.74k|    }
 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|  7.63k|    l_image->comps = (opj_image_comp_t*) opj_calloc(l_image->numcomps,
 2240|  7.63k|                     sizeof(opj_image_comp_t));
 2241|  7.63k|    if (l_image->comps == 00) {
  ------------------
  |  Branch (2241:9): [True: 1, False: 7.63k]
  ------------------
 2242|      1|        l_image->numcomps = 0;
 2243|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2244|      1|                      "Not enough memory to take in charge SIZ marker\n");
 2245|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 2246|      1|    }
 2247|       |
 2248|  7.63k|    l_img_comp = l_image->comps;
 2249|       |
 2250|  7.63k|    l_prec0 = 0;
 2251|  7.63k|    l_sgnd0 = 0;
 2252|       |    /* Read the component information */
 2253|  37.0k|    for (i = 0; i < l_image->numcomps; ++i) {
  ------------------
  |  Branch (2253:17): [True: 29.4k, False: 7.61k]
  ------------------
 2254|  29.4k|        OPJ_UINT32 tmp;
 2255|  29.4k|        opj_read_bytes(p_header_data, &tmp, 1); /* Ssiz_i */
  ------------------
  |  |   65|  29.4k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2256|  29.4k|        ++p_header_data;
 2257|  29.4k|        l_img_comp->prec = (tmp & 0x7f) + 1;
 2258|  29.4k|        l_img_comp->sgnd = tmp >> 7;
 2259|       |
 2260|  29.4k|        if (p_j2k->dump_state == 0) {
  ------------------
  |  Branch (2260:13): [True: 29.4k, False: 0]
  ------------------
 2261|  29.4k|            if (i == 0) {
  ------------------
  |  Branch (2261:17): [True: 7.63k, False: 21.8k]
  ------------------
 2262|  7.63k|                l_prec0 = l_img_comp->prec;
 2263|  7.63k|                l_sgnd0 = l_img_comp->sgnd;
 2264|  21.8k|            } else if (!l_cp->allow_different_bit_depth_sign
  ------------------
  |  Branch (2264:24): [True: 21.4k, False: 363]
  ------------------
 2265|  21.8k|                       && (l_img_comp->prec != l_prec0 || l_img_comp->sgnd != l_sgnd0)) {
  ------------------
  |  Branch (2265:28): [True: 16.5k, False: 4.88k]
  |  Branch (2265:59): [True: 689, False: 4.20k]
  ------------------
 2266|  17.2k|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  17.2k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2267|  17.2k|                              "Despite JP2 BPC!=255, precision and/or sgnd values for comp[%d] is different than comp[0]:\n"
 2268|  17.2k|                              "        [0] prec(%d) sgnd(%d) [%d] prec(%d) sgnd(%d)\n", i, l_prec0, l_sgnd0,
 2269|  17.2k|                              i, l_img_comp->prec, l_img_comp->sgnd);
 2270|  17.2k|            }
 2271|       |            /* TODO: we should perhaps also check against JP2 BPCC values */
 2272|  29.4k|        }
 2273|  29.4k|        opj_read_bytes(p_header_data, &tmp, 1); /* XRsiz_i */
  ------------------
  |  |   65|  29.4k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2274|  29.4k|        ++p_header_data;
 2275|  29.4k|        l_img_comp->dx = (OPJ_UINT32)tmp; /* should be between 1 and 255 */
 2276|  29.4k|        opj_read_bytes(p_header_data, &tmp, 1); /* YRsiz_i */
  ------------------
  |  |   65|  29.4k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2277|  29.4k|        ++p_header_data;
 2278|  29.4k|        l_img_comp->dy = (OPJ_UINT32)tmp; /* should be between 1 and 255 */
 2279|  29.4k|        if (l_img_comp->dx < 1 || l_img_comp->dx > 255 ||
  ------------------
  |  Branch (2279:13): [True: 5, False: 29.4k]
  |  Branch (2279:35): [True: 0, False: 29.4k]
  ------------------
 2280|  29.4k|                l_img_comp->dy < 1 || l_img_comp->dy > 255) {
  ------------------
  |  Branch (2280:17): [True: 6, False: 29.4k]
  |  Branch (2280:39): [True: 0, False: 29.4k]
  ------------------
 2281|     11|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     11|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2282|     11|                          "Invalid values for comp = %d : dx=%u dy=%u (should be between 1 and 255 according to the JPEG2000 norm)\n",
 2283|     11|                          i, l_img_comp->dx, l_img_comp->dy);
 2284|     11|            return OPJ_FALSE;
  ------------------
  |  |  118|     11|#define OPJ_FALSE 0
  ------------------
 2285|     11|        }
 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|  29.4k|        if (l_img_comp->prec > 31) {
  ------------------
  |  Branch (2289:13): [True: 11, False: 29.4k]
  ------------------
 2290|     11|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     11|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2291|     11|                          "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|     11|                          i, l_img_comp->prec);
 2293|     11|            return OPJ_FALSE;
  ------------------
  |  |  118|     11|#define OPJ_FALSE 0
  ------------------
 2294|     11|        }
 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|  29.4k|        l_img_comp->resno_decoded =
 2325|  29.4k|            0;                                                          /* number of resolution decoded */
 2326|  29.4k|        l_img_comp->factor =
 2327|  29.4k|            l_cp->m_specific_param.m_dec.m_reduce; /* reducing factor per component */
 2328|  29.4k|        ++l_img_comp;
 2329|  29.4k|    }
 2330|       |
 2331|  7.61k|    if (l_cp->tdx == 0 || l_cp->tdy == 0) {
  ------------------
  |  Branch (2331:9): [True: 0, False: 7.61k]
  |  Branch (2331:27): [True: 0, False: 7.61k]
  ------------------
 2332|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2333|      0|    }
 2334|       |
 2335|       |    /* Compute the number of tiles */
 2336|  7.61k|    l_cp->tw = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(l_image->x1 - l_cp->tx0),
 2337|  7.61k|                                           (OPJ_INT32)l_cp->tdx);
 2338|  7.61k|    l_cp->th = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(l_image->y1 - l_cp->ty0),
 2339|  7.61k|                                           (OPJ_INT32)l_cp->tdy);
 2340|       |
 2341|       |    /* Check that the number of tiles is valid */
 2342|  7.61k|    if (l_cp->tw == 0 || l_cp->th == 0 || l_cp->tw > 65535 / l_cp->th) {
  ------------------
  |  Branch (2342:9): [True: 4, False: 7.60k]
  |  Branch (2342:26): [True: 4, False: 7.60k]
  |  Branch (2342:43): [True: 37, False: 7.56k]
  ------------------
 2343|     45|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     45|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2344|     45|                      "Invalid number of tiles : %u x %u (maximum fixed by jpeg2000 norm is 65535 tiles)\n",
 2345|     45|                      l_cp->tw, l_cp->th);
 2346|     45|        return OPJ_FALSE;
  ------------------
  |  |  118|     45|#define OPJ_FALSE 0
  ------------------
 2347|     45|    }
 2348|  7.56k|    l_nb_tiles = l_cp->tw * l_cp->th;
 2349|       |
 2350|       |    /* Define the tiles which will be decoded */
 2351|  7.56k|    if (p_j2k->m_specific_param.m_decoder.m_discard_tiles) {
  ------------------
  |  Branch (2351:9): [True: 0, False: 7.56k]
  ------------------
 2352|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_x =
 2353|      0|            (p_j2k->m_specific_param.m_decoder.m_start_tile_x - l_cp->tx0) / l_cp->tdx;
 2354|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_y =
 2355|      0|            (p_j2k->m_specific_param.m_decoder.m_start_tile_y - l_cp->ty0) / l_cp->tdy;
 2356|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = (OPJ_UINT32)opj_int_ceildiv((
 2357|      0|                    OPJ_INT32)(p_j2k->m_specific_param.m_decoder.m_end_tile_x - l_cp->tx0),
 2358|      0|                (OPJ_INT32)l_cp->tdx);
 2359|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = (OPJ_UINT32)opj_int_ceildiv((
 2360|      0|                    OPJ_INT32)(p_j2k->m_specific_param.m_decoder.m_end_tile_y - l_cp->ty0),
 2361|      0|                (OPJ_INT32)l_cp->tdy);
 2362|  7.56k|    } else {
 2363|  7.56k|        p_j2k->m_specific_param.m_decoder.m_start_tile_x = 0;
 2364|  7.56k|        p_j2k->m_specific_param.m_decoder.m_start_tile_y = 0;
 2365|  7.56k|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = l_cp->tw;
 2366|  7.56k|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = l_cp->th;
 2367|  7.56k|    }
 2368|       |
 2369|       |#ifdef USE_JPWL
 2370|       |    if (l_cp->correct) {
 2371|       |        /* if JPWL is on, we check whether TX errors have damaged
 2372|       |          too much the SIZ parameters */
 2373|       |        if ((l_cp->tw < 1) || (l_cp->th < 1) || (l_cp->tw > l_cp->max_tiles) ||
 2374|       |                (l_cp->th > l_cp->max_tiles)) {
 2375|       |            opj_event_msg(p_manager, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
 2376|       |                          "JPWL: bad number of tiles (%d x %d)\n",
 2377|       |                          l_cp->tw, l_cp->th);
 2378|       |            if (!JPWL_ASSUME) {
 2379|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 2380|       |                return OPJ_FALSE;
 2381|       |            }
 2382|       |            /* we try to correct */
 2383|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust them\n");
 2384|       |            if (l_cp->tw < 1) {
 2385|       |                l_cp->tw = 1;
 2386|       |                opj_event_msg(p_manager, EVT_WARNING,
 2387|       |                              "- setting %d tiles in x => HYPOTHESIS!!!\n",
 2388|       |                              l_cp->tw);
 2389|       |            }
 2390|       |            if (l_cp->tw > l_cp->max_tiles) {
 2391|       |                l_cp->tw = 1;
 2392|       |                opj_event_msg(p_manager, EVT_WARNING,
 2393|       |                              "- too large x, increase expectance of %d\n"
 2394|       |                              "- setting %d tiles in x => HYPOTHESIS!!!\n",
 2395|       |                              l_cp->max_tiles, l_cp->tw);
 2396|       |            }
 2397|       |            if (l_cp->th < 1) {
 2398|       |                l_cp->th = 1;
 2399|       |                opj_event_msg(p_manager, EVT_WARNING,
 2400|       |                              "- setting %d tiles in y => HYPOTHESIS!!!\n",
 2401|       |                              l_cp->th);
 2402|       |            }
 2403|       |            if (l_cp->th > l_cp->max_tiles) {
 2404|       |                l_cp->th = 1;
 2405|       |                opj_event_msg(p_manager, EVT_WARNING,
 2406|       |                              "- too large y, increase expectance of %d to continue\n",
 2407|       |                              "- setting %d tiles in y => HYPOTHESIS!!!\n",
 2408|       |                              l_cp->max_tiles, l_cp->th);
 2409|       |            }
 2410|       |        }
 2411|       |    }
 2412|       |#endif /* USE_JPWL */
 2413|       |
 2414|       |    /* memory allocations */
 2415|  7.56k|    l_cp->tcps = (opj_tcp_t*) opj_calloc(l_nb_tiles, sizeof(opj_tcp_t));
 2416|  7.56k|    if (l_cp->tcps == 00) {
  ------------------
  |  Branch (2416:9): [True: 0, False: 7.56k]
  ------------------
 2417|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2418|      0|                      "Not enough memory to take in charge SIZ marker\n");
 2419|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2420|      0|    }
 2421|       |
 2422|       |#ifdef USE_JPWL
 2423|       |    if (l_cp->correct) {
 2424|       |        if (!l_cp->tcps) {
 2425|       |            opj_event_msg(p_manager, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
 2426|       |                          "JPWL: could not alloc tcps field of cp\n");
 2427|       |            if (!JPWL_ASSUME) {
 2428|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 2429|       |                return OPJ_FALSE;
 2430|       |            }
 2431|       |        }
 2432|       |    }
 2433|       |#endif /* USE_JPWL */
 2434|       |
 2435|  7.56k|    p_j2k->m_specific_param.m_decoder.m_default_tcp->tccps =
 2436|  7.56k|        (opj_tccp_t*) opj_calloc(l_image->numcomps, sizeof(opj_tccp_t));
 2437|  7.56k|    if (p_j2k->m_specific_param.m_decoder.m_default_tcp->tccps  == 00) {
  ------------------
  |  Branch (2437:9): [True: 0, False: 7.56k]
  ------------------
 2438|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2439|      0|                      "Not enough memory to take in charge SIZ marker\n");
 2440|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2441|      0|    }
 2442|       |
 2443|  7.56k|    p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mct_records =
 2444|  7.56k|        (opj_mct_data_t*)opj_calloc(OPJ_J2K_MCT_DEFAULT_NB_RECORDS,
  ------------------
  |  |  159|  7.56k|#define OPJ_J2K_MCT_DEFAULT_NB_RECORDS      10
  ------------------
 2445|  7.56k|                                    sizeof(opj_mct_data_t));
 2446|       |
 2447|  7.56k|    if (! p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mct_records) {
  ------------------
  |  Branch (2447:9): [True: 0, False: 7.56k]
  ------------------
 2448|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2449|      0|                      "Not enough memory to take in charge SIZ marker\n");
 2450|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2451|      0|    }
 2452|  7.56k|    p_j2k->m_specific_param.m_decoder.m_default_tcp->m_nb_max_mct_records =
 2453|  7.56k|        OPJ_J2K_MCT_DEFAULT_NB_RECORDS;
  ------------------
  |  |  159|  7.56k|#define OPJ_J2K_MCT_DEFAULT_NB_RECORDS      10
  ------------------
 2454|       |
 2455|  7.56k|    p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mcc_records =
 2456|  7.56k|        (opj_simple_mcc_decorrelation_data_t*)
 2457|  7.56k|        opj_calloc(OPJ_J2K_MCC_DEFAULT_NB_RECORDS,
  ------------------
  |  |  158|  7.56k|#define OPJ_J2K_MCC_DEFAULT_NB_RECORDS      10
  ------------------
 2458|  7.56k|                   sizeof(opj_simple_mcc_decorrelation_data_t));
 2459|       |
 2460|  7.56k|    if (! p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mcc_records) {
  ------------------
  |  Branch (2460:9): [True: 0, False: 7.56k]
  ------------------
 2461|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2462|      0|                      "Not enough memory to take in charge SIZ marker\n");
 2463|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2464|      0|    }
 2465|  7.56k|    p_j2k->m_specific_param.m_decoder.m_default_tcp->m_nb_max_mcc_records =
 2466|  7.56k|        OPJ_J2K_MCC_DEFAULT_NB_RECORDS;
  ------------------
  |  |  158|  7.56k|#define OPJ_J2K_MCC_DEFAULT_NB_RECORDS      10
  ------------------
 2467|       |
 2468|       |    /* set up default dc level shift */
 2469|  36.5k|    for (i = 0; i < l_image->numcomps; ++i) {
  ------------------
  |  Branch (2469:17): [True: 28.9k, False: 7.56k]
  ------------------
 2470|  28.9k|        if (! l_image->comps[i].sgnd) {
  ------------------
  |  Branch (2470:13): [True: 19.2k, False: 9.72k]
  ------------------
 2471|  19.2k|            p_j2k->m_specific_param.m_decoder.m_default_tcp->tccps[i].m_dc_level_shift = 1
 2472|  19.2k|                    << (l_image->comps[i].prec - 1);
 2473|  19.2k|        }
 2474|  28.9k|    }
 2475|       |
 2476|  7.56k|    l_current_tile_param = l_cp->tcps;
 2477|  1.42M|    for (i = 0; i < l_nb_tiles; ++i) {
  ------------------
  |  Branch (2477:17): [True: 1.41M, False: 7.56k]
  ------------------
 2478|  1.41M|        l_current_tile_param->tccps = (opj_tccp_t*) opj_calloc(l_image->numcomps,
 2479|  1.41M|                                      sizeof(opj_tccp_t));
 2480|  1.41M|        if (l_current_tile_param->tccps == 00) {
  ------------------
  |  Branch (2480:13): [True: 0, False: 1.41M]
  ------------------
 2481|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2482|      0|                          "Not enough memory to take in charge SIZ marker\n");
 2483|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2484|      0|        }
 2485|       |
 2486|  1.41M|        ++l_current_tile_param;
 2487|  1.41M|    }
 2488|       |
 2489|  7.56k|    p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_MH;
 2490|  7.56k|    opj_image_comp_header_update(l_image, l_cp);
 2491|       |
 2492|  7.56k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.56k|#define OPJ_TRUE 1
  ------------------
 2493|  7.56k|}
j2k.c:opj_j2k_read_tlm:
 3661|    198|{
 3662|    198|    OPJ_UINT32 l_Ztlm, l_Stlm, l_ST, l_SP, l_tot_num_tp_remaining, l_quotient,
 3663|    198|               l_Ptlm_size;
 3664|       |    /* preconditions */
 3665|    198|    assert(p_header_data != 00);
 3666|    198|    assert(p_j2k != 00);
 3667|    198|    assert(p_manager != 00);
 3668|       |
 3669|    198|    OPJ_UNUSED(p_j2k);
  ------------------
  |  |  219|    198|#define OPJ_UNUSED(x) (void)x
  ------------------
 3670|       |
 3671|    198|    if (p_header_size < 2) {
  ------------------
  |  Branch (3671:9): [True: 1, False: 197]
  ------------------
 3672|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading TLM marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3673|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 3674|      1|    }
 3675|    197|    p_header_size -= 2;
 3676|       |
 3677|    197|    opj_read_bytes(p_header_data, &l_Ztlm,
  ------------------
  |  |   65|    197|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3678|    197|                   1);                              /* Ztlm */
 3679|    197|    ++p_header_data;
 3680|    197|    opj_read_bytes(p_header_data, &l_Stlm,
  ------------------
  |  |   65|    197|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3681|    197|                   1);                              /* Stlm */
 3682|    197|    ++p_header_data;
 3683|       |
 3684|    197|    l_ST = ((l_Stlm >> 4) & 0x3);
 3685|    197|    l_SP = (l_Stlm >> 6) & 0x1;
 3686|       |
 3687|    197|    l_Ptlm_size = (l_SP + 1) * 2;
 3688|    197|    l_quotient = l_Ptlm_size + l_ST;
 3689|       |
 3690|    197|    l_tot_num_tp_remaining = p_header_size % l_quotient;
 3691|       |
 3692|    197|    if (l_tot_num_tp_remaining != 0) {
  ------------------
  |  Branch (3692:9): [True: 1, False: 196]
  ------------------
 3693|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading TLM marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3694|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 3695|      1|    }
 3696|       |    /* FIXME Do not care of this at the moment since only local variables are set here */
 3697|       |    /*
 3698|       |    for
 3699|       |            (i = 0; i < l_tot_num_tp; ++i)
 3700|       |    {
 3701|       |            opj_read_bytes(p_header_data,&l_Ttlm_i,l_ST);                           // Ttlm_i
 3702|       |            p_header_data += l_ST;
 3703|       |            opj_read_bytes(p_header_data,&l_Ptlm_i,l_Ptlm_size);            // Ptlm_i
 3704|       |            p_header_data += l_Ptlm_size;
 3705|       |    }*/
 3706|    196|    return OPJ_TRUE;
  ------------------
  |  |  117|    196|#define OPJ_TRUE 1
  ------------------
 3707|    197|}
j2k.c:opj_j2k_read_plm:
 3722|    990|{
 3723|       |    /* preconditions */
 3724|    990|    assert(p_header_data != 00);
 3725|    990|    assert(p_j2k != 00);
 3726|    990|    assert(p_manager != 00);
 3727|       |
 3728|    990|    OPJ_UNUSED(p_j2k);
  ------------------
  |  |  219|    990|#define OPJ_UNUSED(x) (void)x
  ------------------
 3729|    990|    OPJ_UNUSED(p_header_data);
  ------------------
  |  |  219|    990|#define OPJ_UNUSED(x) (void)x
  ------------------
 3730|       |
 3731|    990|    if (p_header_size < 1) {
  ------------------
  |  Branch (3731:9): [True: 1, False: 989]
  ------------------
 3732|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading PLM marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3733|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 3734|      1|    }
 3735|       |    /* Do not care of this at the moment since only local variables are set here */
 3736|       |    /*
 3737|       |    opj_read_bytes(p_header_data,&l_Zplm,1);                                        // Zplm
 3738|       |    ++p_header_data;
 3739|       |    --p_header_size;
 3740|       |
 3741|       |    while
 3742|       |            (p_header_size > 0)
 3743|       |    {
 3744|       |            opj_read_bytes(p_header_data,&l_Nplm,1);                                // Nplm
 3745|       |            ++p_header_data;
 3746|       |            p_header_size -= (1+l_Nplm);
 3747|       |            if
 3748|       |                    (p_header_size < 0)
 3749|       |            {
 3750|       |                    opj_event_msg(p_manager, EVT_ERROR, "Error reading PLM marker\n");
 3751|       |                    return false;
 3752|       |            }
 3753|       |            for
 3754|       |                    (i = 0; i < l_Nplm; ++i)
 3755|       |            {
 3756|       |                    opj_read_bytes(p_header_data,&l_tmp,1);                         // Iplm_ij
 3757|       |                    ++p_header_data;
 3758|       |                    // take only the last seven bytes
 3759|       |                    l_packet_len |= (l_tmp & 0x7f);
 3760|       |                    if
 3761|       |                            (l_tmp & 0x80)
 3762|       |                    {
 3763|       |                            l_packet_len <<= 7;
 3764|       |                    }
 3765|       |                    else
 3766|       |                    {
 3767|       |            // store packet length and proceed to next packet
 3768|       |                            l_packet_len = 0;
 3769|       |                    }
 3770|       |            }
 3771|       |            if
 3772|       |                    (l_packet_len != 0)
 3773|       |            {
 3774|       |                    opj_event_msg(p_manager, EVT_ERROR, "Error reading PLM marker\n");
 3775|       |                    return false;
 3776|       |            }
 3777|       |    }
 3778|       |    */
 3779|    989|    return OPJ_TRUE;
  ------------------
  |  |  117|    989|#define OPJ_TRUE 1
  ------------------
 3780|    990|}
j2k.c:opj_j2k_read_plt:
 3795|    169|{
 3796|    169|    OPJ_UINT32 l_Zplt, l_tmp, l_packet_len = 0, i;
 3797|       |
 3798|       |    /* preconditions */
 3799|    169|    assert(p_header_data != 00);
 3800|    169|    assert(p_j2k != 00);
 3801|    169|    assert(p_manager != 00);
 3802|       |
 3803|    169|    OPJ_UNUSED(p_j2k);
  ------------------
  |  |  219|    169|#define OPJ_UNUSED(x) (void)x
  ------------------
 3804|       |
 3805|    169|    if (p_header_size < 1) {
  ------------------
  |  Branch (3805:9): [True: 1, False: 168]
  ------------------
 3806|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading PLT marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3807|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 3808|      1|    }
 3809|       |
 3810|    168|    opj_read_bytes(p_header_data, &l_Zplt, 1);              /* Zplt */
  ------------------
  |  |   65|    168|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3811|    168|    ++p_header_data;
 3812|    168|    --p_header_size;
 3813|       |
 3814|  14.9k|    for (i = 0; i < p_header_size; ++i) {
  ------------------
  |  Branch (3814:17): [True: 14.7k, False: 168]
  ------------------
 3815|  14.7k|        opj_read_bytes(p_header_data, &l_tmp, 1);       /* Iplt_ij */
  ------------------
  |  |   65|  14.7k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3816|  14.7k|        ++p_header_data;
 3817|       |        /* take only the last seven bytes */
 3818|  14.7k|        l_packet_len |= (l_tmp & 0x7f);
 3819|  14.7k|        if (l_tmp & 0x80) {
  ------------------
  |  Branch (3819:13): [True: 3.30k, False: 11.4k]
  ------------------
 3820|  3.30k|            l_packet_len <<= 7;
 3821|  11.4k|        } else {
 3822|       |            /* store packet length and proceed to next packet */
 3823|  11.4k|            l_packet_len = 0;
 3824|  11.4k|        }
 3825|  14.7k|    }
 3826|       |
 3827|    168|    if (l_packet_len != 0) {
  ------------------
  |  Branch (3827:9): [True: 13, False: 155]
  ------------------
 3828|     13|        opj_event_msg(p_manager, EVT_ERROR, "Error reading PLT marker\n");
  ------------------
  |  |   66|     13|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3829|     13|        return OPJ_FALSE;
  ------------------
  |  |  118|     13|#define OPJ_FALSE 0
  ------------------
 3830|     13|    }
 3831|       |
 3832|    155|    return OPJ_TRUE;
  ------------------
  |  |  117|    155|#define OPJ_TRUE 1
  ------------------
 3833|    168|}
j2k.c:opj_j2k_read_ppm:
 3849|    222|{
 3850|    222|    opj_cp_t *l_cp = 00;
 3851|    222|    OPJ_UINT32 l_Z_ppm;
 3852|       |
 3853|       |    /* preconditions */
 3854|    222|    assert(p_header_data != 00);
 3855|    222|    assert(p_j2k != 00);
 3856|    222|    assert(p_manager != 00);
 3857|       |
 3858|       |    /* We need to have the Z_ppm element + 1 byte of Nppm/Ippm at minimum */
 3859|    222|    if (p_header_size < 2) {
  ------------------
  |  Branch (3859:9): [True: 2, False: 220]
  ------------------
 3860|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading PPM marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3861|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 3862|      2|    }
 3863|       |
 3864|    220|    l_cp = &(p_j2k->m_cp);
 3865|    220|    l_cp->ppm = 1;
 3866|       |
 3867|    220|    opj_read_bytes(p_header_data, &l_Z_ppm, 1);             /* Z_ppm */
  ------------------
  |  |   65|    220|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3868|    220|    ++p_header_data;
 3869|    220|    --p_header_size;
 3870|       |
 3871|       |    /* check allocation needed */
 3872|    220|    if (l_cp->ppm_markers == NULL) { /* first PPM marker */
  ------------------
  |  Branch (3872:9): [True: 88, False: 132]
  ------------------
 3873|     88|        OPJ_UINT32 l_newCount = l_Z_ppm + 1U; /* can't overflow, l_Z_ppm is UINT8 */
 3874|     88|        assert(l_cp->ppm_markers_count == 0U);
 3875|       |
 3876|     88|        l_cp->ppm_markers = (opj_ppx *) opj_calloc(l_newCount, sizeof(opj_ppx));
 3877|     88|        if (l_cp->ppm_markers == NULL) {
  ------------------
  |  Branch (3877:13): [True: 0, False: 88]
  ------------------
 3878|      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 */
  ------------------
 3879|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3880|      0|        }
 3881|     88|        l_cp->ppm_markers_count = l_newCount;
 3882|    132|    } else if (l_cp->ppm_markers_count <= l_Z_ppm) {
  ------------------
  |  Branch (3882:16): [True: 74, False: 58]
  ------------------
 3883|     74|        OPJ_UINT32 l_newCount = l_Z_ppm + 1U; /* can't overflow, l_Z_ppm is UINT8 */
 3884|     74|        opj_ppx *new_ppm_markers;
 3885|     74|        new_ppm_markers = (opj_ppx *) opj_realloc(l_cp->ppm_markers,
 3886|     74|                          l_newCount * sizeof(opj_ppx));
 3887|     74|        if (new_ppm_markers == NULL) {
  ------------------
  |  Branch (3887:13): [True: 0, False: 74]
  ------------------
 3888|       |            /* clean up to be done on l_cp destruction */
 3889|      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 */
  ------------------
 3890|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3891|      0|        }
 3892|     74|        l_cp->ppm_markers = new_ppm_markers;
 3893|     74|        memset(l_cp->ppm_markers + l_cp->ppm_markers_count, 0,
 3894|     74|               (l_newCount - l_cp->ppm_markers_count) * sizeof(opj_ppx));
 3895|     74|        l_cp->ppm_markers_count = l_newCount;
 3896|     74|    }
 3897|       |
 3898|    220|    if (l_cp->ppm_markers[l_Z_ppm].m_data != NULL) {
  ------------------
  |  Branch (3898:9): [True: 2, False: 218]
  ------------------
 3899|       |        /* clean up to be done on l_cp destruction */
 3900|      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 */
  ------------------
 3901|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 3902|      2|    }
 3903|       |
 3904|    218|    l_cp->ppm_markers[l_Z_ppm].m_data = (OPJ_BYTE *) opj_malloc(p_header_size);
 3905|    218|    if (l_cp->ppm_markers[l_Z_ppm].m_data == NULL) {
  ------------------
  |  Branch (3905:9): [True: 0, False: 218]
  ------------------
 3906|       |        /* clean up to be done on l_cp destruction */
 3907|      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 */
  ------------------
 3908|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3909|      0|    }
 3910|    218|    l_cp->ppm_markers[l_Z_ppm].m_data_size = p_header_size;
 3911|    218|    memcpy(l_cp->ppm_markers[l_Z_ppm].m_data, p_header_data, p_header_size);
 3912|       |
 3913|    218|    return OPJ_TRUE;
  ------------------
  |  |  117|    218|#define OPJ_TRUE 1
  ------------------
 3914|    218|}
j2k.c:opj_j2k_read_ppt:
 4067|     58|{
 4068|     58|    opj_cp_t *l_cp = 00;
 4069|     58|    opj_tcp_t *l_tcp = 00;
 4070|     58|    OPJ_UINT32 l_Z_ppt;
 4071|       |
 4072|       |    /* preconditions */
 4073|     58|    assert(p_header_data != 00);
 4074|     58|    assert(p_j2k != 00);
 4075|     58|    assert(p_manager != 00);
 4076|       |
 4077|       |    /* We need to have the Z_ppt element + 1 byte of Ippt at minimum */
 4078|     58|    if (p_header_size < 2) {
  ------------------
  |  Branch (4078:9): [True: 1, False: 57]
  ------------------
 4079|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading PPT marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4080|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 4081|      1|    }
 4082|       |
 4083|     57|    l_cp = &(p_j2k->m_cp);
 4084|     57|    if (l_cp->ppm) {
  ------------------
  |  Branch (4084:9): [True: 1, False: 56]
  ------------------
 4085|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4086|      1|                      "Error reading PPT marker: packet header have been previously found in the main header (PPM marker).\n");
 4087|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 4088|      1|    }
 4089|       |
 4090|     56|    l_tcp = &(l_cp->tcps[p_j2k->m_current_tile_number]);
 4091|     56|    l_tcp->ppt = 1;
 4092|       |
 4093|     56|    opj_read_bytes(p_header_data, &l_Z_ppt, 1);             /* Z_ppt */
  ------------------
  |  |   65|     56|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4094|     56|    ++p_header_data;
 4095|     56|    --p_header_size;
 4096|       |
 4097|       |    /* check allocation needed */
 4098|     56|    if (l_tcp->ppt_markers == NULL) { /* first PPT marker */
  ------------------
  |  Branch (4098:9): [True: 33, False: 23]
  ------------------
 4099|     33|        OPJ_UINT32 l_newCount = l_Z_ppt + 1U; /* can't overflow, l_Z_ppt is UINT8 */
 4100|     33|        assert(l_tcp->ppt_markers_count == 0U);
 4101|       |
 4102|     33|        l_tcp->ppt_markers = (opj_ppx *) opj_calloc(l_newCount, sizeof(opj_ppx));
 4103|     33|        if (l_tcp->ppt_markers == NULL) {
  ------------------
  |  Branch (4103:13): [True: 0, False: 33]
  ------------------
 4104|      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 */
  ------------------
 4105|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4106|      0|        }
 4107|     33|        l_tcp->ppt_markers_count = l_newCount;
 4108|     33|    } else if (l_tcp->ppt_markers_count <= l_Z_ppt) {
  ------------------
  |  Branch (4108:16): [True: 7, False: 16]
  ------------------
 4109|      7|        OPJ_UINT32 l_newCount = l_Z_ppt + 1U; /* can't overflow, l_Z_ppt is UINT8 */
 4110|      7|        opj_ppx *new_ppt_markers;
 4111|      7|        new_ppt_markers = (opj_ppx *) opj_realloc(l_tcp->ppt_markers,
 4112|      7|                          l_newCount * sizeof(opj_ppx));
 4113|      7|        if (new_ppt_markers == NULL) {
  ------------------
  |  Branch (4113:13): [True: 0, False: 7]
  ------------------
 4114|       |            /* clean up to be done on l_tcp destruction */
 4115|      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 */
  ------------------
 4116|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4117|      0|        }
 4118|      7|        l_tcp->ppt_markers = new_ppt_markers;
 4119|      7|        memset(l_tcp->ppt_markers + l_tcp->ppt_markers_count, 0,
 4120|      7|               (l_newCount - l_tcp->ppt_markers_count) * sizeof(opj_ppx));
 4121|      7|        l_tcp->ppt_markers_count = l_newCount;
 4122|      7|    }
 4123|       |
 4124|     56|    if (l_tcp->ppt_markers[l_Z_ppt].m_data != NULL) {
  ------------------
  |  Branch (4124:9): [True: 2, False: 54]
  ------------------
 4125|       |        /* clean up to be done on l_tcp destruction */
 4126|      2|        opj_event_msg(p_manager, EVT_ERROR, "Zppt %u already read\n", l_Z_ppt);
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4127|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 4128|      2|    }
 4129|       |
 4130|     54|    l_tcp->ppt_markers[l_Z_ppt].m_data = (OPJ_BYTE *) opj_malloc(p_header_size);
 4131|     54|    if (l_tcp->ppt_markers[l_Z_ppt].m_data == NULL) {
  ------------------
  |  Branch (4131:9): [True: 0, False: 54]
  ------------------
 4132|       |        /* clean up to be done on l_tcp destruction */
 4133|      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 */
  ------------------
 4134|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4135|      0|    }
 4136|     54|    l_tcp->ppt_markers[l_Z_ppt].m_data_size = p_header_size;
 4137|     54|    memcpy(l_tcp->ppt_markers[l_Z_ppt].m_data, p_header_data, p_header_size);
 4138|     54|    return OPJ_TRUE;
  ------------------
  |  |  117|     54|#define OPJ_TRUE 1
  ------------------
 4139|     54|}
j2k.c:opj_j2k_read_crg:
 3619|     40|{
 3620|     40|    OPJ_UINT32 l_nb_comp;
 3621|       |    /* preconditions */
 3622|     40|    assert(p_header_data != 00);
 3623|     40|    assert(p_j2k != 00);
 3624|     40|    assert(p_manager != 00);
 3625|       |
 3626|     40|    OPJ_UNUSED(p_header_data);
  ------------------
  |  |  219|     40|#define OPJ_UNUSED(x) (void)x
  ------------------
 3627|       |
 3628|     40|    l_nb_comp = p_j2k->m_private_image->numcomps;
 3629|       |
 3630|     40|    if (p_header_size != l_nb_comp * 4) {
  ------------------
  |  Branch (3630:9): [True: 6, False: 34]
  ------------------
 3631|      6|        opj_event_msg(p_manager, EVT_ERROR, "Error reading CRG marker\n");
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3632|      6|        return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
 3633|      6|    }
 3634|       |    /* Do not care of this at the moment since only local variables are set here */
 3635|       |    /*
 3636|       |    for
 3637|       |            (i = 0; i < l_nb_comp; ++i)
 3638|       |    {
 3639|       |            opj_read_bytes(p_header_data,&l_Xcrg_i,2);                              // Xcrg_i
 3640|       |            p_header_data+=2;
 3641|       |            opj_read_bytes(p_header_data,&l_Ycrg_i,2);                              // Xcrg_i
 3642|       |            p_header_data+=2;
 3643|       |    }
 3644|       |    */
 3645|     34|    return OPJ_TRUE;
  ------------------
  |  |  117|     34|#define OPJ_TRUE 1
  ------------------
 3646|     40|}
j2k.c:opj_j2k_read_com:
 2565|    621|{
 2566|       |    /* preconditions */
 2567|    621|    assert(p_j2k != 00);
 2568|    621|    assert(p_manager != 00);
 2569|    621|    assert(p_header_data != 00);
 2570|       |
 2571|    621|    OPJ_UNUSED(p_j2k);
  ------------------
  |  |  219|    621|#define OPJ_UNUSED(x) (void)x
  ------------------
 2572|    621|    OPJ_UNUSED(p_header_data);
  ------------------
  |  |  219|    621|#define OPJ_UNUSED(x) (void)x
  ------------------
 2573|    621|    OPJ_UNUSED(p_header_size);
  ------------------
  |  |  219|    621|#define OPJ_UNUSED(x) (void)x
  ------------------
 2574|    621|    OPJ_UNUSED(p_manager);
  ------------------
  |  |  219|    621|#define OPJ_UNUSED(x) (void)x
  ------------------
 2575|       |
 2576|    621|    return OPJ_TRUE;
  ------------------
  |  |  117|    621|#define OPJ_TRUE 1
  ------------------
 2577|    621|}
j2k.c:opj_j2k_read_mct:
 5809|  5.93k|{
 5810|  5.93k|    OPJ_UINT32 i;
 5811|  5.93k|    opj_tcp_t *l_tcp = 00;
 5812|  5.93k|    OPJ_UINT32 l_tmp;
 5813|  5.93k|    OPJ_UINT32 l_indix;
 5814|  5.93k|    opj_mct_data_t * l_mct_data;
 5815|       |
 5816|       |    /* preconditions */
 5817|  5.93k|    assert(p_header_data != 00);
 5818|  5.93k|    assert(p_j2k != 00);
 5819|       |
 5820|  5.93k|    l_tcp = p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH ?
  ------------------
  |  Branch (5820:13): [True: 37, False: 5.89k]
  ------------------
 5821|     37|            &p_j2k->m_cp.tcps[p_j2k->m_current_tile_number] :
 5822|  5.93k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 5823|       |
 5824|  5.93k|    if (p_header_size < 2) {
  ------------------
  |  Branch (5824:9): [True: 2, False: 5.92k]
  ------------------
 5825|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCT marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5826|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 5827|      2|    }
 5828|       |
 5829|       |    /* first marker */
 5830|  5.92k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Zmct */
  ------------------
  |  |   65|  5.92k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5831|  5.92k|    p_header_data += 2;
 5832|  5.92k|    if (l_tmp != 0) {
  ------------------
  |  Branch (5832:9): [True: 690, False: 5.23k]
  ------------------
 5833|    690|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    690|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 5834|    690|                      "Cannot take in charge mct data within multiple MCT records\n");
 5835|    690|        return OPJ_TRUE;
  ------------------
  |  |  117|    690|#define OPJ_TRUE 1
  ------------------
 5836|    690|    }
 5837|       |
 5838|  5.23k|    if (p_header_size <= 6) {
  ------------------
  |  Branch (5838:9): [True: 1, False: 5.23k]
  ------------------
 5839|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCT marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5840|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 5841|      1|    }
 5842|       |
 5843|       |    /* Imct -> no need for other values, take the first, type is double with decorrelation x0000 1101 0000 0000*/
 5844|  5.23k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Imct */
  ------------------
  |  |   65|  5.23k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5845|  5.23k|    p_header_data += 2;
 5846|       |
 5847|  5.23k|    l_indix = l_tmp & 0xff;
 5848|  5.23k|    l_mct_data = l_tcp->m_mct_records;
 5849|       |
 5850|  12.4k|    for (i = 0; i < l_tcp->m_nb_mct_records; ++i) {
  ------------------
  |  Branch (5850:17): [True: 11.8k, False: 568]
  ------------------
 5851|  11.8k|        if (l_mct_data->m_index == l_indix) {
  ------------------
  |  Branch (5851:13): [True: 4.66k, False: 7.17k]
  ------------------
 5852|  4.66k|            break;
 5853|  4.66k|        }
 5854|  7.17k|        ++l_mct_data;
 5855|  7.17k|    }
 5856|       |
 5857|       |    /* NOT FOUND */
 5858|  5.23k|    if (i == l_tcp->m_nb_mct_records) {
  ------------------
  |  Branch (5858:9): [True: 568, False: 4.66k]
  ------------------
 5859|    568|        if (l_tcp->m_nb_mct_records == l_tcp->m_nb_max_mct_records) {
  ------------------
  |  Branch (5859:13): [True: 20, False: 548]
  ------------------
 5860|     20|            opj_mct_data_t *new_mct_records;
 5861|     20|            l_tcp->m_nb_max_mct_records += OPJ_J2K_MCT_DEFAULT_NB_RECORDS;
  ------------------
  |  |  159|     20|#define OPJ_J2K_MCT_DEFAULT_NB_RECORDS      10
  ------------------
 5862|       |
 5863|     20|            new_mct_records = (opj_mct_data_t *) opj_realloc(l_tcp->m_mct_records,
 5864|     20|                              l_tcp->m_nb_max_mct_records * sizeof(opj_mct_data_t));
 5865|     20|            if (! new_mct_records) {
  ------------------
  |  Branch (5865:17): [True: 0, False: 20]
  ------------------
 5866|      0|                opj_free(l_tcp->m_mct_records);
 5867|      0|                l_tcp->m_mct_records = NULL;
 5868|      0|                l_tcp->m_nb_max_mct_records = 0;
 5869|      0|                l_tcp->m_nb_mct_records = 0;
 5870|      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 */
  ------------------
 5871|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5872|      0|            }
 5873|       |
 5874|       |            /* Update m_mcc_records[].m_offset_array and m_decorrelation_array
 5875|       |             * to point to the new addresses */
 5876|     20|            if (new_mct_records != l_tcp->m_mct_records) {
  ------------------
  |  Branch (5876:17): [True: 14, False: 6]
  ------------------
 5877|     68|                for (i = 0; i < l_tcp->m_nb_mcc_records; ++i) {
  ------------------
  |  Branch (5877:29): [True: 54, False: 14]
  ------------------
 5878|     54|                    opj_simple_mcc_decorrelation_data_t* l_mcc_record =
 5879|     54|                        &(l_tcp->m_mcc_records[i]);
 5880|     54|                    if (l_mcc_record->m_decorrelation_array) {
  ------------------
  |  Branch (5880:25): [True: 14, False: 40]
  ------------------
 5881|     14|                        l_mcc_record->m_decorrelation_array =
 5882|     14|                            new_mct_records +
 5883|     14|                            (l_mcc_record->m_decorrelation_array -
 5884|     14|                             l_tcp->m_mct_records);
 5885|     14|                    }
 5886|     54|                    if (l_mcc_record->m_offset_array) {
  ------------------
  |  Branch (5886:25): [True: 18, False: 36]
  ------------------
 5887|     18|                        l_mcc_record->m_offset_array =
 5888|     18|                            new_mct_records +
 5889|     18|                            (l_mcc_record->m_offset_array -
 5890|     18|                             l_tcp->m_mct_records);
 5891|     18|                    }
 5892|     54|                }
 5893|     14|            }
 5894|       |
 5895|     20|            l_tcp->m_mct_records = new_mct_records;
 5896|     20|            l_mct_data = l_tcp->m_mct_records + l_tcp->m_nb_mct_records;
 5897|     20|            memset(l_mct_data, 0, (l_tcp->m_nb_max_mct_records - l_tcp->m_nb_mct_records) *
 5898|     20|                   sizeof(opj_mct_data_t));
 5899|     20|        }
 5900|       |
 5901|    568|        l_mct_data = l_tcp->m_mct_records + l_tcp->m_nb_mct_records;
 5902|    568|        ++l_tcp->m_nb_mct_records;
 5903|    568|    }
 5904|       |
 5905|  5.23k|    if (l_mct_data->m_data) {
  ------------------
  |  Branch (5905:9): [True: 2.03k, False: 3.20k]
  ------------------
 5906|  2.03k|        opj_free(l_mct_data->m_data);
 5907|  2.03k|        l_mct_data->m_data = 00;
 5908|  2.03k|        l_mct_data->m_data_size = 0;
 5909|  2.03k|    }
 5910|       |
 5911|  5.23k|    l_mct_data->m_index = l_indix;
 5912|  5.23k|    l_mct_data->m_array_type = (J2K_MCT_ARRAY_TYPE)((l_tmp  >> 8) & 3);
 5913|  5.23k|    l_mct_data->m_element_type = (J2K_MCT_ELEMENT_TYPE)((l_tmp  >> 10) & 3);
 5914|       |
 5915|  5.23k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Ymct */
  ------------------
  |  |   65|  5.23k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5916|  5.23k|    p_header_data += 2;
 5917|  5.23k|    if (l_tmp != 0) {
  ------------------
  |  Branch (5917:9): [True: 3.06k, False: 2.17k]
  ------------------
 5918|  3.06k|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  3.06k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 5919|  3.06k|                      "Cannot take in charge multiple MCT markers\n");
 5920|  3.06k|        return OPJ_TRUE;
  ------------------
  |  |  117|  3.06k|#define OPJ_TRUE 1
  ------------------
 5921|  3.06k|    }
 5922|       |
 5923|  2.17k|    p_header_size -= 6;
 5924|       |
 5925|  2.17k|    l_mct_data->m_data = (OPJ_BYTE*)opj_malloc(p_header_size);
 5926|  2.17k|    if (! l_mct_data->m_data) {
  ------------------
  |  Branch (5926:9): [True: 0, False: 2.17k]
  ------------------
 5927|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5928|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5929|      0|    }
 5930|  2.17k|    memcpy(l_mct_data->m_data, p_header_data, p_header_size);
 5931|       |
 5932|  2.17k|    l_mct_data->m_data_size = p_header_size;
 5933|       |
 5934|  2.17k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.17k|#define OPJ_TRUE 1
  ------------------
 5935|  2.17k|}
j2k.c:opj_j2k_read_cbd:
 6583|    107|{
 6584|    107|    OPJ_UINT32 l_nb_comp, l_num_comp;
 6585|    107|    OPJ_UINT32 l_comp_def;
 6586|    107|    OPJ_UINT32 i;
 6587|    107|    opj_image_comp_t * l_comp = 00;
 6588|       |
 6589|       |    /* preconditions */
 6590|    107|    assert(p_header_data != 00);
 6591|    107|    assert(p_j2k != 00);
 6592|    107|    assert(p_manager != 00);
 6593|       |
 6594|    107|    l_num_comp = p_j2k->m_private_image->numcomps;
 6595|       |
 6596|    107|    if (p_header_size != (p_j2k->m_private_image->numcomps + 2)) {
  ------------------
  |  Branch (6596:9): [True: 2, False: 105]
  ------------------
 6597|      2|        opj_event_msg(p_manager, EVT_ERROR, "Crror reading CBD marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6598|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 6599|      2|    }
 6600|       |
 6601|    105|    opj_read_bytes(p_header_data, &l_nb_comp,
  ------------------
  |  |   65|    105|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6602|    105|                   2);                           /* Ncbd */
 6603|    105|    p_header_data += 2;
 6604|       |
 6605|    105|    if (l_nb_comp != l_num_comp) {
  ------------------
  |  Branch (6605:9): [True: 2, False: 103]
  ------------------
 6606|      2|        opj_event_msg(p_manager, EVT_ERROR, "Crror reading CBD marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6607|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 6608|      2|    }
 6609|       |
 6610|    103|    l_comp = p_j2k->m_private_image->comps;
 6611|    509|    for (i = 0; i < l_num_comp; ++i) {
  ------------------
  |  Branch (6611:17): [True: 409, False: 100]
  ------------------
 6612|    409|        opj_read_bytes(p_header_data, &l_comp_def,
  ------------------
  |  |   65|    409|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6613|    409|                       1);                  /* Component bit depth */
 6614|    409|        ++p_header_data;
 6615|    409|        l_comp->sgnd = (l_comp_def >> 7) & 1;
 6616|    409|        l_comp->prec = (l_comp_def & 0x7f) + 1;
 6617|       |
 6618|    409|        if (l_comp->prec > 31) {
  ------------------
  |  Branch (6618:13): [True: 3, False: 406]
  ------------------
 6619|      3|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6620|      3|                          "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",
 6621|      3|                          i, l_comp->prec);
 6622|      3|            return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 6623|      3|        }
 6624|    406|        ++l_comp;
 6625|    406|    }
 6626|       |
 6627|    100|    return OPJ_TRUE;
  ------------------
  |  |  117|    100|#define OPJ_TRUE 1
  ------------------
 6628|    103|}
j2k.c:opj_j2k_read_cap:
 6644|  25.3k|{
 6645|       |    /* preconditions */
 6646|  25.3k|    assert(p_header_data != 00);
 6647|  25.3k|    assert(p_j2k != 00);
 6648|  25.3k|    assert(p_manager != 00);
 6649|       |
 6650|  25.3k|    (void)p_j2k;
 6651|  25.3k|    (void)p_header_data;
 6652|  25.3k|    (void)p_header_size;
 6653|  25.3k|    (void)p_manager;
 6654|       |
 6655|  25.3k|    return OPJ_TRUE;
  ------------------
  |  |  117|  25.3k|#define OPJ_TRUE 1
  ------------------
 6656|  25.3k|}
j2k.c:opj_j2k_read_cpf:
 6670|    301|{
 6671|       |    /* preconditions */
 6672|    301|    assert(p_header_data != 00);
 6673|    301|    assert(p_j2k != 00);
 6674|    301|    assert(p_manager != 00);
 6675|       |
 6676|    301|    (void)p_j2k;
 6677|    301|    (void)p_header_data;
 6678|    301|    (void)p_header_size;
 6679|    301|    (void)p_manager;
 6680|       |
 6681|    301|    return OPJ_TRUE;
  ------------------
  |  |  117|    301|#define OPJ_TRUE 1
  ------------------
 6682|    301|}
j2k.c:opj_j2k_read_mcc:
 6056|  6.07k|{
 6057|  6.07k|    OPJ_UINT32 i, j;
 6058|  6.07k|    OPJ_UINT32 l_tmp;
 6059|  6.07k|    OPJ_UINT32 l_indix;
 6060|  6.07k|    opj_tcp_t * l_tcp;
 6061|  6.07k|    opj_simple_mcc_decorrelation_data_t * l_mcc_record;
 6062|  6.07k|    opj_mct_data_t * l_mct_data;
 6063|  6.07k|    OPJ_UINT32 l_nb_collections;
 6064|  6.07k|    OPJ_UINT32 l_nb_comps;
 6065|  6.07k|    OPJ_UINT32 l_nb_bytes_by_comp;
 6066|  6.07k|    OPJ_BOOL l_new_mcc = OPJ_FALSE;
  ------------------
  |  |  118|  6.07k|#define OPJ_FALSE 0
  ------------------
 6067|       |
 6068|       |    /* preconditions */
 6069|  6.07k|    assert(p_header_data != 00);
 6070|  6.07k|    assert(p_j2k != 00);
 6071|  6.07k|    assert(p_manager != 00);
 6072|       |
 6073|  6.07k|    l_tcp = p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH ?
  ------------------
  |  Branch (6073:13): [True: 63, False: 6.00k]
  ------------------
 6074|     63|            &p_j2k->m_cp.tcps[p_j2k->m_current_tile_number] :
 6075|  6.07k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 6076|       |
 6077|  6.07k|    if (p_header_size < 2) {
  ------------------
  |  Branch (6077:9): [True: 1, False: 6.07k]
  ------------------
 6078|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6079|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6080|      1|    }
 6081|       |
 6082|       |    /* first marker */
 6083|  6.07k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Zmcc */
  ------------------
  |  |   65|  6.07k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6084|  6.07k|    p_header_data += 2;
 6085|  6.07k|    if (l_tmp != 0) {
  ------------------
  |  Branch (6085:9): [True: 366, False: 5.70k]
  ------------------
 6086|    366|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    366|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6087|    366|                      "Cannot take in charge multiple data spanning\n");
 6088|    366|        return OPJ_TRUE;
  ------------------
  |  |  117|    366|#define OPJ_TRUE 1
  ------------------
 6089|    366|    }
 6090|       |
 6091|  5.70k|    if (p_header_size < 7) {
  ------------------
  |  Branch (6091:9): [True: 3, False: 5.70k]
  ------------------
 6092|      3|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6093|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 6094|      3|    }
 6095|       |
 6096|  5.70k|    opj_read_bytes(p_header_data, &l_indix,
  ------------------
  |  |   65|  5.70k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6097|  5.70k|                   1); /* Imcc -> no need for other values, take the first */
 6098|  5.70k|    ++p_header_data;
 6099|       |
 6100|  5.70k|    l_mcc_record = l_tcp->m_mcc_records;
 6101|       |
 6102|  9.53k|    for (i = 0; i < l_tcp->m_nb_mcc_records; ++i) {
  ------------------
  |  Branch (6102:17): [True: 6.92k, False: 2.61k]
  ------------------
 6103|  6.92k|        if (l_mcc_record->m_index == l_indix) {
  ------------------
  |  Branch (6103:13): [True: 3.08k, False: 3.83k]
  ------------------
 6104|  3.08k|            break;
 6105|  3.08k|        }
 6106|  3.83k|        ++l_mcc_record;
 6107|  3.83k|    }
 6108|       |
 6109|       |    /** NOT FOUND */
 6110|  5.70k|    if (i == l_tcp->m_nb_mcc_records) {
  ------------------
  |  Branch (6110:9): [True: 2.61k, False: 3.08k]
  ------------------
 6111|  2.61k|        if (l_tcp->m_nb_mcc_records == l_tcp->m_nb_max_mcc_records) {
  ------------------
  |  Branch (6111:13): [True: 1, False: 2.61k]
  ------------------
 6112|      1|            opj_simple_mcc_decorrelation_data_t *new_mcc_records;
 6113|      1|            l_tcp->m_nb_max_mcc_records += OPJ_J2K_MCC_DEFAULT_NB_RECORDS;
  ------------------
  |  |  158|      1|#define OPJ_J2K_MCC_DEFAULT_NB_RECORDS      10
  ------------------
 6114|       |
 6115|      1|            new_mcc_records = (opj_simple_mcc_decorrelation_data_t *) opj_realloc(
 6116|      1|                                  l_tcp->m_mcc_records, l_tcp->m_nb_max_mcc_records * sizeof(
 6117|      1|                                      opj_simple_mcc_decorrelation_data_t));
 6118|      1|            if (! new_mcc_records) {
  ------------------
  |  Branch (6118:17): [True: 0, False: 1]
  ------------------
 6119|      0|                opj_free(l_tcp->m_mcc_records);
 6120|      0|                l_tcp->m_mcc_records = NULL;
 6121|      0|                l_tcp->m_nb_max_mcc_records = 0;
 6122|      0|                l_tcp->m_nb_mcc_records = 0;
 6123|      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 */
  ------------------
 6124|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6125|      0|            }
 6126|      1|            l_tcp->m_mcc_records = new_mcc_records;
 6127|      1|            l_mcc_record = l_tcp->m_mcc_records + l_tcp->m_nb_mcc_records;
 6128|      1|            memset(l_mcc_record, 0, (l_tcp->m_nb_max_mcc_records - l_tcp->m_nb_mcc_records)
 6129|      1|                   * sizeof(opj_simple_mcc_decorrelation_data_t));
 6130|      1|        }
 6131|  2.61k|        l_mcc_record = l_tcp->m_mcc_records + l_tcp->m_nb_mcc_records;
 6132|  2.61k|        l_new_mcc = OPJ_TRUE;
  ------------------
  |  |  117|  2.61k|#define OPJ_TRUE 1
  ------------------
 6133|  2.61k|    }
 6134|  5.70k|    l_mcc_record->m_index = l_indix;
 6135|       |
 6136|       |    /* only one marker atm */
 6137|  5.70k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Ymcc */
  ------------------
  |  |   65|  5.70k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6138|  5.70k|    p_header_data += 2;
 6139|  5.70k|    if (l_tmp != 0) {
  ------------------
  |  Branch (6139:9): [True: 1.51k, False: 4.18k]
  ------------------
 6140|  1.51k|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  1.51k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6141|  1.51k|                      "Cannot take in charge multiple data spanning\n");
 6142|  1.51k|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.51k|#define OPJ_TRUE 1
  ------------------
 6143|  1.51k|    }
 6144|       |
 6145|  4.18k|    opj_read_bytes(p_header_data, &l_nb_collections,
  ------------------
  |  |   65|  4.18k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6146|  4.18k|                   2);                              /* Qmcc -> number of collections -> 1 */
 6147|  4.18k|    p_header_data += 2;
 6148|       |
 6149|  4.18k|    if (l_nb_collections > 1) {
  ------------------
  |  Branch (6149:9): [True: 366, False: 3.82k]
  ------------------
 6150|    366|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    366|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6151|    366|                      "Cannot take in charge multiple collections\n");
 6152|    366|        return OPJ_TRUE;
  ------------------
  |  |  117|    366|#define OPJ_TRUE 1
  ------------------
 6153|    366|    }
 6154|       |
 6155|  3.82k|    p_header_size -= 7;
 6156|       |
 6157|  4.99k|    for (i = 0; i < l_nb_collections; ++i) {
  ------------------
  |  Branch (6157:17): [True: 2.02k, False: 2.96k]
  ------------------
 6158|  2.02k|        if (p_header_size < 3) {
  ------------------
  |  Branch (6158:13): [True: 1, False: 2.02k]
  ------------------
 6159|      1|            opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6160|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6161|      1|        }
 6162|       |
 6163|  2.02k|        opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|  2.02k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6164|  2.02k|                       1); /* Xmcci type of component transformation -> array based decorrelation */
 6165|  2.02k|        ++p_header_data;
 6166|       |
 6167|  2.02k|        if (l_tmp != 1) {
  ------------------
  |  Branch (6167:13): [True: 384, False: 1.64k]
  ------------------
 6168|    384|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    384|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6169|    384|                          "Cannot take in charge collections other than array decorrelation\n");
 6170|    384|            return OPJ_TRUE;
  ------------------
  |  |  117|    384|#define OPJ_TRUE 1
  ------------------
 6171|    384|        }
 6172|       |
 6173|  1.64k|        opj_read_bytes(p_header_data, &l_nb_comps, 2);
  ------------------
  |  |   65|  1.64k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6174|       |
 6175|  1.64k|        p_header_data += 2;
 6176|  1.64k|        p_header_size -= 3;
 6177|       |
 6178|  1.64k|        l_nb_bytes_by_comp = 1 + (l_nb_comps >> 15);
 6179|  1.64k|        l_mcc_record->m_nb_comps = l_nb_comps & 0x7fff;
 6180|       |
 6181|  1.64k|        if (p_header_size < (l_nb_bytes_by_comp * l_mcc_record->m_nb_comps + 2)) {
  ------------------
  |  Branch (6181:13): [True: 2, False: 1.64k]
  ------------------
 6182|      2|            opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6183|      2|            return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 6184|      2|        }
 6185|       |
 6186|  1.64k|        p_header_size -= (l_nb_bytes_by_comp * l_mcc_record->m_nb_comps + 2);
 6187|       |
 6188|  2.26k|        for (j = 0; j < l_mcc_record->m_nb_comps; ++j) {
  ------------------
  |  Branch (6188:21): [True: 691, False: 1.56k]
  ------------------
 6189|    691|            opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|    691|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6190|    691|                           l_nb_bytes_by_comp);      /* Cmccij Component offset*/
 6191|    691|            p_header_data += l_nb_bytes_by_comp;
 6192|       |
 6193|    691|            if (l_tmp != j) {
  ------------------
  |  Branch (6193:17): [True: 72, False: 619]
  ------------------
 6194|     72|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|     72|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6195|     72|                              "Cannot take in charge collections with indix shuffle\n");
 6196|     72|                return OPJ_TRUE;
  ------------------
  |  |  117|     72|#define OPJ_TRUE 1
  ------------------
 6197|     72|            }
 6198|    691|        }
 6199|       |
 6200|  1.56k|        opj_read_bytes(p_header_data, &l_nb_comps, 2);
  ------------------
  |  |   65|  1.56k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6201|  1.56k|        p_header_data += 2;
 6202|       |
 6203|  1.56k|        l_nb_bytes_by_comp = 1 + (l_nb_comps >> 15);
 6204|  1.56k|        l_nb_comps &= 0x7fff;
 6205|       |
 6206|  1.56k|        if (l_nb_comps != l_mcc_record->m_nb_comps) {
  ------------------
  |  Branch (6206:13): [True: 354, False: 1.21k]
  ------------------
 6207|    354|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    354|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6208|    354|                          "Cannot take in charge collections without same number of indixes\n");
 6209|    354|            return OPJ_TRUE;
  ------------------
  |  |  117|    354|#define OPJ_TRUE 1
  ------------------
 6210|    354|        }
 6211|       |
 6212|  1.21k|        if (p_header_size < (l_nb_bytes_by_comp * l_mcc_record->m_nb_comps + 3)) {
  ------------------
  |  Branch (6212:13): [True: 1, False: 1.21k]
  ------------------
 6213|      1|            opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6214|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6215|      1|        }
 6216|       |
 6217|  1.21k|        p_header_size -= (l_nb_bytes_by_comp * l_mcc_record->m_nb_comps + 3);
 6218|       |
 6219|  1.41k|        for (j = 0; j < l_mcc_record->m_nb_comps; ++j) {
  ------------------
  |  Branch (6219:21): [True: 241, False: 1.17k]
  ------------------
 6220|    241|            opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|    241|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6221|    241|                           l_nb_bytes_by_comp);      /* Wmccij Component offset*/
 6222|    241|            p_header_data += l_nb_bytes_by_comp;
 6223|       |
 6224|    241|            if (l_tmp != j) {
  ------------------
  |  Branch (6224:17): [True: 39, False: 202]
  ------------------
 6225|     39|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|     39|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6226|     39|                              "Cannot take in charge collections with indix shuffle\n");
 6227|     39|                return OPJ_TRUE;
  ------------------
  |  |  117|     39|#define OPJ_TRUE 1
  ------------------
 6228|     39|            }
 6229|    241|        }
 6230|       |
 6231|  1.17k|        opj_read_bytes(p_header_data, &l_tmp, 3); /* Wmccij Component offset*/
  ------------------
  |  |   65|  1.17k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6232|  1.17k|        p_header_data += 3;
 6233|       |
 6234|  1.17k|        l_mcc_record->m_is_irreversible = !((l_tmp >> 16) & 1);
 6235|  1.17k|        l_mcc_record->m_decorrelation_array = 00;
 6236|  1.17k|        l_mcc_record->m_offset_array = 00;
 6237|       |
 6238|  1.17k|        l_indix = l_tmp & 0xff;
 6239|  1.17k|        if (l_indix != 0) {
  ------------------
  |  Branch (6239:13): [True: 123, False: 1.05k]
  ------------------
 6240|    123|            l_mct_data = l_tcp->m_mct_records;
 6241|    421|            for (j = 0; j < l_tcp->m_nb_mct_records; ++j) {
  ------------------
  |  Branch (6241:25): [True: 418, False: 3]
  ------------------
 6242|    418|                if (l_mct_data->m_index == l_indix) {
  ------------------
  |  Branch (6242:21): [True: 120, False: 298]
  ------------------
 6243|    120|                    l_mcc_record->m_decorrelation_array = l_mct_data;
 6244|    120|                    break;
 6245|    120|                }
 6246|    298|                ++l_mct_data;
 6247|    298|            }
 6248|       |
 6249|    123|            if (l_mcc_record->m_decorrelation_array == 00) {
  ------------------
  |  Branch (6249:17): [True: 3, False: 120]
  ------------------
 6250|      3|                opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6251|      3|                return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 6252|      3|            }
 6253|    123|        }
 6254|       |
 6255|  1.17k|        l_indix = (l_tmp >> 8) & 0xff;
 6256|  1.17k|        if (l_indix != 0) {
  ------------------
  |  Branch (6256:13): [True: 126, False: 1.04k]
  ------------------
 6257|    126|            l_mct_data = l_tcp->m_mct_records;
 6258|    426|            for (j = 0; j < l_tcp->m_nb_mct_records; ++j) {
  ------------------
  |  Branch (6258:25): [True: 424, False: 2]
  ------------------
 6259|    424|                if (l_mct_data->m_index == l_indix) {
  ------------------
  |  Branch (6259:21): [True: 124, False: 300]
  ------------------
 6260|    124|                    l_mcc_record->m_offset_array = l_mct_data;
 6261|    124|                    break;
 6262|    124|                }
 6263|    300|                ++l_mct_data;
 6264|    300|            }
 6265|       |
 6266|    126|            if (l_mcc_record->m_offset_array == 00) {
  ------------------
  |  Branch (6266:17): [True: 2, False: 124]
  ------------------
 6267|      2|                opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6268|      2|                return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 6269|      2|            }
 6270|    126|        }
 6271|  1.17k|    }
 6272|       |
 6273|  2.96k|    if (p_header_size != 0) {
  ------------------
  |  Branch (6273:9): [True: 3, False: 2.96k]
  ------------------
 6274|      3|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6275|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 6276|      3|    }
 6277|       |
 6278|  2.96k|    if (l_new_mcc) {
  ------------------
  |  Branch (6278:9): [True: 278, False: 2.68k]
  ------------------
 6279|    278|        ++l_tcp->m_nb_mcc_records;
 6280|    278|    }
 6281|       |
 6282|  2.96k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.96k|#define OPJ_TRUE 1
  ------------------
 6283|  2.96k|}
j2k.c:opj_j2k_read_mco:
 6361|  7.93k|{
 6362|  7.93k|    OPJ_UINT32 l_tmp, i;
 6363|  7.93k|    OPJ_UINT32 l_nb_stages;
 6364|  7.93k|    opj_tcp_t * l_tcp;
 6365|  7.93k|    opj_tccp_t * l_tccp;
 6366|  7.93k|    opj_image_t * l_image;
 6367|       |
 6368|       |    /* preconditions */
 6369|  7.93k|    assert(p_header_data != 00);
 6370|  7.93k|    assert(p_j2k != 00);
 6371|  7.93k|    assert(p_manager != 00);
 6372|       |
 6373|  7.93k|    l_image = p_j2k->m_private_image;
 6374|  7.93k|    l_tcp = p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH ?
  ------------------
  |  Branch (6374:13): [True: 16, False: 7.91k]
  ------------------
 6375|     16|            &p_j2k->m_cp.tcps[p_j2k->m_current_tile_number] :
 6376|  7.93k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 6377|       |
 6378|  7.93k|    if (p_header_size < 1) {
  ------------------
  |  Branch (6378:9): [True: 1, False: 7.92k]
  ------------------
 6379|      1|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCO marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6380|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6381|      1|    }
 6382|       |
 6383|  7.92k|    opj_read_bytes(p_header_data, &l_nb_stages,
  ------------------
  |  |   65|  7.92k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6384|  7.92k|                   1);                         /* Nmco : only one transform stage*/
 6385|  7.92k|    ++p_header_data;
 6386|       |
 6387|  7.92k|    if (l_nb_stages > 1) {
  ------------------
  |  Branch (6387:9): [True: 4.93k, False: 2.99k]
  ------------------
 6388|  4.93k|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  4.93k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6389|  4.93k|                      "Cannot take in charge multiple transformation stages.\n");
 6390|  4.93k|        return OPJ_TRUE;
  ------------------
  |  |  117|  4.93k|#define OPJ_TRUE 1
  ------------------
 6391|  4.93k|    }
 6392|       |
 6393|  2.99k|    if (p_header_size != l_nb_stages + 1) {
  ------------------
  |  Branch (6393:9): [True: 1, False: 2.98k]
  ------------------
 6394|      1|        opj_event_msg(p_manager, EVT_WARNING, "Error reading MCO marker\n");
  ------------------
  |  |   67|      1|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6395|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6396|      1|    }
 6397|       |
 6398|  2.98k|    l_tccp = l_tcp->tccps;
 6399|       |
 6400|  40.1k|    for (i = 0; i < l_image->numcomps; ++i) {
  ------------------
  |  Branch (6400:17): [True: 37.1k, False: 2.98k]
  ------------------
 6401|  37.1k|        l_tccp->m_dc_level_shift = 0;
 6402|  37.1k|        ++l_tccp;
 6403|  37.1k|    }
 6404|       |
 6405|  2.98k|    if (l_tcp->m_mct_decoding_matrix) {
  ------------------
  |  Branch (6405:9): [True: 0, False: 2.98k]
  ------------------
 6406|      0|        opj_free(l_tcp->m_mct_decoding_matrix);
 6407|      0|        l_tcp->m_mct_decoding_matrix = 00;
 6408|      0|    }
 6409|       |
 6410|  5.03k|    for (i = 0; i < l_nb_stages; ++i) {
  ------------------
  |  Branch (6410:17): [True: 2.04k, False: 2.98k]
  ------------------
 6411|  2.04k|        opj_read_bytes(p_header_data, &l_tmp, 1);
  ------------------
  |  |   65|  2.04k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6412|  2.04k|        ++p_header_data;
 6413|       |
 6414|  2.04k|        if (! opj_j2k_add_mct(l_tcp, p_j2k->m_private_image, l_tmp)) {
  ------------------
  |  Branch (6414:13): [True: 2, False: 2.04k]
  ------------------
 6415|      2|            return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 6416|      2|        }
 6417|  2.04k|    }
 6418|       |
 6419|  2.98k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.98k|#define OPJ_TRUE 1
  ------------------
 6420|  2.98k|}
j2k.c:opj_j2k_add_mct:
 6424|  2.04k|{
 6425|  2.04k|    OPJ_UINT32 i;
 6426|  2.04k|    opj_simple_mcc_decorrelation_data_t * l_mcc_record;
 6427|  2.04k|    opj_mct_data_t * l_deco_array, * l_offset_array;
 6428|  2.04k|    OPJ_UINT32 l_data_size, l_mct_size, l_offset_size;
 6429|  2.04k|    OPJ_UINT32 l_nb_elem;
 6430|  2.04k|    OPJ_UINT32 * l_offset_data, * l_current_offset_data;
 6431|  2.04k|    opj_tccp_t * l_tccp;
 6432|       |
 6433|       |    /* preconditions */
 6434|  2.04k|    assert(p_tcp != 00);
 6435|       |
 6436|  2.04k|    l_mcc_record = p_tcp->m_mcc_records;
 6437|       |
 6438|  3.54k|    for (i = 0; i < p_tcp->m_nb_mcc_records; ++i) {
  ------------------
  |  Branch (6438:17): [True: 1.82k, False: 1.72k]
  ------------------
 6439|  1.82k|        if (l_mcc_record->m_index == p_index) {
  ------------------
  |  Branch (6439:13): [True: 319, False: 1.50k]
  ------------------
 6440|    319|            break;
 6441|    319|        }
 6442|  1.82k|    }
 6443|       |
 6444|  2.04k|    if (i == p_tcp->m_nb_mcc_records) {
  ------------------
  |  Branch (6444:9): [True: 1.72k, False: 319]
  ------------------
 6445|       |        /** element discarded **/
 6446|  1.72k|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.72k|#define OPJ_TRUE 1
  ------------------
 6447|  1.72k|    }
 6448|       |
 6449|    319|    if (l_mcc_record->m_nb_comps != p_image->numcomps) {
  ------------------
  |  Branch (6449:9): [True: 83, False: 236]
  ------------------
 6450|       |        /** do not support number of comps != image */
 6451|     83|        return OPJ_TRUE;
  ------------------
  |  |  117|     83|#define OPJ_TRUE 1
  ------------------
 6452|     83|    }
 6453|       |
 6454|    236|    l_deco_array = l_mcc_record->m_decorrelation_array;
 6455|       |
 6456|    236|    if (l_deco_array) {
  ------------------
  |  Branch (6456:9): [True: 1, False: 235]
  ------------------
 6457|      1|        l_data_size = MCT_ELEMENT_SIZE[l_deco_array->m_element_type] * p_image->numcomps
 6458|      1|                      * p_image->numcomps;
 6459|      1|        if (l_deco_array->m_data_size != l_data_size) {
  ------------------
  |  Branch (6459:13): [True: 1, False: 0]
  ------------------
 6460|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6461|      1|        }
 6462|       |
 6463|      0|        l_nb_elem = p_image->numcomps * p_image->numcomps;
 6464|      0|        l_mct_size = l_nb_elem * (OPJ_UINT32)sizeof(OPJ_FLOAT32);
 6465|      0|        p_tcp->m_mct_decoding_matrix = (OPJ_FLOAT32*)opj_malloc(l_mct_size);
 6466|       |
 6467|      0|        if (! p_tcp->m_mct_decoding_matrix) {
  ------------------
  |  Branch (6467:13): [True: 0, False: 0]
  ------------------
 6468|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6469|      0|        }
 6470|       |
 6471|      0|        j2k_mct_read_functions_to_float[l_deco_array->m_element_type](
 6472|      0|            l_deco_array->m_data, p_tcp->m_mct_decoding_matrix, l_nb_elem);
 6473|      0|    }
 6474|       |
 6475|    235|    l_offset_array = l_mcc_record->m_offset_array;
 6476|       |
 6477|    235|    if (l_offset_array) {
  ------------------
  |  Branch (6477:9): [True: 1, False: 234]
  ------------------
 6478|      1|        l_data_size = MCT_ELEMENT_SIZE[l_offset_array->m_element_type] *
 6479|      1|                      p_image->numcomps;
 6480|      1|        if (l_offset_array->m_data_size != l_data_size) {
  ------------------
  |  Branch (6480:13): [True: 1, False: 0]
  ------------------
 6481|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6482|      1|        }
 6483|       |
 6484|      0|        l_nb_elem = p_image->numcomps;
 6485|      0|        l_offset_size = l_nb_elem * (OPJ_UINT32)sizeof(OPJ_UINT32);
 6486|      0|        l_offset_data = (OPJ_UINT32*)opj_malloc(l_offset_size);
 6487|       |
 6488|      0|        if (! l_offset_data) {
  ------------------
  |  Branch (6488:13): [True: 0, False: 0]
  ------------------
 6489|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6490|      0|        }
 6491|       |
 6492|      0|        j2k_mct_read_functions_to_int32[l_offset_array->m_element_type](
 6493|      0|            l_offset_array->m_data, l_offset_data, l_nb_elem);
 6494|       |
 6495|      0|        l_tccp = p_tcp->tccps;
 6496|      0|        l_current_offset_data = l_offset_data;
 6497|       |
 6498|      0|        for (i = 0; i < p_image->numcomps; ++i) {
  ------------------
  |  Branch (6498:21): [True: 0, False: 0]
  ------------------
 6499|      0|            l_tccp->m_dc_level_shift = (OPJ_INT32) * (l_current_offset_data++);
 6500|      0|            ++l_tccp;
 6501|      0|        }
 6502|       |
 6503|      0|        opj_free(l_offset_data);
 6504|      0|    }
 6505|       |
 6506|    234|    return OPJ_TRUE;
  ------------------
  |  |  117|    234|#define OPJ_TRUE 1
  ------------------
 6507|    235|}
j2k.c:opj_j2k_add_tlmarker:
 8358|  18.3k|{
 8359|  18.3k|    assert(cstr_index != 00);
 8360|  18.3k|    assert(cstr_index->tile_index != 00);
 8361|       |
 8362|       |    /* expand the list? */
 8363|  18.3k|    if ((cstr_index->tile_index[tileno].marknum + 1) >
  ------------------
  |  Branch (8363:9): [True: 28, False: 18.3k]
  ------------------
 8364|  18.3k|            cstr_index->tile_index[tileno].maxmarknum) {
 8365|     28|        opj_marker_info_t *new_marker;
 8366|     28|        cstr_index->tile_index[tileno].maxmarknum = (OPJ_UINT32)(100 +
 8367|     28|                (OPJ_FLOAT32) cstr_index->tile_index[tileno].maxmarknum);
 8368|     28|        new_marker = (opj_marker_info_t *) opj_realloc(
 8369|     28|                         cstr_index->tile_index[tileno].marker,
 8370|     28|                         cstr_index->tile_index[tileno].maxmarknum * sizeof(opj_marker_info_t));
 8371|     28|        if (! new_marker) {
  ------------------
  |  Branch (8371:13): [True: 0, False: 28]
  ------------------
 8372|      0|            opj_free(cstr_index->tile_index[tileno].marker);
 8373|      0|            cstr_index->tile_index[tileno].marker = NULL;
 8374|      0|            cstr_index->tile_index[tileno].maxmarknum = 0;
 8375|      0|            cstr_index->tile_index[tileno].marknum = 0;
 8376|       |            /* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add tl marker\n"); */
 8377|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8378|      0|        }
 8379|     28|        cstr_index->tile_index[tileno].marker = new_marker;
 8380|     28|    }
 8381|       |
 8382|       |    /* add the marker */
 8383|  18.3k|    cstr_index->tile_index[tileno].marker[cstr_index->tile_index[tileno].marknum].type
 8384|  18.3k|        = (OPJ_UINT16)type;
 8385|  18.3k|    cstr_index->tile_index[tileno].marker[cstr_index->tile_index[tileno].marknum].pos
 8386|  18.3k|        = (OPJ_INT32)pos;
 8387|  18.3k|    cstr_index->tile_index[tileno].marker[cstr_index->tile_index[tileno].marknum].len
 8388|  18.3k|        = (OPJ_INT32)len;
 8389|  18.3k|    cstr_index->tile_index[tileno].marknum++;
 8390|       |
 8391|  18.3k|    if (type == J2K_MS_SOT) {
  ------------------
  |  |   73|  18.3k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (8391:9): [True: 7.39k, False: 10.9k]
  ------------------
 8392|  7.39k|        OPJ_UINT32 l_current_tile_part = cstr_index->tile_index[tileno].current_tpsno;
 8393|       |
 8394|  7.39k|        if (cstr_index->tile_index[tileno].tp_index) {
  ------------------
  |  Branch (8394:13): [True: 7.39k, False: 0]
  ------------------
 8395|  7.39k|            cstr_index->tile_index[tileno].tp_index[l_current_tile_part].start_pos = pos;
 8396|  7.39k|        }
 8397|       |
 8398|  7.39k|    }
 8399|  18.3k|    return OPJ_TRUE;
  ------------------
  |  |  117|  18.3k|#define OPJ_TRUE 1
  ------------------
 8400|  18.3k|}
j2k.c:opj_j2k_read_sod:
 4927|  7.11k|{
 4928|  7.11k|    OPJ_SIZE_T l_current_read_size;
 4929|  7.11k|    opj_codestream_index_t * l_cstr_index = 00;
 4930|  7.11k|    OPJ_BYTE ** l_current_data = 00;
 4931|  7.11k|    opj_tcp_t * l_tcp = 00;
 4932|  7.11k|    OPJ_UINT32 * l_tile_len = 00;
 4933|  7.11k|    OPJ_BOOL l_sot_length_pb_detected = OPJ_FALSE;
  ------------------
  |  |  118|  7.11k|#define OPJ_FALSE 0
  ------------------
 4934|       |
 4935|       |    /* preconditions */
 4936|  7.11k|    assert(p_j2k != 00);
 4937|  7.11k|    assert(p_manager != 00);
 4938|  7.11k|    assert(p_stream != 00);
 4939|       |
 4940|  7.11k|    l_tcp = &(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]);
 4941|       |
 4942|  7.11k|    if (p_j2k->m_specific_param.m_decoder.m_last_tile_part) {
  ------------------
  |  Branch (4942:9): [True: 6.27k, False: 842]
  ------------------
 4943|       |        /* opj_stream_get_number_byte_left returns OPJ_OFF_T
 4944|       |        // but we are in the last tile part,
 4945|       |        // so its result will fit on OPJ_UINT32 unless we find
 4946|       |        // a file with a single tile part of more than 4 GB...*/
 4947|  6.27k|        p_j2k->m_specific_param.m_decoder.m_sot_length = (OPJ_UINT32)(
 4948|  6.27k|                    opj_stream_get_number_byte_left(p_stream) - 2);
 4949|  6.27k|    } else {
 4950|       |        /* Check to avoid pass the limit of OPJ_UINT32 */
 4951|    842|        if (p_j2k->m_specific_param.m_decoder.m_sot_length >= 2) {
  ------------------
  |  Branch (4951:13): [True: 796, False: 46]
  ------------------
 4952|    796|            p_j2k->m_specific_param.m_decoder.m_sot_length -= 2;
 4953|    796|        } else {
 4954|       |            /* MSD: case commented to support empty SOT marker (PHR data) */
 4955|     46|        }
 4956|    842|    }
 4957|       |
 4958|  7.11k|    l_current_data = &(l_tcp->m_data);
 4959|  7.11k|    l_tile_len = &l_tcp->m_data_size;
 4960|       |
 4961|       |    /* Patch to support new PHR data */
 4962|  7.11k|    if (p_j2k->m_specific_param.m_decoder.m_sot_length) {
  ------------------
  |  Branch (4962:9): [True: 7.06k, False: 52]
  ------------------
 4963|       |        /* If we are here, we'll try to read the data after allocation */
 4964|       |        /* Check enough bytes left in stream before allocation */
 4965|  7.06k|        if ((OPJ_OFF_T)p_j2k->m_specific_param.m_decoder.m_sot_length >
  ------------------
  |  Branch (4965:13): [True: 61, False: 7.00k]
  ------------------
 4966|  7.06k|                opj_stream_get_number_byte_left(p_stream)) {
 4967|     61|            if (p_j2k->m_cp.strict) {
  ------------------
  |  Branch (4967:17): [True: 61, False: 0]
  ------------------
 4968|     61|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     61|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4969|     61|                              "Tile part length size inconsistent with stream length\n");
 4970|     61|                return OPJ_FALSE;
  ------------------
  |  |  118|     61|#define OPJ_FALSE 0
  ------------------
 4971|     61|            } else {
 4972|      0|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 4973|      0|                              "Tile part length size inconsistent with stream length\n");
 4974|      0|            }
 4975|     61|        }
 4976|  7.00k|        if (p_j2k->m_specific_param.m_decoder.m_sot_length >
  ------------------
  |  Branch (4976:13): [True: 0, False: 7.00k]
  ------------------
 4977|  7.00k|                UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA) {
  ------------------
  |  |   39|  7.00k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 4978|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4979|      0|                          "p_j2k->m_specific_param.m_decoder.m_sot_length > "
 4980|      0|                          "UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA");
 4981|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4982|      0|        }
 4983|       |        /* Add a margin of OPJ_COMMON_CBLK_DATA_EXTRA to the allocation we */
 4984|       |        /* do so that opj_mqc_init_dec_common() can safely add a synthetic */
 4985|       |        /* 0xFFFF marker. */
 4986|  7.00k|        if (! *l_current_data) {
  ------------------
  |  Branch (4986:13): [True: 6.98k, False: 23]
  ------------------
 4987|       |            /* LH: oddly enough, in this path, l_tile_len!=0.
 4988|       |             * TODO: If this was consistent, we could simplify the code to only use realloc(), as realloc(0,...) default to malloc(0,...).
 4989|       |             */
 4990|  6.98k|            *l_current_data = (OPJ_BYTE*) opj_malloc(
 4991|  6.98k|                                  p_j2k->m_specific_param.m_decoder.m_sot_length + OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|  6.98k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 4992|  6.98k|        } else {
 4993|     23|            OPJ_BYTE *l_new_current_data;
 4994|     23|            if (*l_tile_len > UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA -
  ------------------
  |  |   39|     23|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
  |  Branch (4994:17): [True: 0, False: 23]
  ------------------
 4995|     23|                    p_j2k->m_specific_param.m_decoder.m_sot_length) {
 4996|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4997|      0|                              "*l_tile_len > UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA - "
 4998|      0|                              "p_j2k->m_specific_param.m_decoder.m_sot_length");
 4999|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5000|      0|            }
 5001|       |
 5002|     23|            l_new_current_data = (OPJ_BYTE *) opj_realloc(*l_current_data,
 5003|     23|                                 *l_tile_len + p_j2k->m_specific_param.m_decoder.m_sot_length +
 5004|     23|                                 OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|     23|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 5005|     23|            if (! l_new_current_data) {
  ------------------
  |  Branch (5005:17): [True: 0, False: 23]
  ------------------
 5006|      0|                opj_free(*l_current_data);
 5007|       |                /*nothing more is done as l_current_data will be set to null, and just
 5008|       |                  afterward we enter in the error path
 5009|       |                  and the actual tile_len is updated (committed) at the end of the
 5010|       |                  function. */
 5011|      0|            }
 5012|     23|            *l_current_data = l_new_current_data;
 5013|     23|        }
 5014|       |
 5015|  7.00k|        if (*l_current_data == 00) {
  ------------------
  |  Branch (5015:13): [True: 0, False: 7.00k]
  ------------------
 5016|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to decode tile\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5017|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5018|      0|        }
 5019|  7.00k|    } else {
 5020|     52|        l_sot_length_pb_detected = OPJ_TRUE;
  ------------------
  |  |  117|     52|#define OPJ_TRUE 1
  ------------------
 5021|     52|    }
 5022|       |
 5023|       |    /* Index */
 5024|  7.05k|    l_cstr_index = p_j2k->cstr_index;
 5025|  7.05k|    if (l_cstr_index) {
  ------------------
  |  Branch (5025:9): [True: 7.05k, False: 0]
  ------------------
 5026|  7.05k|        OPJ_OFF_T l_current_pos = opj_stream_tell(p_stream) - 2;
 5027|       |
 5028|  7.05k|        OPJ_UINT32 l_current_tile_part =
 5029|  7.05k|            l_cstr_index->tile_index[p_j2k->m_current_tile_number].current_tpsno;
 5030|  7.05k|        l_cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index[l_current_tile_part].end_header
 5031|  7.05k|            =
 5032|  7.05k|                l_current_pos;
 5033|  7.05k|        l_cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index[l_current_tile_part].end_pos
 5034|  7.05k|            =
 5035|  7.05k|                l_current_pos + p_j2k->m_specific_param.m_decoder.m_sot_length + 2;
 5036|       |
 5037|  7.05k|        if (OPJ_FALSE == opj_j2k_add_tlmarker(p_j2k->m_current_tile_number,
  ------------------
  |  |  118|  7.05k|#define OPJ_FALSE 0
  ------------------
  |  Branch (5037:13): [True: 0, False: 7.05k]
  ------------------
 5038|  7.05k|                                              l_cstr_index,
 5039|  7.05k|                                              J2K_MS_SOD,
  ------------------
  |  |   74|  7.05k|#define J2K_MS_SOD 0xff93   /**< SOD marker value */
  ------------------
 5040|  7.05k|                                              l_current_pos,
 5041|  7.05k|                                              p_j2k->m_specific_param.m_decoder.m_sot_length + 2)) {
 5042|      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 */
  ------------------
 5043|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5044|      0|        }
 5045|       |
 5046|       |        /*l_cstr_index->packno = 0;*/
 5047|  7.05k|    }
 5048|       |
 5049|       |    /* Patch to support new PHR data */
 5050|  7.05k|    if (!l_sot_length_pb_detected) {
  ------------------
  |  Branch (5050:9): [True: 7.00k, False: 52]
  ------------------
 5051|  7.00k|        l_current_read_size = opj_stream_read_data(
 5052|  7.00k|                                  p_stream,
 5053|  7.00k|                                  *l_current_data + *l_tile_len,
 5054|  7.00k|                                  p_j2k->m_specific_param.m_decoder.m_sot_length,
 5055|  7.00k|                                  p_manager);
 5056|  7.00k|    } else {
 5057|     52|        l_current_read_size = 0;
 5058|     52|    }
 5059|       |
 5060|  7.05k|    if (l_current_read_size != p_j2k->m_specific_param.m_decoder.m_sot_length) {
  ------------------
  |  Branch (5060:9): [True: 0, False: 7.05k]
  ------------------
 5061|      0|        p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
 5062|  7.05k|    } else {
 5063|  7.05k|        p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPHSOT;
 5064|  7.05k|    }
 5065|       |
 5066|  7.05k|    *l_tile_len += (OPJ_UINT32)l_current_read_size;
 5067|       |
 5068|  7.05k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.05k|#define OPJ_TRUE 1
  ------------------
 5069|  7.05k|}
j2k.c:opj_j2k_need_nb_tile_parts_correction:
 9442|  1.04k|{
 9443|  1.04k|    OPJ_BYTE   l_header_data[10];
 9444|  1.04k|    OPJ_OFF_T  l_stream_pos_backup;
 9445|  1.04k|    OPJ_UINT32 l_current_marker;
 9446|  1.04k|    OPJ_UINT32 l_marker_size;
 9447|  1.04k|    OPJ_UINT32 l_tile_no, l_tot_len, l_current_part, l_num_parts;
 9448|       |
 9449|       |    /* initialize to no correction needed */
 9450|  1.04k|    *p_correction_needed = OPJ_FALSE;
  ------------------
  |  |  118|  1.04k|#define OPJ_FALSE 0
  ------------------
 9451|       |
 9452|  1.04k|    if (!opj_stream_has_seek(p_stream)) {
  ------------------
  |  Branch (9452:9): [True: 0, False: 1.04k]
  ------------------
 9453|       |        /* We can't do much in this case, seek is needed */
 9454|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 9455|      0|    }
 9456|       |
 9457|  1.04k|    l_stream_pos_backup = opj_stream_tell(p_stream);
 9458|  1.04k|    if (l_stream_pos_backup == -1) {
  ------------------
  |  Branch (9458:9): [True: 0, False: 1.04k]
  ------------------
 9459|       |        /* let's do nothing */
 9460|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 9461|      0|    }
 9462|       |
 9463|  1.51k|    for (;;) {
 9464|       |        /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */
 9465|  1.51k|        if (opj_stream_read_data(p_stream, l_header_data, 2, p_manager) != 2) {
  ------------------
  |  Branch (9465:13): [True: 12, False: 1.49k]
  ------------------
 9466|       |            /* assume all is OK */
 9467|     12|            if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9467:17): [True: 0, False: 12]
  ------------------
 9468|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9469|      0|            }
 9470|     12|            return OPJ_TRUE;
  ------------------
  |  |  117|     12|#define OPJ_TRUE 1
  ------------------
 9471|     12|        }
 9472|       |
 9473|       |        /* Read 2 bytes from buffer as the new marker ID */
 9474|  1.49k|        opj_read_bytes(l_header_data, &l_current_marker, 2);
  ------------------
  |  |   65|  1.49k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9475|       |
 9476|  1.49k|        if (l_current_marker != J2K_MS_SOT) {
  ------------------
  |  |   73|  1.49k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (9476:13): [True: 891, False: 607]
  ------------------
 9477|       |            /* assume all is OK */
 9478|    891|            if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9478:17): [True: 0, False: 891]
  ------------------
 9479|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9480|      0|            }
 9481|    891|            return OPJ_TRUE;
  ------------------
  |  |  117|    891|#define OPJ_TRUE 1
  ------------------
 9482|    891|        }
 9483|       |
 9484|       |        /* Try to read 2 bytes (the marker size) from stream and copy them into the buffer */
 9485|    607|        if (opj_stream_read_data(p_stream, l_header_data, 2, p_manager) != 2) {
  ------------------
  |  Branch (9485:13): [True: 1, False: 606]
  ------------------
 9486|      1|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9487|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 9488|      1|        }
 9489|       |
 9490|       |        /* Read 2 bytes from the buffer as the marker size */
 9491|    606|        opj_read_bytes(l_header_data, &l_marker_size, 2);
  ------------------
  |  |   65|    606|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9492|       |
 9493|       |        /* Check marker size for SOT Marker */
 9494|    606|        if (l_marker_size != 10) {
  ------------------
  |  Branch (9494:13): [True: 1, False: 605]
  ------------------
 9495|      1|            opj_event_msg(p_manager, EVT_ERROR, "Inconsistent marker size\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9496|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 9497|      1|        }
 9498|    605|        l_marker_size -= 2;
 9499|       |
 9500|    605|        if (opj_stream_read_data(p_stream, l_header_data, l_marker_size,
  ------------------
  |  Branch (9500:13): [True: 2, False: 603]
  ------------------
 9501|    605|                                 p_manager) != l_marker_size) {
 9502|      2|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9503|      2|            return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 9504|      2|        }
 9505|       |
 9506|    603|        if (! opj_j2k_get_sot_values(l_header_data, l_marker_size, &l_tile_no,
  ------------------
  |  Branch (9506:13): [True: 0, False: 603]
  ------------------
 9507|    603|                                     &l_tot_len, &l_current_part, &l_num_parts, p_manager)) {
 9508|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9509|      0|        }
 9510|       |
 9511|    603|        if (l_tile_no == tile_no) {
  ------------------
  |  Branch (9511:13): [True: 29, False: 574]
  ------------------
 9512|       |            /* we found what we were looking for */
 9513|     29|            break;
 9514|     29|        }
 9515|       |
 9516|    574|        if (l_tot_len < 14U) {
  ------------------
  |  Branch (9516:13): [True: 81, False: 493]
  ------------------
 9517|       |            /* last SOT until EOC or invalid Psot value */
 9518|       |            /* assume all is OK */
 9519|     81|            if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9519:17): [True: 0, False: 81]
  ------------------
 9520|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9521|      0|            }
 9522|     81|            return OPJ_TRUE;
  ------------------
  |  |  117|     81|#define OPJ_TRUE 1
  ------------------
 9523|     81|        }
 9524|    493|        l_tot_len -= 12U;
 9525|       |        /* look for next SOT marker */
 9526|    493|        if (opj_stream_skip(p_stream, (OPJ_OFF_T)(l_tot_len),
  ------------------
  |  Branch (9526:13): [True: 24, False: 469]
  ------------------
 9527|    493|                            p_manager) != (OPJ_OFF_T)(l_tot_len)) {
 9528|       |            /* assume all is OK */
 9529|     24|            if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9529:17): [True: 0, False: 24]
  ------------------
 9530|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9531|      0|            }
 9532|     24|            return OPJ_TRUE;
  ------------------
  |  |  117|     24|#define OPJ_TRUE 1
  ------------------
 9533|     24|        }
 9534|    493|    }
 9535|       |
 9536|       |    /* check for correction */
 9537|     29|    if (l_current_part == l_num_parts) {
  ------------------
  |  Branch (9537:9): [True: 27, False: 2]
  ------------------
 9538|     27|        *p_correction_needed = OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
 9539|     27|    }
 9540|       |
 9541|     29|    if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9541:9): [True: 0, False: 29]
  ------------------
 9542|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9543|      0|    }
 9544|     29|    return OPJ_TRUE;
  ------------------
  |  |  117|     29|#define OPJ_TRUE 1
  ------------------
 9545|     29|}
j2k.c:opj_j2k_merge_ppt:
 4148|  6.97k|{
 4149|  6.97k|    OPJ_UINT32 i, l_ppt_data_size;
 4150|       |    /* preconditions */
 4151|  6.97k|    assert(p_tcp != 00);
 4152|  6.97k|    assert(p_manager != 00);
 4153|       |
 4154|  6.97k|    if (p_tcp->ppt_buffer != NULL) {
  ------------------
  |  Branch (4154:9): [True: 0, False: 6.97k]
  ------------------
 4155|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4156|      0|                      "opj_j2k_merge_ppt() has already been called\n");
 4157|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4158|      0|    }
 4159|       |
 4160|  6.97k|    if (p_tcp->ppt == 0U) {
  ------------------
  |  Branch (4160:9): [True: 6.95k, False: 17]
  ------------------
 4161|  6.95k|        return OPJ_TRUE;
  ------------------
  |  |  117|  6.95k|#define OPJ_TRUE 1
  ------------------
 4162|  6.95k|    }
 4163|       |
 4164|     17|    l_ppt_data_size = 0U;
 4165|    818|    for (i = 0U; i < p_tcp->ppt_markers_count; ++i) {
  ------------------
  |  Branch (4165:18): [True: 801, False: 17]
  ------------------
 4166|    801|        l_ppt_data_size +=
 4167|    801|            p_tcp->ppt_markers[i].m_data_size; /* can't overflow, max 256 markers of max 65536 bytes */
 4168|    801|    }
 4169|       |
 4170|     17|    p_tcp->ppt_buffer = (OPJ_BYTE *) opj_malloc(l_ppt_data_size);
 4171|     17|    if (p_tcp->ppt_buffer == 00) {
  ------------------
  |  Branch (4171:9): [True: 0, False: 17]
  ------------------
 4172|      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 */
  ------------------
 4173|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4174|      0|    }
 4175|     17|    p_tcp->ppt_len = l_ppt_data_size;
 4176|     17|    l_ppt_data_size = 0U;
 4177|    818|    for (i = 0U; i < p_tcp->ppt_markers_count; ++i) {
  ------------------
  |  Branch (4177:18): [True: 801, False: 17]
  ------------------
 4178|    801|        if (p_tcp->ppt_markers[i].m_data !=
  ------------------
  |  Branch (4178:13): [True: 18, False: 783]
  ------------------
 4179|    801|                NULL) { /* standard doesn't seem to require contiguous Zppt */
 4180|     18|            memcpy(p_tcp->ppt_buffer + l_ppt_data_size, p_tcp->ppt_markers[i].m_data,
 4181|     18|                   p_tcp->ppt_markers[i].m_data_size);
 4182|     18|            l_ppt_data_size +=
 4183|     18|                p_tcp->ppt_markers[i].m_data_size; /* can't overflow, max 256 markers of max 65536 bytes */
 4184|       |
 4185|     18|            opj_free(p_tcp->ppt_markers[i].m_data);
 4186|     18|            p_tcp->ppt_markers[i].m_data = NULL;
 4187|     18|            p_tcp->ppt_markers[i].m_data_size = 0U;
 4188|     18|        }
 4189|    801|    }
 4190|       |
 4191|     17|    p_tcp->ppt_markers_count = 0U;
 4192|     17|    opj_free(p_tcp->ppt_markers);
 4193|     17|    p_tcp->ppt_markers = NULL;
 4194|       |
 4195|     17|    p_tcp->ppt_data = p_tcp->ppt_buffer;
 4196|     17|    p_tcp->ppt_data_size = p_tcp->ppt_len;
 4197|     17|    return OPJ_TRUE;
  ------------------
  |  |  117|     17|#define OPJ_TRUE 1
  ------------------
 4198|     17|}
j2k.c:opj_j2k_tcp_data_destroy:
 9388|  1.43M|{
 9389|  1.43M|    if (p_tcp->m_data) {
  ------------------
  |  Branch (9389:9): [True: 6.98k, False: 1.42M]
  ------------------
 9390|  6.98k|        opj_free(p_tcp->m_data);
 9391|  6.98k|        p_tcp->m_data = NULL;
 9392|  6.98k|        p_tcp->m_data_size = 0;
 9393|  6.98k|    }
 9394|  1.43M|}
j2k.c:opj_j2k_update_image_dimensions:
10175|  6.88k|{
10176|  6.88k|    OPJ_UINT32 it_comp;
10177|  6.88k|    OPJ_INT32 l_comp_x1, l_comp_y1;
10178|  6.88k|    opj_image_comp_t* l_img_comp = NULL;
10179|       |
10180|  6.88k|    l_img_comp = p_image->comps;
10181|  32.8k|    for (it_comp = 0; it_comp < p_image->numcomps; ++it_comp) {
  ------------------
  |  Branch (10181:23): [True: 25.9k, False: 6.88k]
  ------------------
10182|  25.9k|        OPJ_INT32 l_h, l_w;
10183|  25.9k|        if (p_image->x0 > (OPJ_UINT32)INT_MAX ||
  ------------------
  |  Branch (10183:13): [True: 0, False: 25.9k]
  ------------------
10184|  25.9k|                p_image->y0 > (OPJ_UINT32)INT_MAX ||
  ------------------
  |  Branch (10184:17): [True: 0, False: 25.9k]
  ------------------
10185|  25.9k|                p_image->x1 > (OPJ_UINT32)INT_MAX ||
  ------------------
  |  Branch (10185:17): [True: 0, False: 25.9k]
  ------------------
10186|  25.9k|                p_image->y1 > (OPJ_UINT32)INT_MAX) {
  ------------------
  |  Branch (10186:17): [True: 0, False: 25.9k]
  ------------------
10187|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10188|      0|                          "Image coordinates above INT_MAX are not supported\n");
10189|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10190|      0|        }
10191|       |
10192|  25.9k|        l_img_comp->x0 = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)p_image->x0,
10193|  25.9k|                         (OPJ_INT32)l_img_comp->dx);
10194|  25.9k|        l_img_comp->y0 = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)p_image->y0,
10195|  25.9k|                         (OPJ_INT32)l_img_comp->dy);
10196|  25.9k|        l_comp_x1 = opj_int_ceildiv((OPJ_INT32)p_image->x1, (OPJ_INT32)l_img_comp->dx);
10197|  25.9k|        l_comp_y1 = opj_int_ceildiv((OPJ_INT32)p_image->y1, (OPJ_INT32)l_img_comp->dy);
10198|       |
10199|  25.9k|        l_w = opj_int_ceildivpow2(l_comp_x1, (OPJ_INT32)l_img_comp->factor)
10200|  25.9k|              - opj_int_ceildivpow2((OPJ_INT32)l_img_comp->x0, (OPJ_INT32)l_img_comp->factor);
10201|  25.9k|        if (l_w < 0) {
  ------------------
  |  Branch (10201:13): [True: 0, False: 25.9k]
  ------------------
10202|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10203|      0|                          "Size x of the decoded component image is incorrect (comp[%d].w=%d).\n",
10204|      0|                          it_comp, l_w);
10205|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10206|      0|        }
10207|  25.9k|        l_img_comp->w = (OPJ_UINT32)l_w;
10208|       |
10209|  25.9k|        l_h = opj_int_ceildivpow2(l_comp_y1, (OPJ_INT32)l_img_comp->factor)
10210|  25.9k|              - opj_int_ceildivpow2((OPJ_INT32)l_img_comp->y0, (OPJ_INT32)l_img_comp->factor);
10211|  25.9k|        if (l_h < 0) {
  ------------------
  |  Branch (10211:13): [True: 0, False: 25.9k]
  ------------------
10212|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10213|      0|                          "Size y of the decoded component image is incorrect (comp[%d].h=%d).\n",
10214|      0|                          it_comp, l_h);
10215|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10216|      0|        }
10217|  25.9k|        l_img_comp->h = (OPJ_UINT32)l_h;
10218|       |
10219|  25.9k|        l_img_comp++;
10220|  25.9k|    }
10221|       |
10222|  6.88k|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.88k|#define OPJ_TRUE 1
  ------------------
10223|  6.88k|}
j2k.c:opj_j2k_create_cstr_index:
10515|  9.22k|{
10516|  9.22k|    opj_codestream_index_t* cstr_index = (opj_codestream_index_t*)
10517|  9.22k|                                         opj_calloc(1, sizeof(opj_codestream_index_t));
10518|  9.22k|    if (!cstr_index) {
  ------------------
  |  Branch (10518:9): [True: 0, False: 9.22k]
  ------------------
10519|      0|        return NULL;
10520|      0|    }
10521|       |
10522|  9.22k|    cstr_index->maxmarknum = 100;
10523|  9.22k|    cstr_index->marknum = 0;
10524|  9.22k|    cstr_index->marker = (opj_marker_info_t*)
10525|  9.22k|                         opj_calloc(cstr_index->maxmarknum, sizeof(opj_marker_info_t));
10526|  9.22k|    if (!cstr_index-> marker) {
  ------------------
  |  Branch (10526:9): [True: 0, False: 9.22k]
  ------------------
10527|      0|        opj_free(cstr_index);
10528|      0|        return NULL;
10529|      0|    }
10530|       |
10531|  9.22k|    cstr_index->tile_index = NULL;
10532|       |
10533|  9.22k|    return cstr_index;
10534|  9.22k|}
j2k.c:opj_j2k_allocate_tile_element_cstr_index:
11602|  6.88k|{
11603|  6.88k|    OPJ_UINT32 it_tile = 0;
11604|       |
11605|  6.88k|    p_j2k->cstr_index->nb_of_tiles = p_j2k->m_cp.tw * p_j2k->m_cp.th;
11606|  6.88k|    p_j2k->cstr_index->tile_index = (opj_tile_index_t*)opj_calloc(
11607|  6.88k|                                        p_j2k->cstr_index->nb_of_tiles, sizeof(opj_tile_index_t));
11608|  6.88k|    if (!p_j2k->cstr_index->tile_index) {
  ------------------
  |  Branch (11608:9): [True: 0, False: 6.88k]
  ------------------
11609|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11610|      0|    }
11611|       |
11612|  1.15M|    for (it_tile = 0; it_tile < p_j2k->cstr_index->nb_of_tiles; it_tile++) {
  ------------------
  |  Branch (11612:23): [True: 1.14M, False: 6.88k]
  ------------------
11613|  1.14M|        p_j2k->cstr_index->tile_index[it_tile].maxmarknum = 100;
11614|  1.14M|        p_j2k->cstr_index->tile_index[it_tile].marknum = 0;
11615|  1.14M|        p_j2k->cstr_index->tile_index[it_tile].marker = (opj_marker_info_t*)
11616|  1.14M|                opj_calloc(p_j2k->cstr_index->tile_index[it_tile].maxmarknum,
11617|  1.14M|                           sizeof(opj_marker_info_t));
11618|  1.14M|        if (!p_j2k->cstr_index->tile_index[it_tile].marker) {
  ------------------
  |  Branch (11618:13): [True: 0, False: 1.14M]
  ------------------
11619|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11620|      0|        }
11621|  1.14M|    }
11622|       |
11623|  6.88k|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.88k|#define OPJ_TRUE 1
  ------------------
11624|  6.88k|}
j2k.c:opj_j2k_setup_decoding:
11785|  6.88k|{
11786|       |    /* preconditions*/
11787|  6.88k|    assert(p_j2k != 00);
11788|  6.88k|    assert(p_manager != 00);
11789|       |
11790|  6.88k|    if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,
  ------------------
  |  Branch (11790:9): [True: 0, False: 6.88k]
  ------------------
11791|  6.88k|                                           (opj_procedure)opj_j2k_decode_tiles, p_manager)) {
11792|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11793|      0|    }
11794|       |    /* DEVELOPER CORNER, add your custom procedures */
11795|       |
11796|  6.88k|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.88k|#define OPJ_TRUE 1
  ------------------
11797|  6.88k|}
j2k.c:opj_j2k_decode_tiles:
11665|  6.88k|{
11666|  6.88k|    OPJ_BOOL l_go_on = OPJ_TRUE;
  ------------------
  |  |  117|  6.88k|#define OPJ_TRUE 1
  ------------------
11667|  6.88k|    OPJ_UINT32 l_current_tile_no;
11668|  6.88k|    OPJ_INT32 l_tile_x0, l_tile_y0, l_tile_x1, l_tile_y1;
11669|  6.88k|    OPJ_UINT32 l_nb_comps;
11670|  6.88k|    OPJ_UINT32 nr_tiles = 0;
11671|       |
11672|       |    /* Particular case for whole single tile decoding */
11673|       |    /* We can avoid allocating intermediate tile buffers */
11674|  6.88k|    if (p_j2k->m_cp.tw == 1 && p_j2k->m_cp.th == 1 &&
  ------------------
  |  Branch (11674:9): [True: 4.28k, False: 2.59k]
  |  Branch (11674:32): [True: 3.94k, False: 345]
  ------------------
11675|  6.88k|            p_j2k->m_cp.tx0 == 0 && p_j2k->m_cp.ty0 == 0 &&
  ------------------
  |  Branch (11675:13): [True: 3.94k, False: 2]
  |  Branch (11675:37): [True: 3.92k, False: 14]
  ------------------
11676|  6.88k|            p_j2k->m_output_image->x0 == 0 &&
  ------------------
  |  Branch (11676:13): [True: 3.91k, False: 7]
  ------------------
11677|  6.88k|            p_j2k->m_output_image->y0 == 0 &&
  ------------------
  |  Branch (11677:13): [True: 3.90k, False: 11]
  ------------------
11678|  6.88k|            p_j2k->m_output_image->x1 == p_j2k->m_cp.tdx &&
  ------------------
  |  Branch (11678:13): [True: 0, False: 3.90k]
  ------------------
11679|  6.88k|            p_j2k->m_output_image->y1 == p_j2k->m_cp.tdy) {
  ------------------
  |  Branch (11679:13): [True: 0, False: 0]
  ------------------
11680|      0|        OPJ_UINT32 i;
11681|      0|        if (! opj_j2k_read_tile_header(p_j2k,
  ------------------
  |  Branch (11681:13): [True: 0, False: 0]
  ------------------
11682|      0|                                       &l_current_tile_no,
11683|      0|                                       NULL,
11684|      0|                                       &l_tile_x0, &l_tile_y0,
11685|      0|                                       &l_tile_x1, &l_tile_y1,
11686|      0|                                       &l_nb_comps,
11687|      0|                                       &l_go_on,
11688|      0|                                       p_stream,
11689|      0|                                       p_manager)) {
11690|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11691|      0|        }
11692|       |
11693|      0|        if (! opj_j2k_decode_tile(p_j2k, l_current_tile_no, NULL, 0,
  ------------------
  |  Branch (11693:13): [True: 0, False: 0]
  ------------------
11694|      0|                                  p_stream, p_manager)) {
11695|      0|            opj_event_msg(p_manager, EVT_ERROR, "Failed to decode tile 1/1\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11696|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11697|      0|        }
11698|       |
11699|       |        /* Transfer TCD data to output image data */
11700|      0|        for (i = 0; i < p_j2k->m_output_image->numcomps; i++) {
  ------------------
  |  Branch (11700:21): [True: 0, False: 0]
  ------------------
11701|      0|            opj_image_data_free(p_j2k->m_output_image->comps[i].data);
11702|      0|            p_j2k->m_output_image->comps[i].data =
11703|      0|                p_j2k->m_tcd->tcd_image->tiles->comps[i].data;
11704|      0|            p_j2k->m_output_image->comps[i].resno_decoded =
11705|      0|                p_j2k->m_tcd->image->comps[i].resno_decoded;
11706|      0|            p_j2k->m_tcd->tcd_image->tiles->comps[i].data = NULL;
11707|      0|        }
11708|       |
11709|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
11710|      0|    }
11711|       |
11712|  7.42k|    for (;;) {
11713|  7.42k|        if (p_j2k->m_cp.tw == 1 && p_j2k->m_cp.th == 1 &&
  ------------------
  |  Branch (11713:13): [True: 4.56k, False: 2.85k]
  |  Branch (11713:36): [True: 3.94k, False: 627]
  ------------------
11714|  7.42k|                p_j2k->m_cp.tcps[0].m_data != NULL) {
  ------------------
  |  Branch (11714:17): [True: 0, False: 3.94k]
  ------------------
11715|      0|            l_current_tile_no = 0;
11716|      0|            p_j2k->m_current_tile_number = 0;
11717|      0|            p_j2k->m_specific_param.m_decoder.m_state |= J2K_STATE_DATA;
11718|  7.42k|        } else {
11719|  7.42k|            if (! opj_j2k_read_tile_header(p_j2k,
  ------------------
  |  Branch (11719:17): [True: 438, False: 6.98k]
  ------------------
11720|  7.42k|                                           &l_current_tile_no,
11721|  7.42k|                                           NULL,
11722|  7.42k|                                           &l_tile_x0, &l_tile_y0,
11723|  7.42k|                                           &l_tile_x1, &l_tile_y1,
11724|  7.42k|                                           &l_nb_comps,
11725|  7.42k|                                           &l_go_on,
11726|  7.42k|                                           p_stream,
11727|  7.42k|                                           p_manager)) {
11728|    438|                return OPJ_FALSE;
  ------------------
  |  |  118|    438|#define OPJ_FALSE 0
  ------------------
11729|    438|            }
11730|       |
11731|  6.98k|            if (! l_go_on) {
  ------------------
  |  Branch (11731:17): [True: 33, False: 6.95k]
  ------------------
11732|     33|                break;
11733|     33|            }
11734|  6.98k|        }
11735|       |
11736|  6.95k|        if (! opj_j2k_decode_tile(p_j2k, l_current_tile_no, NULL, 0,
  ------------------
  |  Branch (11736:13): [True: 1.78k, False: 5.17k]
  ------------------
11737|  6.95k|                                  p_stream, p_manager)) {
11738|  1.78k|            opj_event_msg(p_manager, EVT_ERROR, "Failed to decode tile %d/%d\n",
  ------------------
  |  |   66|  1.78k|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11739|  1.78k|                          l_current_tile_no + 1, p_j2k->m_cp.th * p_j2k->m_cp.tw);
11740|  1.78k|            return OPJ_FALSE;
  ------------------
  |  |  118|  1.78k|#define OPJ_FALSE 0
  ------------------
11741|  1.78k|        }
11742|       |
11743|  5.17k|        opj_event_msg(p_manager, EVT_INFO, "Tile %d/%d has been decoded.\n",
  ------------------
  |  |   68|  5.17k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
11744|  5.17k|                      l_current_tile_no + 1, p_j2k->m_cp.th * p_j2k->m_cp.tw);
11745|       |
11746|  5.17k|        if (! opj_j2k_update_image_data(p_j2k->m_tcd,
  ------------------
  |  Branch (11746:13): [True: 14, False: 5.15k]
  ------------------
11747|  5.17k|                                        p_j2k->m_output_image)) {
11748|     14|            return OPJ_FALSE;
  ------------------
  |  |  118|     14|#define OPJ_FALSE 0
  ------------------
11749|     14|        }
11750|       |
11751|  5.15k|        if (p_j2k->m_cp.tw == 1 && p_j2k->m_cp.th == 1 &&
  ------------------
  |  Branch (11751:13): [True: 3.39k, False: 1.76k]
  |  Branch (11751:36): [True: 2.94k, False: 452]
  ------------------
11752|  5.15k|                !(p_j2k->m_output_image->x0 == p_j2k->m_private_image->x0 &&
  ------------------
  |  Branch (11752:19): [True: 2.94k, False: 0]
  ------------------
11753|  2.94k|                  p_j2k->m_output_image->y0 == p_j2k->m_private_image->y0 &&
  ------------------
  |  Branch (11753:19): [True: 2.94k, False: 0]
  ------------------
11754|  2.94k|                  p_j2k->m_output_image->x1 == p_j2k->m_private_image->x1 &&
  ------------------
  |  Branch (11754:19): [True: 1, False: 2.94k]
  ------------------
11755|  2.94k|                  p_j2k->m_output_image->y1 == p_j2k->m_private_image->y1)) {
  ------------------
  |  Branch (11755:19): [True: 0, False: 1]
  ------------------
11756|       |            /* Keep current tcp data */
11757|  2.94k|        } else {
11758|  2.21k|            opj_j2k_tcp_data_destroy(&p_j2k->m_cp.tcps[l_current_tile_no]);
11759|  2.21k|        }
11760|       |
11761|  5.15k|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|  5.15k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
11762|  5.15k|                      "Image data has been updated with tile %d.\n\n", l_current_tile_no + 1);
11763|       |
11764|  5.15k|        if (opj_stream_get_number_byte_left(p_stream) == 0
  ------------------
  |  Branch (11764:13): [True: 4.61k, False: 546]
  ------------------
11765|  5.15k|                && p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NEOC) {
  ------------------
  |  Branch (11765:20): [True: 4.60k, False: 7]
  ------------------
11766|  4.60k|            break;
11767|  4.60k|        }
11768|    553|        if (++nr_tiles ==  p_j2k->m_cp.th * p_j2k->m_cp.tw) {
  ------------------
  |  Branch (11768:13): [True: 6, False: 547]
  ------------------
11769|      6|            break;
11770|      6|        }
11771|    553|    }
11772|       |
11773|  4.64k|    if (! opj_j2k_are_all_used_components_decoded(p_j2k, p_manager)) {
  ------------------
  |  Branch (11773:9): [True: 190, False: 4.45k]
  ------------------
11774|    190|        return OPJ_FALSE;
  ------------------
  |  |  118|    190|#define OPJ_FALSE 0
  ------------------
11775|    190|    }
11776|       |
11777|  4.45k|    return OPJ_TRUE;
  ------------------
  |  |  117|  4.45k|#define OPJ_TRUE 1
  ------------------
11778|  4.64k|}
j2k.c:opj_j2k_update_image_data:
 9958|  5.17k|{
 9959|  5.17k|    OPJ_UINT32 i, j;
 9960|  5.17k|    OPJ_UINT32 l_width_src, l_height_src;
 9961|  5.17k|    OPJ_UINT32 l_width_dest, l_height_dest;
 9962|  5.17k|    OPJ_INT32 l_offset_x0_src, l_offset_y0_src, l_offset_x1_src, l_offset_y1_src;
 9963|  5.17k|    OPJ_SIZE_T l_start_offset_src;
 9964|  5.17k|    OPJ_UINT32 l_start_x_dest, l_start_y_dest;
 9965|  5.17k|    OPJ_UINT32 l_x0_dest, l_y0_dest, l_x1_dest, l_y1_dest;
 9966|  5.17k|    OPJ_SIZE_T l_start_offset_dest;
 9967|       |
 9968|  5.17k|    opj_image_comp_t * l_img_comp_src = 00;
 9969|  5.17k|    opj_image_comp_t * l_img_comp_dest = 00;
 9970|       |
 9971|  5.17k|    opj_tcd_tilecomp_t * l_tilec = 00;
 9972|  5.17k|    opj_image_t * l_image_src = 00;
 9973|  5.17k|    OPJ_INT32 * l_dest_ptr;
 9974|       |
 9975|  5.17k|    l_tilec = p_tcd->tcd_image->tiles->comps;
 9976|  5.17k|    l_image_src = p_tcd->image;
 9977|  5.17k|    l_img_comp_src = l_image_src->comps;
 9978|       |
 9979|  5.17k|    l_img_comp_dest = p_output_image->comps;
 9980|       |
 9981|  24.4k|    for (i = 0; i < l_image_src->numcomps;
  ------------------
  |  Branch (9981:17): [True: 19.3k, False: 5.15k]
  ------------------
 9982|  19.3k|            i++, ++l_img_comp_dest, ++l_img_comp_src,  ++l_tilec) {
 9983|  19.3k|        OPJ_INT32 res_x0, res_x1, res_y0, res_y1;
 9984|  19.3k|        OPJ_UINT32 src_data_stride;
 9985|  19.3k|        const OPJ_INT32* p_src_data;
 9986|       |
 9987|       |        /* Copy info from decoded comp image to output image */
 9988|  19.3k|        l_img_comp_dest->resno_decoded = l_img_comp_src->resno_decoded;
 9989|       |
 9990|  19.3k|        if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (9990:13): [True: 4.84k, False: 14.4k]
  ------------------
 9991|  4.84k|            opj_tcd_resolution_t* l_res = l_tilec->resolutions +
 9992|  4.84k|                                          l_img_comp_src->resno_decoded;
 9993|  4.84k|            res_x0 = l_res->x0;
 9994|  4.84k|            res_y0 = l_res->y0;
 9995|  4.84k|            res_x1 = l_res->x1;
 9996|  4.84k|            res_y1 = l_res->y1;
 9997|  4.84k|            src_data_stride = (OPJ_UINT32)(
 9998|  4.84k|                                  l_tilec->resolutions[l_tilec->minimum_num_resolutions - 1].x1 -
 9999|  4.84k|                                  l_tilec->resolutions[l_tilec->minimum_num_resolutions - 1].x0);
10000|  4.84k|            p_src_data = l_tilec->data;
10001|  14.4k|        } else {
10002|  14.4k|            opj_tcd_resolution_t* l_res = l_tilec->resolutions +
10003|  14.4k|                                          l_img_comp_src->resno_decoded;
10004|  14.4k|            res_x0 = (OPJ_INT32)l_res->win_x0;
10005|  14.4k|            res_y0 = (OPJ_INT32)l_res->win_y0;
10006|  14.4k|            res_x1 = (OPJ_INT32)l_res->win_x1;
10007|  14.4k|            res_y1 = (OPJ_INT32)l_res->win_y1;
10008|  14.4k|            src_data_stride = l_res->win_x1 - l_res->win_x0;
10009|  14.4k|            p_src_data = l_tilec->data_win;
10010|  14.4k|        }
10011|       |
10012|  19.3k|        if (p_src_data == NULL) {
  ------------------
  |  Branch (10012:13): [True: 1.21k, False: 18.1k]
  ------------------
10013|       |            /* Happens for partial component decoding */
10014|  1.21k|            continue;
10015|  1.21k|        }
10016|       |
10017|  18.1k|        l_width_src = (OPJ_UINT32)(res_x1 - res_x0);
10018|  18.1k|        l_height_src = (OPJ_UINT32)(res_y1 - res_y0);
10019|       |
10020|       |
10021|       |        /* Current tile component size*/
10022|       |        /*if (i == 0) {
10023|       |        fprintf(stdout, "SRC: l_res_x0=%d, l_res_x1=%d, l_res_y0=%d, l_res_y1=%d\n",
10024|       |                        res_x0, res_x1, res_y0, res_y1);
10025|       |        }*/
10026|       |
10027|       |
10028|       |        /* Border of the current output component*/
10029|  18.1k|        l_x0_dest = opj_uint_ceildivpow2(l_img_comp_dest->x0, l_img_comp_dest->factor);
10030|  18.1k|        l_y0_dest = opj_uint_ceildivpow2(l_img_comp_dest->y0, l_img_comp_dest->factor);
10031|  18.1k|        l_x1_dest = l_x0_dest +
10032|  18.1k|                    l_img_comp_dest->w; /* can't overflow given that image->x1 is uint32 */
10033|  18.1k|        l_y1_dest = l_y0_dest + l_img_comp_dest->h;
10034|       |
10035|       |        /*if (i == 0) {
10036|       |        fprintf(stdout, "DEST: l_x0_dest=%d, l_x1_dest=%d, l_y0_dest=%d, l_y1_dest=%d (%d)\n",
10037|       |                        l_x0_dest, l_x1_dest, l_y0_dest, l_y1_dest, l_img_comp_dest->factor );
10038|       |        }*/
10039|       |
10040|       |        /*-----*/
10041|       |        /* Compute the area (l_offset_x0_src, l_offset_y0_src, l_offset_x1_src, l_offset_y1_src)
10042|       |         * of the input buffer (decoded tile component) which will be move
10043|       |         * in the output buffer. Compute the area of the output buffer (l_start_x_dest,
10044|       |         * l_start_y_dest, l_width_dest, l_height_dest)  which will be modified
10045|       |         * by this input area.
10046|       |         * */
10047|  18.1k|        assert(res_x0 >= 0);
10048|  18.1k|        assert(res_x1 >= 0);
10049|  18.1k|        if (l_x0_dest < (OPJ_UINT32)res_x0) {
  ------------------
  |  Branch (10049:13): [True: 1.05k, False: 17.0k]
  ------------------
10050|  1.05k|            l_start_x_dest = (OPJ_UINT32)res_x0 - l_x0_dest;
10051|  1.05k|            l_offset_x0_src = 0;
10052|       |
10053|  1.05k|            if (l_x1_dest >= (OPJ_UINT32)res_x1) {
  ------------------
  |  Branch (10053:17): [True: 1.05k, False: 0]
  ------------------
10054|  1.05k|                l_width_dest = l_width_src;
10055|  1.05k|                l_offset_x1_src = 0;
10056|  1.05k|            } else {
10057|      0|                l_width_dest = l_x1_dest - (OPJ_UINT32)res_x0 ;
10058|      0|                l_offset_x1_src = (OPJ_INT32)(l_width_src - l_width_dest);
10059|      0|            }
10060|  17.0k|        } else {
10061|  17.0k|            l_start_x_dest = 0U;
10062|  17.0k|            l_offset_x0_src = (OPJ_INT32)l_x0_dest - res_x0;
10063|       |
10064|  17.0k|            if (l_x1_dest >= (OPJ_UINT32)res_x1) {
  ------------------
  |  Branch (10064:17): [True: 17.0k, False: 0]
  ------------------
10065|  17.0k|                l_width_dest = l_width_src - (OPJ_UINT32)l_offset_x0_src;
10066|  17.0k|                l_offset_x1_src = 0;
10067|  17.0k|            } else {
10068|      0|                l_width_dest = l_img_comp_dest->w ;
10069|      0|                l_offset_x1_src = res_x1 - (OPJ_INT32)l_x1_dest;
10070|      0|            }
10071|  17.0k|        }
10072|       |
10073|  18.1k|        if (l_y0_dest < (OPJ_UINT32)res_y0) {
  ------------------
  |  Branch (10073:13): [True: 1.45k, False: 16.6k]
  ------------------
10074|  1.45k|            l_start_y_dest = (OPJ_UINT32)res_y0 - l_y0_dest;
10075|  1.45k|            l_offset_y0_src = 0;
10076|       |
10077|  1.45k|            if (l_y1_dest >= (OPJ_UINT32)res_y1) {
  ------------------
  |  Branch (10077:17): [True: 1.45k, False: 0]
  ------------------
10078|  1.45k|                l_height_dest = l_height_src;
10079|  1.45k|                l_offset_y1_src = 0;
10080|  1.45k|            } else {
10081|      0|                l_height_dest = l_y1_dest - (OPJ_UINT32)res_y0 ;
10082|      0|                l_offset_y1_src = (OPJ_INT32)(l_height_src - l_height_dest);
10083|      0|            }
10084|  16.6k|        } else {
10085|  16.6k|            l_start_y_dest = 0U;
10086|  16.6k|            l_offset_y0_src = (OPJ_INT32)l_y0_dest - res_y0;
10087|       |
10088|  16.6k|            if (l_y1_dest >= (OPJ_UINT32)res_y1) {
  ------------------
  |  Branch (10088:17): [True: 16.6k, False: 0]
  ------------------
10089|  16.6k|                l_height_dest = l_height_src - (OPJ_UINT32)l_offset_y0_src;
10090|  16.6k|                l_offset_y1_src = 0;
10091|  16.6k|            } else {
10092|      0|                l_height_dest = l_img_comp_dest->h ;
10093|      0|                l_offset_y1_src = res_y1 - (OPJ_INT32)l_y1_dest;
10094|      0|            }
10095|  16.6k|        }
10096|       |
10097|  18.1k|        if ((l_offset_x0_src < 0) || (l_offset_y0_src < 0) || (l_offset_x1_src < 0) ||
  ------------------
  |  Branch (10097:13): [True: 0, False: 18.1k]
  |  Branch (10097:38): [True: 0, False: 18.1k]
  |  Branch (10097:63): [True: 0, False: 18.1k]
  ------------------
10098|  18.1k|                (l_offset_y1_src < 0)) {
  ------------------
  |  Branch (10098:17): [True: 0, False: 18.1k]
  ------------------
10099|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10100|      0|        }
10101|       |        /* testcase 2977.pdf.asan.67.2198 */
10102|  18.1k|        if ((OPJ_INT32)l_width_dest < 0 || (OPJ_INT32)l_height_dest < 0) {
  ------------------
  |  Branch (10102:13): [True: 14, False: 18.0k]
  |  Branch (10102:44): [True: 0, False: 18.0k]
  ------------------
10103|     14|            return OPJ_FALSE;
  ------------------
  |  |  118|     14|#define OPJ_FALSE 0
  ------------------
10104|     14|        }
10105|       |        /*-----*/
10106|       |
10107|       |        /* Compute the input buffer offset */
10108|  18.0k|        l_start_offset_src = (OPJ_SIZE_T)l_offset_x0_src + (OPJ_SIZE_T)l_offset_y0_src
10109|  18.0k|                             * (OPJ_SIZE_T)src_data_stride;
10110|       |
10111|       |        /* Compute the output buffer offset */
10112|  18.0k|        l_start_offset_dest = (OPJ_SIZE_T)l_start_x_dest + (OPJ_SIZE_T)l_start_y_dest
10113|  18.0k|                              * (OPJ_SIZE_T)l_img_comp_dest->w;
10114|       |
10115|       |        /* Allocate output component buffer if necessary */
10116|  18.0k|        if (l_img_comp_dest->data == NULL &&
  ------------------
  |  Branch (10116:13): [True: 17.1k, False: 917]
  ------------------
10117|  18.0k|                l_start_offset_src == 0 && l_start_offset_dest == 0 &&
  ------------------
  |  Branch (10117:17): [True: 17.1k, False: 0]
  |  Branch (10117:44): [True: 15.8k, False: 1.27k]
  ------------------
10118|  18.0k|                src_data_stride == l_img_comp_dest->w &&
  ------------------
  |  Branch (10118:17): [True: 11.3k, False: 4.50k]
  ------------------
10119|  18.0k|                l_width_dest == l_img_comp_dest->w &&
  ------------------
  |  Branch (10119:17): [True: 11.3k, False: 0]
  ------------------
10120|  18.0k|                l_height_dest == l_img_comp_dest->h) {
  ------------------
  |  Branch (10120:17): [True: 10.7k, False: 619]
  ------------------
10121|       |            /* If the final image matches the tile buffer, then borrow it */
10122|       |            /* directly to save a copy */
10123|  10.7k|            if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (10123:17): [True: 143, False: 10.6k]
  ------------------
10124|    143|                l_img_comp_dest->data = l_tilec->data;
10125|    143|                l_tilec->data = NULL;
10126|  10.6k|            } else {
10127|  10.6k|                l_img_comp_dest->data = l_tilec->data_win;
10128|  10.6k|                l_tilec->data_win = NULL;
10129|  10.6k|            }
10130|  10.7k|            continue;
10131|  10.7k|        } else if (l_img_comp_dest->data == NULL) {
  ------------------
  |  Branch (10131:20): [True: 6.39k, False: 917]
  ------------------
10132|  6.39k|            OPJ_SIZE_T l_width = l_img_comp_dest->w;
10133|  6.39k|            OPJ_SIZE_T l_height = l_img_comp_dest->h;
10134|       |
10135|  6.39k|            if ((l_height == 0U) || (l_width > (SIZE_MAX / l_height)) ||
  ------------------
  |  Branch (10135:17): [True: 0, False: 6.39k]
  |  Branch (10135:37): [True: 0, False: 6.39k]
  ------------------
10136|  6.39k|                    l_width * l_height > SIZE_MAX / sizeof(OPJ_INT32)) {
  ------------------
  |  Branch (10136:21): [True: 0, False: 6.39k]
  ------------------
10137|       |                /* would overflow */
10138|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10139|      0|            }
10140|  6.39k|            l_img_comp_dest->data = (OPJ_INT32*) opj_image_data_alloc(l_width * l_height *
10141|  6.39k|                                    sizeof(OPJ_INT32));
10142|  6.39k|            if (! l_img_comp_dest->data) {
  ------------------
  |  Branch (10142:17): [True: 0, False: 6.39k]
  ------------------
10143|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10144|      0|            }
10145|       |
10146|  6.39k|            if (l_img_comp_dest->w != l_width_dest ||
  ------------------
  |  Branch (10146:17): [True: 5.55k, False: 845]
  ------------------
10147|  6.39k|                    l_img_comp_dest->h != l_height_dest) {
  ------------------
  |  Branch (10147:21): [True: 845, False: 0]
  ------------------
10148|  6.39k|                memset(l_img_comp_dest->data, 0,
10149|  6.39k|                       (OPJ_SIZE_T)l_img_comp_dest->w * l_img_comp_dest->h * sizeof(OPJ_INT32));
10150|  6.39k|            }
10151|  6.39k|        }
10152|       |
10153|       |        /* Move the output buffer to the first place where we will write*/
10154|  7.31k|        l_dest_ptr = l_img_comp_dest->data + l_start_offset_dest;
10155|       |
10156|  7.31k|        {
10157|  7.31k|            const OPJ_INT32 * l_src_ptr = p_src_data;
10158|  7.31k|            l_src_ptr += l_start_offset_src;
10159|       |
10160|  1.03M|            for (j = 0; j < l_height_dest; ++j) {
  ------------------
  |  Branch (10160:25): [True: 1.02M, False: 7.31k]
  ------------------
10161|  1.02M|                memcpy(l_dest_ptr, l_src_ptr, l_width_dest * sizeof(OPJ_INT32));
10162|  1.02M|                l_dest_ptr += l_img_comp_dest->w;
10163|  1.02M|                l_src_ptr += src_data_stride;
10164|  1.02M|            }
10165|  7.31k|        }
10166|       |
10167|       |
10168|  7.31k|    }
10169|       |
10170|  5.15k|    return OPJ_TRUE;
  ------------------
  |  |  117|  5.15k|#define OPJ_TRUE 1
  ------------------
10171|  5.17k|}
j2k.c:opj_j2k_are_all_used_components_decoded:
11628|  4.64k|{
11629|  4.64k|    OPJ_UINT32 compno;
11630|  4.64k|    OPJ_BOOL decoded_all_used_components = OPJ_TRUE;
  ------------------
  |  |  117|  4.64k|#define OPJ_TRUE 1
  ------------------
11631|       |
11632|  4.64k|    if (p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode) {
  ------------------
  |  Branch (11632:9): [True: 0, False: 4.64k]
  ------------------
11633|      0|        for (compno = 0;
11634|      0|                compno < p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode; compno++) {
  ------------------
  |  Branch (11634:17): [True: 0, False: 0]
  ------------------
11635|      0|            OPJ_UINT32 dec_compno =
11636|      0|                p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode[compno];
11637|      0|            if (p_j2k->m_output_image->comps[dec_compno].data == NULL) {
  ------------------
  |  Branch (11637:17): [True: 0, False: 0]
  ------------------
11638|      0|                opj_event_msg(p_manager, EVT_WARNING, "Failed to decode component %d\n",
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
11639|      0|                              dec_compno);
11640|      0|                decoded_all_used_components = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11641|      0|            }
11642|      0|        }
11643|  4.64k|    } else {
11644|  22.4k|        for (compno = 0; compno < p_j2k->m_output_image->numcomps; compno++) {
  ------------------
  |  Branch (11644:26): [True: 17.7k, False: 4.64k]
  ------------------
11645|  17.7k|            if (p_j2k->m_output_image->comps[compno].data == NULL) {
  ------------------
  |  Branch (11645:17): [True: 917, False: 16.8k]
  ------------------
11646|    917|                opj_event_msg(p_manager, EVT_WARNING, "Failed to decode component %d\n",
  ------------------
  |  |   67|    917|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
11647|    917|                              compno);
11648|    917|                decoded_all_used_components = OPJ_FALSE;
  ------------------
  |  |  118|    917|#define OPJ_FALSE 0
  ------------------
11649|    917|            }
11650|  17.7k|        }
11651|  4.64k|    }
11652|       |
11653|  4.64k|    if (decoded_all_used_components == OPJ_FALSE) {
  ------------------
  |  |  118|  4.64k|#define OPJ_FALSE 0
  ------------------
  |  Branch (11653:9): [True: 190, False: 4.45k]
  ------------------
11654|    190|        opj_event_msg(p_manager, EVT_ERROR, "Failed to decode all used components\n");
  ------------------
  |  |   66|    190|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11655|    190|        return OPJ_FALSE;
  ------------------
  |  |  118|    190|#define OPJ_FALSE 0
  ------------------
11656|    190|    }
11657|       |
11658|  4.45k|    return OPJ_TRUE;
  ------------------
  |  |  117|  4.45k|#define OPJ_TRUE 1
  ------------------
11659|  4.64k|}
j2k.c:opj_j2k_move_data_from_codec_to_output_image:
11933|  4.45k|{
11934|  4.45k|    OPJ_UINT32 compno;
11935|       |
11936|       |    /* Move data and copy one information from codec to output image*/
11937|  4.45k|    if (p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode > 0) {
  ------------------
  |  Branch (11937:9): [True: 0, False: 4.45k]
  ------------------
11938|      0|        opj_image_comp_t* newcomps =
11939|      0|            (opj_image_comp_t*) opj_malloc(
11940|      0|                p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode *
11941|      0|                sizeof(opj_image_comp_t));
11942|      0|        if (newcomps == NULL) {
  ------------------
  |  Branch (11942:13): [True: 0, False: 0]
  ------------------
11943|      0|            opj_image_destroy(p_j2k->m_private_image);
11944|      0|            p_j2k->m_private_image = NULL;
11945|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11946|      0|        }
11947|      0|        for (compno = 0; compno < p_image->numcomps; compno++) {
  ------------------
  |  Branch (11947:26): [True: 0, False: 0]
  ------------------
11948|      0|            opj_image_data_free(p_image->comps[compno].data);
11949|      0|            p_image->comps[compno].data = NULL;
11950|      0|        }
11951|      0|        for (compno = 0;
11952|      0|                compno < p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode; compno++) {
  ------------------
  |  Branch (11952:17): [True: 0, False: 0]
  ------------------
11953|      0|            OPJ_UINT32 src_compno =
11954|      0|                p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode[compno];
11955|      0|            memcpy(&(newcomps[compno]),
11956|      0|                   &(p_j2k->m_output_image->comps[src_compno]),
11957|      0|                   sizeof(opj_image_comp_t));
11958|      0|            newcomps[compno].resno_decoded =
11959|      0|                p_j2k->m_output_image->comps[src_compno].resno_decoded;
11960|      0|            newcomps[compno].data = p_j2k->m_output_image->comps[src_compno].data;
11961|      0|            p_j2k->m_output_image->comps[src_compno].data = NULL;
11962|      0|        }
11963|      0|        for (compno = 0; compno < p_image->numcomps; compno++) {
  ------------------
  |  Branch (11963:26): [True: 0, False: 0]
  ------------------
11964|      0|            assert(p_j2k->m_output_image->comps[compno].data == NULL);
11965|      0|            opj_image_data_free(p_j2k->m_output_image->comps[compno].data);
11966|      0|            p_j2k->m_output_image->comps[compno].data = NULL;
11967|      0|        }
11968|      0|        p_image->numcomps = p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode;
11969|      0|        opj_free(p_image->comps);
11970|      0|        p_image->comps = newcomps;
11971|  4.45k|    } else {
11972|  20.1k|        for (compno = 0; compno < p_image->numcomps; compno++) {
  ------------------
  |  Branch (11972:26): [True: 15.7k, False: 4.45k]
  ------------------
11973|  15.7k|            p_image->comps[compno].resno_decoded =
11974|  15.7k|                p_j2k->m_output_image->comps[compno].resno_decoded;
11975|  15.7k|            opj_image_data_free(p_image->comps[compno].data);
11976|  15.7k|            p_image->comps[compno].data = p_j2k->m_output_image->comps[compno].data;
11977|       |#if 0
11978|       |            char fn[256];
11979|       |            snprintf(fn, sizeof fn, "/tmp/%d.raw", compno);
11980|       |            FILE *debug = fopen(fn, "wb");
11981|       |            fwrite(p_image->comps[compno].data, sizeof(OPJ_INT32),
11982|       |                   p_image->comps[compno].w * p_image->comps[compno].h, debug);
11983|       |            fclose(debug);
11984|       |#endif
11985|  15.7k|            p_j2k->m_output_image->comps[compno].data = NULL;
11986|  15.7k|        }
11987|  4.45k|    }
11988|  4.45k|    return OPJ_TRUE;
  ------------------
  |  |  117|  4.45k|#define OPJ_TRUE 1
  ------------------
11989|  4.45k|}

opj_jp2_decode:
 1635|  6.88k|{
 1636|  6.88k|    if (!p_image) {
  ------------------
  |  Branch (1636:9): [True: 0, False: 6.88k]
  ------------------
 1637|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1638|      0|    }
 1639|       |
 1640|       |    /* J2K decoding */
 1641|  6.88k|    if (! opj_j2k_decode(jp2->j2k, p_stream, p_image, p_manager)) {
  ------------------
  |  Branch (1641:9): [True: 2.42k, False: 4.45k]
  ------------------
 1642|  2.42k|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|  2.42k|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1643|  2.42k|                      "Failed to decode the codestream in the JP2 file\n");
 1644|  2.42k|        return OPJ_FALSE;
  ------------------
  |  |  118|  2.42k|#define OPJ_FALSE 0
  ------------------
 1645|  2.42k|    }
 1646|       |
 1647|  4.45k|    return opj_jp2_apply_color_postprocessing(jp2, p_image, p_manager);
 1648|  6.88k|}
opj_jp2_setup_decoder:
 1880|  9.22k|{
 1881|       |    /* setup the J2K codec */
 1882|  9.22k|    opj_j2k_setup_decoder(jp2->j2k, parameters);
 1883|       |
 1884|       |    /* further JP2 initializations go here */
 1885|  9.22k|    jp2->color.jp2_has_colr = 0;
 1886|  9.22k|    jp2->ignore_pclr_cmap_cdef = parameters->flags &
 1887|  9.22k|                                 OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
  ------------------
  |  |  546|  9.22k|#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG  0x0001
  ------------------
 1888|  9.22k|}
opj_jp2_end_decompress:
 2102|  6.88k|{
 2103|       |    /* preconditions */
 2104|  6.88k|    assert(jp2 != 00);
 2105|  6.88k|    assert(cio != 00);
 2106|  6.88k|    assert(p_manager != 00);
 2107|       |
 2108|       |    /* customization of the end encoding */
 2109|  6.88k|    if (! opj_jp2_setup_end_header_reading(jp2, p_manager)) {
  ------------------
  |  Branch (2109:9): [True: 0, False: 6.88k]
  ------------------
 2110|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2111|      0|    }
 2112|       |
 2113|       |    /* write header */
 2114|  6.88k|    if (! opj_jp2_exec(jp2, jp2->m_procedure_list, cio, p_manager)) {
  ------------------
  |  Branch (2114:9): [True: 5, False: 6.87k]
  ------------------
 2115|      5|        return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 2116|      5|    }
 2117|       |
 2118|  6.87k|    return opj_j2k_end_decompress(jp2->j2k, cio, p_manager);
 2119|  6.88k|}
opj_jp2_read_header:
 2831|  9.22k|{
 2832|  9.22k|    int ret;
 2833|       |
 2834|       |    /* preconditions */
 2835|  9.22k|    assert(jp2 != 00);
 2836|  9.22k|    assert(p_stream != 00);
 2837|  9.22k|    assert(p_manager != 00);
 2838|       |
 2839|       |    /* customization of the validation */
 2840|  9.22k|    if (! opj_jp2_setup_decoding_validation(jp2, p_manager)) {
  ------------------
  |  Branch (2840:9): [True: 0, False: 9.22k]
  ------------------
 2841|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2842|      0|    }
 2843|       |
 2844|       |    /* customization of the encoding */
 2845|  9.22k|    if (! opj_jp2_setup_header_reading(jp2, p_manager)) {
  ------------------
  |  Branch (2845:9): [True: 0, False: 9.22k]
  ------------------
 2846|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2847|      0|    }
 2848|       |
 2849|       |    /* validation of the parameters codec */
 2850|  9.22k|    if (! opj_jp2_exec(jp2, jp2->m_validation_list, p_stream, p_manager)) {
  ------------------
  |  Branch (2850:9): [True: 0, False: 9.22k]
  ------------------
 2851|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2852|      0|    }
 2853|       |
 2854|       |    /* read header */
 2855|  9.22k|    if (! opj_jp2_exec(jp2, jp2->m_procedure_list, p_stream, p_manager)) {
  ------------------
  |  Branch (2855:9): [True: 913, False: 8.31k]
  ------------------
 2856|    913|        return OPJ_FALSE;
  ------------------
  |  |  118|    913|#define OPJ_FALSE 0
  ------------------
 2857|    913|    }
 2858|  8.31k|    if (jp2->has_jp2h == 0) {
  ------------------
  |  Branch (2858:9): [True: 266, False: 8.04k]
  ------------------
 2859|    266|        opj_event_msg(p_manager, EVT_ERROR, "JP2H box missing. Required.\n");
  ------------------
  |  |   66|    266|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2860|    266|        return OPJ_FALSE;
  ------------------
  |  |  118|    266|#define OPJ_FALSE 0
  ------------------
 2861|    266|    }
 2862|  8.04k|    if (jp2->has_ihdr == 0) {
  ------------------
  |  Branch (2862:9): [True: 0, False: 8.04k]
  ------------------
 2863|      0|        opj_event_msg(p_manager, EVT_ERROR, "IHDR box_missing. Required.\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2864|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2865|      0|    }
 2866|       |
 2867|  8.04k|    ret = opj_j2k_read_header(p_stream,
 2868|  8.04k|                              jp2->j2k,
 2869|  8.04k|                              p_image,
 2870|  8.04k|                              p_manager);
 2871|       |
 2872|  8.04k|    if (p_image && *p_image) {
  ------------------
  |  Branch (2872:9): [True: 8.04k, False: 0]
  |  Branch (2872:20): [True: 6.88k, False: 1.16k]
  ------------------
 2873|       |        /* Set Image Color Space */
 2874|  6.88k|        if (jp2->enumcs == 16) {
  ------------------
  |  Branch (2874:13): [True: 20, False: 6.86k]
  ------------------
 2875|     20|            (*p_image)->color_space = OPJ_CLRSPC_SRGB;
 2876|  6.86k|        } else if (jp2->enumcs == 17) {
  ------------------
  |  Branch (2876:20): [True: 23, False: 6.83k]
  ------------------
 2877|     23|            (*p_image)->color_space = OPJ_CLRSPC_GRAY;
 2878|  6.83k|        } else if (jp2->enumcs == 18) {
  ------------------
  |  Branch (2878:20): [True: 216, False: 6.62k]
  ------------------
 2879|    216|            (*p_image)->color_space = OPJ_CLRSPC_SYCC;
 2880|  6.62k|        } else if (jp2->enumcs == 24) {
  ------------------
  |  Branch (2880:20): [True: 7, False: 6.61k]
  ------------------
 2881|      7|            (*p_image)->color_space = OPJ_CLRSPC_EYCC;
 2882|  6.61k|        } else if (jp2->enumcs == 12) {
  ------------------
  |  Branch (2882:20): [True: 1, False: 6.61k]
  ------------------
 2883|      1|            (*p_image)->color_space = OPJ_CLRSPC_CMYK;
 2884|  6.61k|        } else {
 2885|  6.61k|            (*p_image)->color_space = OPJ_CLRSPC_UNKNOWN;
 2886|  6.61k|        }
 2887|       |
 2888|  6.88k|        if (jp2->color.icc_profile_buf) {
  ------------------
  |  Branch (2888:13): [True: 30, False: 6.85k]
  ------------------
 2889|     30|            (*p_image)->icc_profile_buf = jp2->color.icc_profile_buf;
 2890|     30|            (*p_image)->icc_profile_len = jp2->color.icc_profile_len;
 2891|     30|            jp2->color.icc_profile_buf = NULL;
 2892|     30|        }
 2893|  6.88k|    }
 2894|  8.04k|    return ret;
 2895|  8.04k|}
opj_jp2_destroy:
 3030|  9.22k|{
 3031|  9.22k|    if (jp2) {
  ------------------
  |  Branch (3031:9): [True: 9.22k, False: 0]
  ------------------
 3032|       |        /* destroy the J2K codec */
 3033|  9.22k|        opj_j2k_destroy(jp2->j2k);
 3034|  9.22k|        jp2->j2k = 00;
 3035|       |
 3036|  9.22k|        if (jp2->comps) {
  ------------------
  |  Branch (3036:13): [True: 8.11k, False: 1.10k]
  ------------------
 3037|  8.11k|            opj_free(jp2->comps);
 3038|  8.11k|            jp2->comps = 00;
 3039|  8.11k|        }
 3040|       |
 3041|  9.22k|        if (jp2->cl) {
  ------------------
  |  Branch (3041:13): [True: 7.01k, False: 2.20k]
  ------------------
 3042|  7.01k|            opj_free(jp2->cl);
 3043|  7.01k|            jp2->cl = 00;
 3044|  7.01k|        }
 3045|       |
 3046|  9.22k|        if (jp2->color.icc_profile_buf) {
  ------------------
  |  Branch (3046:13): [True: 44, False: 9.18k]
  ------------------
 3047|     44|            opj_free(jp2->color.icc_profile_buf);
 3048|     44|            jp2->color.icc_profile_buf = 00;
 3049|     44|        }
 3050|       |
 3051|  9.22k|        if (jp2->color.jp2_cdef) {
  ------------------
  |  Branch (3051:13): [True: 95, False: 9.13k]
  ------------------
 3052|     95|            if (jp2->color.jp2_cdef->info) {
  ------------------
  |  Branch (3052:17): [True: 95, False: 0]
  ------------------
 3053|     95|                opj_free(jp2->color.jp2_cdef->info);
 3054|     95|                jp2->color.jp2_cdef->info = NULL;
 3055|     95|            }
 3056|       |
 3057|     95|            opj_free(jp2->color.jp2_cdef);
 3058|     95|            jp2->color.jp2_cdef = 00;
 3059|     95|        }
 3060|       |
 3061|  9.22k|        if (jp2->color.jp2_pclr) {
  ------------------
  |  Branch (3061:13): [True: 244, False: 8.98k]
  ------------------
 3062|    244|            if (jp2->color.jp2_pclr->cmap) {
  ------------------
  |  Branch (3062:17): [True: 182, False: 62]
  ------------------
 3063|    182|                opj_free(jp2->color.jp2_pclr->cmap);
 3064|    182|                jp2->color.jp2_pclr->cmap = NULL;
 3065|    182|            }
 3066|    244|            if (jp2->color.jp2_pclr->channel_sign) {
  ------------------
  |  Branch (3066:17): [True: 244, False: 0]
  ------------------
 3067|    244|                opj_free(jp2->color.jp2_pclr->channel_sign);
 3068|    244|                jp2->color.jp2_pclr->channel_sign = NULL;
 3069|    244|            }
 3070|    244|            if (jp2->color.jp2_pclr->channel_size) {
  ------------------
  |  Branch (3070:17): [True: 244, False: 0]
  ------------------
 3071|    244|                opj_free(jp2->color.jp2_pclr->channel_size);
 3072|    244|                jp2->color.jp2_pclr->channel_size = NULL;
 3073|    244|            }
 3074|    244|            if (jp2->color.jp2_pclr->entries) {
  ------------------
  |  Branch (3074:17): [True: 244, False: 0]
  ------------------
 3075|    244|                opj_free(jp2->color.jp2_pclr->entries);
 3076|    244|                jp2->color.jp2_pclr->entries = NULL;
 3077|    244|            }
 3078|       |
 3079|    244|            opj_free(jp2->color.jp2_pclr);
 3080|    244|            jp2->color.jp2_pclr = 00;
 3081|    244|        }
 3082|       |
 3083|  9.22k|        if (jp2->m_validation_list) {
  ------------------
  |  Branch (3083:13): [True: 9.22k, False: 0]
  ------------------
 3084|  9.22k|            opj_procedure_list_destroy(jp2->m_validation_list);
 3085|  9.22k|            jp2->m_validation_list = 00;
 3086|  9.22k|        }
 3087|       |
 3088|  9.22k|        if (jp2->m_procedure_list) {
  ------------------
  |  Branch (3088:13): [True: 9.22k, False: 0]
  ------------------
 3089|  9.22k|            opj_procedure_list_destroy(jp2->m_procedure_list);
 3090|  9.22k|            jp2->m_procedure_list = 00;
 3091|  9.22k|        }
 3092|       |
 3093|  9.22k|        opj_free(jp2);
 3094|  9.22k|    }
 3095|  9.22k|}
opj_jp2_set_decode_area:
 3113|  6.88k|{
 3114|  6.88k|    return opj_j2k_set_decode_area(p_jp2->j2k, p_image, p_start_x, p_start_y,
 3115|  6.88k|                                   p_end_x, p_end_y, p_manager);
 3116|  6.88k|}
opj_jp2_create:
 3146|  9.22k|{
 3147|  9.22k|    opj_jp2_t *jp2 = (opj_jp2_t*)opj_calloc(1, sizeof(opj_jp2_t));
 3148|  9.22k|    if (jp2) {
  ------------------
  |  Branch (3148:9): [True: 9.22k, False: 0]
  ------------------
 3149|       |
 3150|       |        /* create the J2K codec */
 3151|  9.22k|        if (! p_is_decoder) {
  ------------------
  |  Branch (3151:13): [True: 0, False: 9.22k]
  ------------------
 3152|      0|            jp2->j2k = opj_j2k_create_compress();
 3153|  9.22k|        } else {
 3154|  9.22k|            jp2->j2k = opj_j2k_create_decompress();
 3155|  9.22k|        }
 3156|       |
 3157|  9.22k|        if (jp2->j2k == 00) {
  ------------------
  |  Branch (3157:13): [True: 0, False: 9.22k]
  ------------------
 3158|      0|            opj_jp2_destroy(jp2);
 3159|      0|            return 00;
 3160|      0|        }
 3161|       |
 3162|       |        /* Color structure */
 3163|  9.22k|        jp2->color.icc_profile_buf = NULL;
 3164|  9.22k|        jp2->color.icc_profile_len = 0;
 3165|  9.22k|        jp2->color.jp2_cdef = NULL;
 3166|  9.22k|        jp2->color.jp2_pclr = NULL;
 3167|  9.22k|        jp2->color.jp2_has_colr = 0;
 3168|       |
 3169|       |        /* validation list creation */
 3170|  9.22k|        jp2->m_validation_list = opj_procedure_list_create();
 3171|  9.22k|        if (! jp2->m_validation_list) {
  ------------------
  |  Branch (3171:13): [True: 0, False: 9.22k]
  ------------------
 3172|      0|            opj_jp2_destroy(jp2);
 3173|      0|            return 00;
 3174|      0|        }
 3175|       |
 3176|       |        /* execution list creation */
 3177|  9.22k|        jp2->m_procedure_list = opj_procedure_list_create();
 3178|  9.22k|        if (! jp2->m_procedure_list) {
  ------------------
  |  Branch (3178:13): [True: 0, False: 9.22k]
  ------------------
 3179|      0|            opj_jp2_destroy(jp2);
 3180|      0|            return 00;
 3181|      0|        }
 3182|  9.22k|    }
 3183|       |
 3184|  9.22k|    return jp2;
 3185|  9.22k|}
jp2.c:opj_jp2_apply_color_postprocessing:
 1600|  4.45k|{
 1601|  4.45k|    if (jp2->j2k->m_specific_param.m_decoder.m_numcomps_to_decode) {
  ------------------
  |  Branch (1601:9): [True: 0, False: 4.45k]
  ------------------
 1602|       |        /* Bypass all JP2 component transforms */
 1603|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1604|      0|    }
 1605|       |
 1606|  4.45k|    if (!jp2->ignore_pclr_cmap_cdef) {
  ------------------
  |  Branch (1606:9): [True: 4.45k, False: 0]
  ------------------
 1607|  4.45k|        if (!opj_jp2_check_color(p_image, &(jp2->color), p_manager)) {
  ------------------
  |  Branch (1607:13): [True: 67, False: 4.38k]
  ------------------
 1608|     67|            return OPJ_FALSE;
  ------------------
  |  |  118|     67|#define OPJ_FALSE 0
  ------------------
 1609|     67|        }
 1610|       |
 1611|  4.38k|        if (jp2->color.jp2_pclr) {
  ------------------
  |  Branch (1611:13): [True: 127, False: 4.25k]
  ------------------
 1612|       |            /* Part 1, I.5.3.4: Either both or none : */
 1613|    127|            if (!jp2->color.jp2_pclr->cmap) {
  ------------------
  |  Branch (1613:17): [True: 2, False: 125]
  ------------------
 1614|      2|                opj_jp2_free_pclr(&(jp2->color));
 1615|    125|            } else {
 1616|    125|                if (!opj_jp2_apply_pclr(p_image, &(jp2->color), p_manager)) {
  ------------------
  |  Branch (1616:21): [True: 0, False: 125]
  ------------------
 1617|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1618|      0|                }
 1619|    125|            }
 1620|    127|        }
 1621|       |
 1622|       |        /* Apply the color space if needed */
 1623|  4.38k|        if (jp2->color.jp2_cdef) {
  ------------------
  |  Branch (1623:13): [True: 18, False: 4.36k]
  ------------------
 1624|     18|            opj_jp2_apply_cdef(p_image, &(jp2->color), p_manager);
 1625|     18|        }
 1626|  4.38k|    }
 1627|       |
 1628|  4.38k|    return OPJ_TRUE;
  ------------------
  |  |  117|  4.38k|#define OPJ_TRUE 1
  ------------------
 1629|  4.45k|}
jp2.c:opj_jp2_check_color:
  896|  4.45k|{
  897|  4.45k|    OPJ_UINT16 i;
  898|       |
  899|       |    /* testcase 4149.pdf.SIGSEGV.cf7.3501 */
  900|  4.45k|    if (color->jp2_cdef) {
  ------------------
  |  Branch (900:9): [True: 50, False: 4.40k]
  ------------------
  901|     50|        opj_jp2_cdef_info_t *info = color->jp2_cdef->info;
  902|     50|        OPJ_UINT16 n = color->jp2_cdef->n;
  903|     50|        OPJ_UINT32 nr_channels =
  904|     50|            image->numcomps; /* FIXME image->numcomps == jp2->numcomps before color is applied ??? */
  905|       |
  906|       |        /* cdef applies to cmap channels if any */
  907|     50|        if (color->jp2_pclr && color->jp2_pclr->cmap) {
  ------------------
  |  Branch (907:13): [True: 1, False: 49]
  |  Branch (907:32): [True: 1, False: 0]
  ------------------
  908|      1|            nr_channels = (OPJ_UINT32)color->jp2_pclr->nr_channels;
  909|      1|        }
  910|       |
  911|    158|        for (i = 0; i < n; i++) {
  ------------------
  |  Branch (911:21): [True: 131, False: 27]
  ------------------
  912|    131|            if (info[i].cn >= nr_channels) {
  ------------------
  |  Branch (912:17): [True: 6, False: 125]
  ------------------
  913|      6|                opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n",
  ------------------
  |  |   66|      6|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  914|      6|                              info[i].cn, nr_channels);
  915|      6|                return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
  916|      6|            }
  917|    125|            if (info[i].asoc == 65535U) {
  ------------------
  |  Branch (917:17): [True: 4, False: 121]
  ------------------
  918|      4|                continue;
  919|      4|            }
  920|       |
  921|    121|            if (info[i].asoc > 0 && (OPJ_UINT32)(info[i].asoc - 1) >= nr_channels) {
  ------------------
  |  Branch (921:17): [True: 87, False: 34]
  |  Branch (921:37): [True: 17, False: 70]
  ------------------
  922|     17|                opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n",
  ------------------
  |  |   66|     17|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  923|     17|                              info[i].asoc - 1, nr_channels);
  924|     17|                return OPJ_FALSE;
  ------------------
  |  |  118|     17|#define OPJ_FALSE 0
  ------------------
  925|     17|            }
  926|    121|        }
  927|       |
  928|       |        /* issue 397 */
  929|       |        /* ISO 15444-1 states that if cdef is present, it shall contain a complete list of channel definitions. */
  930|     88|        while (nr_channels > 0) {
  ------------------
  |  Branch (930:16): [True: 70, False: 18]
  ------------------
  931|    150|            for (i = 0; i < n; ++i) {
  ------------------
  |  Branch (931:25): [True: 141, False: 9]
  ------------------
  932|    141|                if ((OPJ_UINT32)info[i].cn == (nr_channels - 1U)) {
  ------------------
  |  Branch (932:21): [True: 61, False: 80]
  ------------------
  933|     61|                    break;
  934|     61|                }
  935|    141|            }
  936|     70|            if (i == n) {
  ------------------
  |  Branch (936:17): [True: 9, False: 61]
  ------------------
  937|      9|                opj_event_msg(p_manager, EVT_ERROR, "Incomplete channel definitions.\n");
  ------------------
  |  |   66|      9|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  938|      9|                return OPJ_FALSE;
  ------------------
  |  |  118|      9|#define OPJ_FALSE 0
  ------------------
  939|      9|            }
  940|     61|            --nr_channels;
  941|     61|        }
  942|     27|    }
  943|       |
  944|       |    /* testcases 451.pdf.SIGSEGV.f4c.3723, 451.pdf.SIGSEGV.5b5.3723 and
  945|       |       66ea31acbb0f23a2bbc91f64d69a03f5_signal_sigsegv_13937c0_7030_5725.pdf */
  946|  4.42k|    if (color->jp2_pclr && color->jp2_pclr->cmap) {
  ------------------
  |  Branch (946:9): [True: 162, False: 4.25k]
  |  Branch (946:28): [True: 160, False: 2]
  ------------------
  947|    160|        OPJ_UINT16 nr_channels = color->jp2_pclr->nr_channels;
  948|    160|        opj_jp2_cmap_comp_t *cmap = color->jp2_pclr->cmap;
  949|    160|        OPJ_BOOL *pcol_usage, is_sane = OPJ_TRUE;
  ------------------
  |  |  117|    160|#define OPJ_TRUE 1
  ------------------
  950|       |
  951|       |        /* verify that all original components match an existing one */
  952|    630|        for (i = 0; i < nr_channels; i++) {
  ------------------
  |  Branch (952:21): [True: 470, False: 160]
  ------------------
  953|    470|            if (cmap[i].cmp >= image->numcomps) {
  ------------------
  |  Branch (953:17): [True: 162, False: 308]
  ------------------
  954|    162|                opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n",
  ------------------
  |  |   66|    162|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  955|    162|                              cmap[i].cmp, image->numcomps);
  956|    162|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|    162|#define OPJ_FALSE 0
  ------------------
  957|    162|            }
  958|    470|        }
  959|       |
  960|    160|        pcol_usage = (OPJ_BOOL *) opj_calloc(nr_channels, sizeof(OPJ_BOOL));
  961|    160|        if (!pcol_usage) {
  ------------------
  |  Branch (961:13): [True: 0, False: 160]
  ------------------
  962|      0|            opj_event_msg(p_manager, EVT_ERROR, "Unexpected OOM.\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  963|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  964|      0|        }
  965|       |        /* verify that no component is targeted more than once */
  966|    630|        for (i = 0; i < nr_channels; i++) {
  ------------------
  |  Branch (966:21): [True: 470, False: 160]
  ------------------
  967|    470|            OPJ_BYTE mtyp = cmap[i].mtyp;
  968|    470|            OPJ_BYTE pcol = cmap[i].pcol;
  969|       |            /* See ISO 15444-1 Table I.14 – MTYPi field values */
  970|    470|            if (mtyp != 0 && mtyp != 1) {
  ------------------
  |  Branch (970:17): [True: 271, False: 199]
  |  Branch (970:30): [True: 77, False: 194]
  ------------------
  971|     77|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     77|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  972|     77|                              "Invalid value for cmap[%d].mtyp = %d.\n", i,
  973|     77|                              mtyp);
  974|     77|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|     77|#define OPJ_FALSE 0
  ------------------
  975|    393|            } else if (pcol >= nr_channels) {
  ------------------
  |  Branch (975:24): [True: 43, False: 350]
  ------------------
  976|     43|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     43|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  977|     43|                              "Invalid component/palette index for direct mapping %d.\n", pcol);
  978|     43|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|     43|#define OPJ_FALSE 0
  ------------------
  979|    350|            } else if (pcol_usage[pcol] && mtyp == 1) {
  ------------------
  |  Branch (979:24): [True: 140, False: 210]
  |  Branch (979:44): [True: 20, False: 120]
  ------------------
  980|     20|                opj_event_msg(p_manager, EVT_ERROR, "Component %d is mapped twice.\n", pcol);
  ------------------
  |  |   66|     20|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  981|     20|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|     20|#define OPJ_FALSE 0
  ------------------
  982|    330|            } else if (mtyp == 0 && pcol != 0) {
  ------------------
  |  Branch (982:24): [True: 169, False: 161]
  |  Branch (982:37): [True: 11, False: 158]
  ------------------
  983|       |                /* I.5.3.5 PCOL: If the value of the MTYP field for this channel is 0, then
  984|       |                 * the value of this field shall be 0. */
  985|     11|                opj_event_msg(p_manager, EVT_ERROR, "Direct use at #%d however pcol=%d.\n", i,
  ------------------
  |  |   66|     11|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  986|     11|                              pcol);
  987|     11|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|     11|#define OPJ_FALSE 0
  ------------------
  988|    319|            } else if (mtyp == 1 && pcol != i) {
  ------------------
  |  Branch (988:24): [True: 161, False: 158]
  |  Branch (988:37): [True: 26, False: 135]
  ------------------
  989|       |                /* OpenJPEG implementation limitation. See assert(i == pcol); */
  990|       |                /* in opj_jp2_apply_pclr() */
  991|     26|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     26|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  992|     26|                              "Implementation limitation: for palette mapping, "
  993|     26|                              "pcol[%d] should be equal to %d, but is equal "
  994|     26|                              "to %d.\n", i, i, pcol);
  995|     26|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|     26|#define OPJ_FALSE 0
  ------------------
  996|    293|            } else {
  997|    293|                pcol_usage[pcol] = OPJ_TRUE;
  ------------------
  |  |  117|    293|#define OPJ_TRUE 1
  ------------------
  998|    293|            }
  999|    470|        }
 1000|       |        /* verify that all components are targeted at least once */
 1001|    630|        for (i = 0; i < nr_channels; i++) {
  ------------------
  |  Branch (1001:21): [True: 470, False: 160]
  ------------------
 1002|    470|            if (!pcol_usage[i] && cmap[i].mtyp != 0) {
  ------------------
  |  Branch (1002:17): [True: 297, False: 173]
  |  Branch (1002:35): [True: 127, False: 170]
  ------------------
 1003|    127|                opj_event_msg(p_manager, EVT_ERROR, "Component %d doesn't have a mapping.\n",
  ------------------
  |  |   66|    127|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1004|    127|                              i);
 1005|    127|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|    127|#define OPJ_FALSE 0
  ------------------
 1006|    127|            }
 1007|    470|        }
 1008|       |        /* Issue 235/447 weird cmap */
 1009|    160|        if (1 && is_sane && (image->numcomps == 1U)) {
  ------------------
  |  Branch (1009:13): [Folded - Ignored]
  |  Branch (1009:18): [True: 125, False: 35]
  |  Branch (1009:29): [True: 12, False: 113]
  ------------------
 1010|     24|            for (i = 0; i < nr_channels; i++) {
  ------------------
  |  Branch (1010:25): [True: 23, False: 1]
  ------------------
 1011|     23|                if (!pcol_usage[i]) {
  ------------------
  |  Branch (1011:21): [True: 11, False: 12]
  ------------------
 1012|     11|                    is_sane = 0U;
 1013|     11|                    opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|     11|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1014|     11|                                  "Component mapping seems wrong. Trying to correct.\n");
 1015|     11|                    break;
 1016|     11|                }
 1017|     23|            }
 1018|     12|            if (!is_sane) {
  ------------------
  |  Branch (1018:17): [True: 11, False: 1]
  ------------------
 1019|     11|                is_sane = OPJ_TRUE;
  ------------------
  |  |  117|     11|#define OPJ_TRUE 1
  ------------------
 1020|     46|                for (i = 0; i < nr_channels; i++) {
  ------------------
  |  Branch (1020:29): [True: 35, False: 11]
  ------------------
 1021|     35|                    cmap[i].mtyp = 1U;
 1022|     35|                    cmap[i].pcol = (OPJ_BYTE) i;
 1023|     35|                }
 1024|     11|            }
 1025|     12|        }
 1026|    160|        opj_free(pcol_usage);
 1027|    160|        if (!is_sane) {
  ------------------
  |  Branch (1027:13): [True: 35, False: 125]
  ------------------
 1028|     35|            return OPJ_FALSE;
  ------------------
  |  |  118|     35|#define OPJ_FALSE 0
  ------------------
 1029|     35|        }
 1030|    160|    }
 1031|       |
 1032|  4.38k|    return OPJ_TRUE;
  ------------------
  |  |  117|  4.38k|#define OPJ_TRUE 1
  ------------------
 1033|  4.42k|}
jp2.c:opj_jp2_free_pclr:
  881|      2|{
  882|      2|    opj_free(color->jp2_pclr->channel_sign);
  883|      2|    opj_free(color->jp2_pclr->channel_size);
  884|      2|    opj_free(color->jp2_pclr->entries);
  885|       |
  886|      2|    if (color->jp2_pclr->cmap) {
  ------------------
  |  Branch (886:9): [True: 0, False: 2]
  ------------------
  887|      0|        opj_free(color->jp2_pclr->cmap);
  888|      0|    }
  889|       |
  890|      2|    opj_free(color->jp2_pclr);
  891|      2|    color->jp2_pclr = NULL;
  892|      2|}
jp2.c:opj_jp2_apply_pclr:
 1039|    125|{
 1040|    125|    opj_image_comp_t *old_comps, *new_comps;
 1041|    125|    OPJ_BYTE *channel_size, *channel_sign;
 1042|    125|    OPJ_UINT32 *entries;
 1043|    125|    opj_jp2_cmap_comp_t *cmap;
 1044|    125|    OPJ_INT32 *src, *dst;
 1045|    125|    OPJ_UINT32 j, max;
 1046|    125|    OPJ_UINT16 i, nr_channels, cmp, pcol;
 1047|    125|    OPJ_INT32 k, top_k;
 1048|       |
 1049|    125|    channel_size = color->jp2_pclr->channel_size;
 1050|    125|    channel_sign = color->jp2_pclr->channel_sign;
 1051|    125|    entries = color->jp2_pclr->entries;
 1052|    125|    cmap = color->jp2_pclr->cmap;
 1053|    125|    nr_channels = color->jp2_pclr->nr_channels;
 1054|       |
 1055|    349|    for (i = 0; i < nr_channels; ++i) {
  ------------------
  |  Branch (1055:17): [True: 224, False: 125]
  ------------------
 1056|       |        /* Palette mapping: */
 1057|    224|        cmp = cmap[i].cmp;
 1058|    224|        if (image->comps[cmp].data == NULL) {
  ------------------
  |  Branch (1058:13): [True: 0, False: 224]
  ------------------
 1059|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1060|      0|                          "image->comps[%d].data == NULL in opj_jp2_apply_pclr().\n", i);
 1061|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1062|      0|        }
 1063|    224|    }
 1064|       |
 1065|    125|    old_comps = image->comps;
 1066|    125|    new_comps = (opj_image_comp_t*)
 1067|    125|                opj_malloc(nr_channels * sizeof(opj_image_comp_t));
 1068|    125|    if (!new_comps) {
  ------------------
  |  Branch (1068:9): [True: 0, False: 125]
  ------------------
 1069|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1070|      0|                      "Memory allocation failure in opj_jp2_apply_pclr().\n");
 1071|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1072|      0|    }
 1073|    349|    for (i = 0; i < nr_channels; ++i) {
  ------------------
  |  Branch (1073:17): [True: 224, False: 125]
  ------------------
 1074|    224|        pcol = cmap[i].pcol;
 1075|    224|        cmp = cmap[i].cmp;
 1076|       |
 1077|       |        /* Direct use */
 1078|    224|        if (cmap[i].mtyp == 0) {
  ------------------
  |  Branch (1078:13): [True: 95, False: 129]
  ------------------
 1079|     95|            assert(pcol == 0);
 1080|     95|            new_comps[i] = old_comps[cmp];
 1081|    129|        } else {
 1082|    129|            assert(i == pcol);
 1083|    129|            new_comps[pcol] = old_comps[cmp];
 1084|    129|        }
 1085|       |
 1086|       |        /* Palette mapping: */
 1087|    224|        new_comps[i].data = (OPJ_INT32*)
 1088|    224|                            opj_image_data_alloc(sizeof(OPJ_INT32) * old_comps[cmp].w * old_comps[cmp].h);
 1089|    224|        if (!new_comps[i].data) {
  ------------------
  |  Branch (1089:13): [True: 0, False: 224]
  ------------------
 1090|      0|            while (i > 0) {
  ------------------
  |  Branch (1090:20): [True: 0, False: 0]
  ------------------
 1091|      0|                -- i;
 1092|      0|                opj_image_data_free(new_comps[i].data);
 1093|      0|            }
 1094|      0|            opj_free(new_comps);
 1095|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1096|      0|                          "Memory allocation failure in opj_jp2_apply_pclr().\n");
 1097|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1098|      0|        }
 1099|    224|        new_comps[i].prec = channel_size[i];
 1100|    224|        new_comps[i].sgnd = channel_sign[i];
 1101|    224|    }
 1102|       |
 1103|    125|    top_k = color->jp2_pclr->nr_entries - 1;
 1104|       |
 1105|    349|    for (i = 0; i < nr_channels; ++i) {
  ------------------
  |  Branch (1105:17): [True: 224, False: 125]
  ------------------
 1106|       |        /* Palette mapping: */
 1107|    224|        cmp = cmap[i].cmp;
 1108|    224|        pcol = cmap[i].pcol;
 1109|    224|        src = old_comps[cmp].data;
 1110|    224|        assert(src); /* verified above */
 1111|    224|        max = new_comps[i].w * new_comps[i].h;
 1112|       |
 1113|       |        /* Direct use: */
 1114|    224|        if (cmap[i].mtyp == 0) {
  ------------------
  |  Branch (1114:13): [True: 95, False: 129]
  ------------------
 1115|     95|            dst = new_comps[i].data;
 1116|     95|            assert(dst);
 1117|  72.7k|            for (j = 0; j < max; ++j) {
  ------------------
  |  Branch (1117:25): [True: 72.6k, False: 95]
  ------------------
 1118|  72.6k|                dst[j] = src[j];
 1119|  72.6k|            }
 1120|    129|        } else {
 1121|    129|            assert(i == pcol);
 1122|    129|            dst = new_comps[pcol].data;
 1123|    129|            assert(dst);
 1124|   866k|            for (j = 0; j < max; ++j) {
  ------------------
  |  Branch (1124:25): [True: 866k, False: 129]
  ------------------
 1125|       |                /* The index */
 1126|   866k|                if ((k = src[j]) < 0) {
  ------------------
  |  Branch (1126:21): [True: 128k, False: 737k]
  ------------------
 1127|   128k|                    k = 0;
 1128|   737k|                } else if (k > top_k) {
  ------------------
  |  Branch (1128:28): [True: 193k, False: 544k]
  ------------------
 1129|   193k|                    k = top_k;
 1130|   193k|                }
 1131|       |
 1132|       |                /* The colour */
 1133|   866k|                dst[j] = (OPJ_INT32)entries[k * nr_channels + pcol];
 1134|   866k|            }
 1135|    129|        }
 1136|    224|    }
 1137|       |
 1138|    125|    max = image->numcomps;
 1139|    480|    for (j = 0; j < max; ++j) {
  ------------------
  |  Branch (1139:17): [True: 355, False: 125]
  ------------------
 1140|    355|        if (old_comps[j].data) {
  ------------------
  |  Branch (1140:13): [True: 355, False: 0]
  ------------------
 1141|    355|            opj_image_data_free(old_comps[j].data);
 1142|    355|        }
 1143|    355|    }
 1144|       |
 1145|    125|    opj_free(old_comps);
 1146|    125|    image->comps = new_comps;
 1147|    125|    image->numcomps = nr_channels;
 1148|       |
 1149|    125|    return OPJ_TRUE;
  ------------------
  |  |  117|    125|#define OPJ_TRUE 1
  ------------------
 1150|    125|}/* apply_pclr() */
jp2.c:opj_jp2_apply_cdef:
 1331|     18|{
 1332|     18|    opj_jp2_cdef_info_t *info;
 1333|     18|    OPJ_UINT16 i, n, cn, asoc, acn;
 1334|       |
 1335|     18|    info = color->jp2_cdef->info;
 1336|     18|    n = color->jp2_cdef->n;
 1337|       |
 1338|     87|    for (i = 0; i < n; ++i) {
  ------------------
  |  Branch (1338:17): [True: 69, False: 18]
  ------------------
 1339|       |        /* WATCH: acn = asoc - 1 ! */
 1340|     69|        asoc = info[i].asoc;
 1341|     69|        cn = info[i].cn;
 1342|       |
 1343|     69|        if (cn >= image->numcomps) {
  ------------------
  |  Branch (1343:13): [True: 0, False: 69]
  ------------------
 1344|      0|            opj_event_msg(manager, EVT_WARNING, "opj_jp2_apply_cdef: cn=%d, numcomps=%d\n",
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1345|      0|                          cn, image->numcomps);
 1346|      0|            continue;
 1347|      0|        }
 1348|     69|        if (asoc == 0 || asoc == 65535) {
  ------------------
  |  Branch (1348:13): [True: 22, False: 47]
  |  Branch (1348:26): [True: 3, False: 44]
  ------------------
 1349|     25|            image->comps[cn].alpha = info[i].typ;
 1350|     25|            continue;
 1351|     25|        }
 1352|       |
 1353|     44|        acn = (OPJ_UINT16)(asoc - 1);
 1354|     44|        if (acn >= image->numcomps) {
  ------------------
  |  Branch (1354:13): [True: 0, False: 44]
  ------------------
 1355|      0|            opj_event_msg(manager, EVT_WARNING, "opj_jp2_apply_cdef: acn=%d, numcomps=%d\n",
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1356|      0|                          acn, image->numcomps);
 1357|      0|            continue;
 1358|      0|        }
 1359|       |
 1360|       |        /* Swap only if color channel */
 1361|     44|        if ((cn != acn) && (info[i].typ == 0)) {
  ------------------
  |  Branch (1361:13): [True: 28, False: 16]
  |  Branch (1361:28): [True: 16, False: 12]
  ------------------
 1362|     16|            opj_image_comp_t saved;
 1363|     16|            OPJ_UINT16 j;
 1364|       |
 1365|     16|            memcpy(&saved, &image->comps[cn], sizeof(opj_image_comp_t));
 1366|     16|            memcpy(&image->comps[cn], &image->comps[acn], sizeof(opj_image_comp_t));
 1367|     16|            memcpy(&image->comps[acn], &saved, sizeof(opj_image_comp_t));
 1368|       |
 1369|       |            /* Swap channels in following channel definitions, don't bother with j <= i that are already processed */
 1370|     50|            for (j = (OPJ_UINT16)(i + 1U); j < n ; ++j) {
  ------------------
  |  Branch (1370:44): [True: 34, False: 16]
  ------------------
 1371|     34|                if (info[j].cn == cn) {
  ------------------
  |  Branch (1371:21): [True: 6, False: 28]
  ------------------
 1372|      6|                    info[j].cn = acn;
 1373|     28|                } else if (info[j].cn == acn) {
  ------------------
  |  Branch (1373:28): [True: 12, False: 16]
  ------------------
 1374|     12|                    info[j].cn = cn;
 1375|     12|                }
 1376|       |                /* asoc is related to color index. Do not update. */
 1377|     34|            }
 1378|     16|        }
 1379|       |
 1380|     44|        image->comps[cn].alpha = info[i].typ;
 1381|     44|    }
 1382|       |
 1383|     18|    if (color->jp2_cdef->info) {
  ------------------
  |  Branch (1383:9): [True: 18, False: 0]
  ------------------
 1384|     18|        opj_free(color->jp2_cdef->info);
 1385|     18|    }
 1386|       |
 1387|     18|    opj_free(color->jp2_cdef);
 1388|     18|    color->jp2_cdef = NULL;
 1389|       |
 1390|     18|}/* jp2_apply_cdef() */
jp2.c:opj_jp2_setup_end_header_reading:
 2181|  6.88k|{
 2182|       |    /* preconditions */
 2183|  6.88k|    assert(jp2 != 00);
 2184|  6.88k|    assert(p_manager != 00);
 2185|       |
 2186|  6.88k|    if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,
  ------------------
  |  Branch (2186:9): [True: 0, False: 6.88k]
  ------------------
 2187|  6.88k|                                           (opj_procedure)opj_jp2_read_header_procedure, p_manager)) {
 2188|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2189|      0|    }
 2190|       |    /* DEVELOPER CORNER, add your custom procedures */
 2191|       |
 2192|  6.88k|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.88k|#define OPJ_TRUE 1
  ------------------
 2193|  6.88k|}
jp2.c:opj_jp2_read_header_procedure:
 2256|  16.1k|{
 2257|  16.1k|    opj_jp2_box_t box;
 2258|  16.1k|    OPJ_UINT32 l_nb_bytes_read;
 2259|  16.1k|    const opj_jp2_header_handler_t * l_current_handler;
 2260|  16.1k|    const opj_jp2_header_handler_t * l_current_handler_misplaced;
 2261|  16.1k|    OPJ_UINT32 l_last_data_size = OPJ_BOX_SIZE;
  ------------------
  |  |   45|  16.1k|#define OPJ_BOX_SIZE    1024
  ------------------
 2262|  16.1k|    OPJ_UINT32 l_current_data_size;
 2263|  16.1k|    OPJ_BYTE * l_current_data = 00;
 2264|       |
 2265|       |    /* preconditions */
 2266|  16.1k|    assert(stream != 00);
 2267|  16.1k|    assert(jp2 != 00);
 2268|  16.1k|    assert(p_manager != 00);
 2269|       |
 2270|  16.1k|    l_current_data = (OPJ_BYTE*)opj_calloc(1, l_last_data_size);
 2271|       |
 2272|  16.1k|    if (l_current_data == 00) {
  ------------------
  |  Branch (2272:9): [True: 0, False: 16.1k]
  ------------------
 2273|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2274|      0|                      "Not enough memory to handle jpeg2000 file header\n");
 2275|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2276|      0|    }
 2277|       |
 2278|  48.9k|    while (opj_jp2_read_boxhdr(&box, &l_nb_bytes_read, stream, p_manager)) {
  ------------------
  |  Branch (2278:12): [True: 41.3k, False: 7.52k]
  ------------------
 2279|       |        /* is it the codestream box ? */
 2280|  41.3k|        if (box.type == JP2_JP2C) {
  ------------------
  |  |   54|  41.3k|#define     JP2_JP2C 0x6a703263    /**< Contiguous codestream box */
  ------------------
  |  Branch (2280:13): [True: 7.30k, False: 34.0k]
  ------------------
 2281|  7.30k|            if (jp2->jp2_state & JP2_STATE_HEADER) {
  ------------------
  |  Branch (2281:17): [True: 7.30k, False: 1]
  ------------------
 2282|  7.30k|                jp2->jp2_state |= JP2_STATE_CODESTREAM;
 2283|  7.30k|                opj_free(l_current_data);
 2284|  7.30k|                return OPJ_TRUE;
  ------------------
  |  |  117|  7.30k|#define OPJ_TRUE 1
  ------------------
 2285|  7.30k|            } else {
 2286|      1|                opj_event_msg(p_manager, EVT_ERROR, "bad placed jpeg codestream\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2287|      1|                opj_free(l_current_data);
 2288|      1|                return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 2289|      1|            }
 2290|  34.0k|        } else if (box.length == 0) {
  ------------------
  |  Branch (2290:20): [True: 2, False: 34.0k]
  ------------------
 2291|      2|            opj_event_msg(p_manager, EVT_ERROR, "Cannot handle box of undefined sizes\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2292|      2|            opj_free(l_current_data);
 2293|      2|            return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 2294|      2|        }
 2295|       |        /* testcase 1851.pdf.SIGSEGV.ce9.948 */
 2296|  34.0k|        else if (box.length < l_nb_bytes_read) {
  ------------------
  |  Branch (2296:18): [True: 3, False: 34.0k]
  ------------------
 2297|      3|            opj_event_msg(p_manager, EVT_ERROR, "invalid box size %d (%x)\n", box.length,
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2298|      3|                          box.type);
 2299|      3|            opj_free(l_current_data);
 2300|      3|            return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 2301|      3|        }
 2302|       |
 2303|  34.0k|        l_current_handler = opj_jp2_find_handler(box.type);
 2304|  34.0k|        l_current_handler_misplaced = opj_jp2_img_find_handler(box.type);
 2305|  34.0k|        l_current_data_size = box.length - l_nb_bytes_read;
 2306|       |
 2307|  34.0k|        if ((l_current_handler != 00) || (l_current_handler_misplaced != 00)) {
  ------------------
  |  Branch (2307:13): [True: 25.0k, False: 9.06k]
  |  Branch (2307:42): [True: 5.11k, False: 3.94k]
  ------------------
 2308|  30.1k|            if (l_current_handler == 00) {
  ------------------
  |  Branch (2308:17): [True: 5.11k, False: 25.0k]
  ------------------
 2309|  5.11k|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  5.11k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2310|  5.11k|                              "Found a misplaced '%c%c%c%c' box outside jp2h box\n",
 2311|  5.11k|                              (OPJ_BYTE)(box.type >> 24), (OPJ_BYTE)(box.type >> 16),
 2312|  5.11k|                              (OPJ_BYTE)(box.type >> 8), (OPJ_BYTE)(box.type >> 0));
 2313|  5.11k|                if (jp2->jp2_state & JP2_STATE_HEADER) {
  ------------------
  |  Branch (2313:21): [True: 3.25k, False: 1.86k]
  ------------------
 2314|       |                    /* read anyway, we already have jp2h */
 2315|  3.25k|                    l_current_handler = l_current_handler_misplaced;
 2316|  3.25k|                } else {
 2317|  1.86k|                    opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  1.86k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2318|  1.86k|                                  "JPEG2000 Header box not read yet, '%c%c%c%c' box will be ignored\n",
 2319|  1.86k|                                  (OPJ_BYTE)(box.type >> 24), (OPJ_BYTE)(box.type >> 16),
 2320|  1.86k|                                  (OPJ_BYTE)(box.type >> 8), (OPJ_BYTE)(box.type >> 0));
 2321|  1.86k|                    jp2->jp2_state |= JP2_STATE_UNKNOWN;
 2322|  1.86k|                    if (opj_stream_skip(stream, l_current_data_size,
  ------------------
  |  Branch (2322:25): [True: 37, False: 1.82k]
  ------------------
 2323|  1.86k|                                        p_manager) != l_current_data_size) {
 2324|     37|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     37|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2325|     37|                                      "Problem with skipping JPEG2000 box, stream error\n");
 2326|     37|                        opj_free(l_current_data);
 2327|     37|                        return OPJ_FALSE;
  ------------------
  |  |  118|     37|#define OPJ_FALSE 0
  ------------------
 2328|     37|                    }
 2329|  1.82k|                    continue;
 2330|  1.86k|                }
 2331|  5.11k|            }
 2332|  28.2k|            if ((OPJ_OFF_T)l_current_data_size > opj_stream_get_number_byte_left(stream)) {
  ------------------
  |  Branch (2332:17): [True: 66, False: 28.1k]
  ------------------
 2333|       |                /* do not even try to malloc if we can't read */
 2334|     66|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     66|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2335|     66|                              "Invalid box size %d for box '%c%c%c%c'. Need %d bytes, %d bytes remaining \n",
 2336|     66|                              box.length, (OPJ_BYTE)(box.type >> 24), (OPJ_BYTE)(box.type >> 16),
 2337|     66|                              (OPJ_BYTE)(box.type >> 8), (OPJ_BYTE)(box.type >> 0), l_current_data_size,
 2338|     66|                              (OPJ_UINT32)opj_stream_get_number_byte_left(stream));
 2339|     66|                opj_free(l_current_data);
 2340|     66|                return OPJ_FALSE;
  ------------------
  |  |  118|     66|#define OPJ_FALSE 0
  ------------------
 2341|     66|            }
 2342|  28.1k|            if (l_current_data_size > l_last_data_size) {
  ------------------
  |  Branch (2342:17): [True: 51, False: 28.1k]
  ------------------
 2343|     51|                OPJ_BYTE* new_current_data = (OPJ_BYTE*)opj_realloc(l_current_data,
 2344|     51|                                             l_current_data_size);
 2345|     51|                if (!new_current_data) {
  ------------------
  |  Branch (2345:21): [True: 0, False: 51]
  ------------------
 2346|      0|                    opj_free(l_current_data);
 2347|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2348|      0|                                  "Not enough memory to handle jpeg2000 box\n");
 2349|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2350|      0|                }
 2351|     51|                l_current_data = new_current_data;
 2352|     51|                l_last_data_size = l_current_data_size;
 2353|     51|            }
 2354|       |
 2355|  28.1k|            l_nb_bytes_read = (OPJ_UINT32)opj_stream_read_data(stream, l_current_data,
 2356|  28.1k|                              l_current_data_size, p_manager);
 2357|  28.1k|            if (l_nb_bytes_read != l_current_data_size) {
  ------------------
  |  Branch (2357:17): [True: 0, False: 28.1k]
  ------------------
 2358|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2359|      0|                              "Problem with reading JPEG2000 box, stream error\n");
 2360|      0|                opj_free(l_current_data);
 2361|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2362|      0|            }
 2363|       |
 2364|  28.1k|            if (! l_current_handler->handler(jp2, l_current_data, l_current_data_size,
  ------------------
  |  Branch (2364:17): [True: 608, False: 27.5k]
  ------------------
 2365|  28.1k|                                             p_manager)) {
 2366|    608|                opj_free(l_current_data);
 2367|    608|                return OPJ_FALSE;
  ------------------
  |  |  118|    608|#define OPJ_FALSE 0
  ------------------
 2368|    608|            }
 2369|  28.1k|        } else {
 2370|  3.94k|            if (!(jp2->jp2_state & JP2_STATE_SIGNATURE)) {
  ------------------
  |  Branch (2370:17): [True: 0, False: 3.94k]
  ------------------
 2371|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2372|      0|                              "Malformed JP2 file format: first box must be JPEG 2000 signature box\n");
 2373|      0|                opj_free(l_current_data);
 2374|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2375|      0|            }
 2376|  3.94k|            if (!(jp2->jp2_state & JP2_STATE_FILE_TYPE)) {
  ------------------
  |  Branch (2376:17): [True: 201, False: 3.74k]
  ------------------
 2377|    201|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    201|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2378|    201|                              "Malformed JP2 file format: second box must be file type box\n");
 2379|    201|                opj_free(l_current_data);
 2380|    201|                return OPJ_FALSE;
  ------------------
  |  |  118|    201|#define OPJ_FALSE 0
  ------------------
 2381|    201|            }
 2382|  3.74k|            jp2->jp2_state |= JP2_STATE_UNKNOWN;
 2383|  3.74k|            if (opj_stream_skip(stream, l_current_data_size,
  ------------------
  |  Branch (2383:17): [True: 359, False: 3.38k]
  ------------------
 2384|  3.74k|                                p_manager) != l_current_data_size) {
 2385|    359|                if (jp2->jp2_state & JP2_STATE_CODESTREAM) {
  ------------------
  |  Branch (2385:21): [True: 359, False: 0]
  ------------------
 2386|       |                    /* If we already read the codestream, do not error out */
 2387|       |                    /* Needed for data/input/nonregression/issue254.jp2 */
 2388|    359|                    opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    359|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2389|    359|                                  "Problem with skipping JPEG2000 box, stream error\n");
 2390|    359|                    opj_free(l_current_data);
 2391|    359|                    return OPJ_TRUE;
  ------------------
  |  |  117|    359|#define OPJ_TRUE 1
  ------------------
 2392|    359|                } else {
 2393|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2394|      0|                                  "Problem with skipping JPEG2000 box, stream error\n");
 2395|      0|                    opj_free(l_current_data);
 2396|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2397|      0|                }
 2398|    359|            }
 2399|  3.74k|        }
 2400|  34.0k|    }
 2401|       |
 2402|  7.52k|    opj_free(l_current_data);
 2403|       |
 2404|  7.52k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.52k|#define OPJ_TRUE 1
  ------------------
 2405|  16.1k|}
jp2.c:opj_jp2_read_boxhdr:
  477|  48.9k|{
  478|       |    /* read header from file */
  479|  48.9k|    OPJ_BYTE l_data_header [8];
  480|       |
  481|       |    /* preconditions */
  482|  48.9k|    assert(cio != 00);
  483|  48.9k|    assert(box != 00);
  484|  48.9k|    assert(p_number_bytes_read != 00);
  485|  48.9k|    assert(p_manager != 00);
  486|       |
  487|  48.9k|    *p_number_bytes_read = (OPJ_UINT32)opj_stream_read_data(cio, l_data_header, 8,
  488|  48.9k|                           p_manager);
  489|  48.9k|    if (*p_number_bytes_read != 8) {
  ------------------
  |  Branch (489:9): [True: 6.78k, False: 42.1k]
  ------------------
  490|  6.78k|        return OPJ_FALSE;
  ------------------
  |  |  118|  6.78k|#define OPJ_FALSE 0
  ------------------
  491|  6.78k|    }
  492|       |
  493|       |    /* process read data */
  494|  42.1k|    opj_read_bytes(l_data_header, &(box->length), 4);
  ------------------
  |  |   65|  42.1k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  495|  42.1k|    opj_read_bytes(l_data_header + 4, &(box->type), 4);
  ------------------
  |  |   65|  42.1k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  496|       |
  497|  42.1k|    if (box->length == 0) { /* last box */
  ------------------
  |  Branch (497:9): [True: 1.56k, False: 40.5k]
  ------------------
  498|  1.56k|        const OPJ_OFF_T bleft = opj_stream_get_number_byte_left(cio);
  499|  1.56k|        if (bleft > (OPJ_OFF_T)(0xFFFFFFFFU - 8U)) {
  ------------------
  |  Branch (499:13): [True: 0, False: 1.56k]
  ------------------
  500|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  501|      0|                          "Cannot handle box sizes higher than 2^32\n");
  502|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  503|      0|        }
  504|  1.56k|        box->length = (OPJ_UINT32)bleft + 8U;
  505|  1.56k|        assert((OPJ_OFF_T)box->length == bleft + 8);
  506|  1.56k|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.56k|#define OPJ_TRUE 1
  ------------------
  507|  1.56k|    }
  508|       |
  509|       |    /* do we have a "special very large box ?" */
  510|       |    /* read then the XLBox */
  511|  40.5k|    if (box->length == 1) {
  ------------------
  |  Branch (511:9): [True: 841, False: 39.7k]
  ------------------
  512|    841|        OPJ_UINT32 l_xl_part_size;
  513|       |
  514|    841|        OPJ_UINT32 l_nb_bytes_read = (OPJ_UINT32)opj_stream_read_data(cio,
  515|    841|                                     l_data_header, 8, p_manager);
  516|    841|        if (l_nb_bytes_read != 8) {
  ------------------
  |  Branch (516:13): [True: 6, False: 835]
  ------------------
  517|      6|            if (l_nb_bytes_read > 0) {
  ------------------
  |  Branch (517:17): [True: 6, False: 0]
  ------------------
  518|      6|                *p_number_bytes_read += l_nb_bytes_read;
  519|      6|            }
  520|       |
  521|      6|            return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
  522|      6|        }
  523|       |
  524|    835|        *p_number_bytes_read = 16;
  525|    835|        opj_read_bytes(l_data_header, &l_xl_part_size, 4);
  ------------------
  |  |   65|    835|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  526|    835|        if (l_xl_part_size != 0) {
  ------------------
  |  Branch (526:13): [True: 732, False: 103]
  ------------------
  527|    732|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    732|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  528|    732|                          "Cannot handle box sizes higher than 2^32\n");
  529|    732|            return OPJ_FALSE;
  ------------------
  |  |  118|    732|#define OPJ_FALSE 0
  ------------------
  530|    732|        }
  531|    103|        opj_read_bytes(l_data_header + 4, &(box->length), 4);
  ------------------
  |  |   65|    103|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  532|    103|    }
  533|  39.8k|    return OPJ_TRUE;
  ------------------
  |  |  117|  39.8k|#define OPJ_TRUE 1
  ------------------
  534|  40.5k|}
jp2.c:opj_jp2_find_handler:
 2484|  34.0k|{
 2485|  34.0k|    OPJ_UINT32 i, l_handler_size = sizeof(jp2_header) / sizeof(
 2486|  34.0k|                                       opj_jp2_header_handler_t);
 2487|       |
 2488|  85.8k|    for (i = 0; i < l_handler_size; ++i) {
  ------------------
  |  Branch (2488:17): [True: 76.7k, False: 9.06k]
  ------------------
 2489|  76.7k|        if (jp2_header[i].id == p_id) {
  ------------------
  |  Branch (2489:13): [True: 25.0k, False: 51.7k]
  ------------------
 2490|  25.0k|            return &jp2_header[i];
 2491|  25.0k|        }
 2492|  76.7k|    }
 2493|  9.06k|    return NULL;
 2494|  34.0k|}
jp2.c:opj_jp2_read_jp:
 2533|  9.15k|{
 2534|  9.15k|    OPJ_UINT32 l_magic_number;
 2535|       |
 2536|       |    /* preconditions */
 2537|  9.15k|    assert(p_header_data != 00);
 2538|  9.15k|    assert(jp2 != 00);
 2539|  9.15k|    assert(p_manager != 00);
 2540|       |
 2541|  9.15k|    if (jp2->jp2_state != JP2_STATE_NONE) {
  ------------------
  |  Branch (2541:9): [True: 4, False: 9.14k]
  ------------------
 2542|      4|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      4|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2543|      4|                      "The signature box must be the first box in the file.\n");
 2544|      4|        return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
 2545|      4|    }
 2546|       |
 2547|       |    /* assure length of data is correct (4 -> magic number) */
 2548|  9.14k|    if (p_header_size != 4) {
  ------------------
  |  Branch (2548:9): [True: 23, False: 9.12k]
  ------------------
 2549|     23|        opj_event_msg(p_manager, EVT_ERROR, "Error with JP signature Box size\n");
  ------------------
  |  |   66|     23|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2550|     23|        return OPJ_FALSE;
  ------------------
  |  |  118|     23|#define OPJ_FALSE 0
  ------------------
 2551|     23|    }
 2552|       |
 2553|       |    /* rearrange data */
 2554|  9.12k|    opj_read_bytes(p_header_data, &l_magic_number, 4);
  ------------------
  |  |   65|  9.12k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2555|  9.12k|    if (l_magic_number != 0x0d0a870a) {
  ------------------
  |  Branch (2555:9): [True: 43, False: 9.08k]
  ------------------
 2556|     43|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     43|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2557|     43|                      "Error with JP Signature : bad magic number\n");
 2558|     43|        return OPJ_FALSE;
  ------------------
  |  |  118|     43|#define OPJ_FALSE 0
  ------------------
 2559|     43|    }
 2560|       |
 2561|  9.08k|    jp2->jp2_state |= JP2_STATE_SIGNATURE;
 2562|       |
 2563|  9.08k|    return OPJ_TRUE;
  ------------------
  |  |  117|  9.08k|#define OPJ_TRUE 1
  ------------------
 2564|  9.12k|}
jp2.c:opj_jp2_read_ftyp:
 2581|  7.04k|{
 2582|  7.04k|    OPJ_UINT32 i, l_remaining_bytes;
 2583|       |
 2584|       |    /* preconditions */
 2585|  7.04k|    assert(p_header_data != 00);
 2586|  7.04k|    assert(jp2 != 00);
 2587|  7.04k|    assert(p_manager != 00);
 2588|       |
 2589|  7.04k|    if (jp2->jp2_state != JP2_STATE_SIGNATURE) {
  ------------------
  |  Branch (2589:9): [True: 4, False: 7.03k]
  ------------------
 2590|      4|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      4|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2591|      4|                      "The ftyp box must be the second box in the file.\n");
 2592|      4|        return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
 2593|      4|    }
 2594|       |
 2595|       |    /* assure length of data is correct */
 2596|  7.03k|    if (p_header_size < 8) {
  ------------------
  |  Branch (2596:9): [True: 3, False: 7.03k]
  ------------------
 2597|      3|        opj_event_msg(p_manager, EVT_ERROR, "Error with FTYP signature Box size\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2598|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 2599|      3|    }
 2600|       |
 2601|  7.03k|    opj_read_bytes(p_header_data, &jp2->brand, 4);      /* BR */
  ------------------
  |  |   65|  7.03k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2602|  7.03k|    p_header_data += 4;
 2603|       |
 2604|  7.03k|    opj_read_bytes(p_header_data, &jp2->minversion, 4);     /* MinV */
  ------------------
  |  |   65|  7.03k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2605|  7.03k|    p_header_data += 4;
 2606|       |
 2607|  7.03k|    l_remaining_bytes = p_header_size - 8;
 2608|       |
 2609|       |    /* the number of remaining bytes should be a multiple of 4 */
 2610|  7.03k|    if ((l_remaining_bytes & 0x3) != 0) {
  ------------------
  |  Branch (2610:9): [True: 10, False: 7.02k]
  ------------------
 2611|     10|        opj_event_msg(p_manager, EVT_ERROR, "Error with FTYP signature Box size\n");
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2612|     10|        return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
 2613|     10|    }
 2614|       |
 2615|       |    /* div by 4 */
 2616|  7.02k|    jp2->numcl = l_remaining_bytes >> 2;
 2617|  7.02k|    if (jp2->numcl) {
  ------------------
  |  Branch (2617:9): [True: 7.01k, False: 4]
  ------------------
 2618|  7.01k|        jp2->cl = (OPJ_UINT32 *) opj_calloc(jp2->numcl, sizeof(OPJ_UINT32));
 2619|  7.01k|        if (jp2->cl == 00) {
  ------------------
  |  Branch (2619:13): [True: 0, False: 7.01k]
  ------------------
 2620|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory with FTYP Box\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2621|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2622|      0|        }
 2623|  7.01k|    }
 2624|       |
 2625|   452k|    for (i = 0; i < jp2->numcl; ++i) {
  ------------------
  |  Branch (2625:17): [True: 445k, False: 7.02k]
  ------------------
 2626|   445k|        opj_read_bytes(p_header_data, &jp2->cl[i], 4);      /* CLi */
  ------------------
  |  |   65|   445k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2627|   445k|        p_header_data += 4;
 2628|   445k|    }
 2629|       |
 2630|  7.02k|    jp2->jp2_state |= JP2_STATE_FILE_TYPE;
 2631|       |
 2632|  7.02k|    return OPJ_TRUE;
  ------------------
  |  |  117|  7.02k|#define OPJ_TRUE 1
  ------------------
 2633|  7.02k|}
jp2.c:opj_jp2_read_jp2h:
 2686|  8.75k|{
 2687|  8.75k|    OPJ_UINT32 l_box_size = 0, l_current_data_size = 0;
 2688|  8.75k|    opj_jp2_box_t box;
 2689|  8.75k|    const opj_jp2_header_handler_t * l_current_handler;
 2690|  8.75k|    OPJ_BOOL l_has_ihdr = 0;
 2691|       |
 2692|       |    /* preconditions */
 2693|  8.75k|    assert(p_header_data != 00);
 2694|  8.75k|    assert(jp2 != 00);
 2695|  8.75k|    assert(p_manager != 00);
 2696|       |
 2697|       |    /* make sure the box is well placed */
 2698|  8.75k|    if ((jp2->jp2_state & JP2_STATE_FILE_TYPE) != JP2_STATE_FILE_TYPE) {
  ------------------
  |  Branch (2698:9): [True: 1, False: 8.75k]
  ------------------
 2699|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2700|      1|                      "The  box must be the first box in the file.\n");
 2701|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 2702|      1|    }
 2703|       |
 2704|  8.75k|    jp2->jp2_img_state = JP2_IMG_STATE_NONE;
 2705|       |
 2706|       |    /* iterate while remaining data */
 2707|  30.0k|    while (p_header_size > 0) {
  ------------------
  |  Branch (2707:12): [True: 21.6k, False: 8.46k]
  ------------------
 2708|       |
 2709|  21.6k|        if (! opj_jp2_read_boxhdr_char(&box, p_header_data, &l_box_size, p_header_size,
  ------------------
  |  Branch (2709:13): [True: 100, False: 21.5k]
  ------------------
 2710|  21.6k|                                       p_manager)) {
 2711|    100|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    100|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2712|    100|                          "Stream error while reading JP2 Header box\n");
 2713|    100|            return OPJ_FALSE;
  ------------------
  |  |  118|    100|#define OPJ_FALSE 0
  ------------------
 2714|    100|        }
 2715|       |
 2716|  21.5k|        if (box.length > p_header_size) {
  ------------------
  |  Branch (2716:13): [True: 171, False: 21.3k]
  ------------------
 2717|    171|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    171|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2718|    171|                          "Stream error while reading JP2 Header box: box length is inconsistent.\n");
 2719|    171|            return OPJ_FALSE;
  ------------------
  |  |  118|    171|#define OPJ_FALSE 0
  ------------------
 2720|    171|        }
 2721|       |
 2722|  21.3k|        l_current_handler = opj_jp2_img_find_handler(box.type);
 2723|  21.3k|        l_current_data_size = box.length - l_box_size;
 2724|  21.3k|        p_header_data += l_box_size;
 2725|       |
 2726|  21.3k|        if (l_current_handler != 00) {
  ------------------
  |  Branch (2726:13): [True: 11.6k, False: 9.68k]
  ------------------
 2727|  11.6k|            if (! l_current_handler->handler(jp2, p_header_data, l_current_data_size,
  ------------------
  |  Branch (2727:17): [True: 24, False: 11.6k]
  ------------------
 2728|  11.6k|                                             p_manager)) {
 2729|     24|                return OPJ_FALSE;
  ------------------
  |  |  118|     24|#define OPJ_FALSE 0
  ------------------
 2730|     24|            }
 2731|  11.6k|        } else {
 2732|  9.68k|            jp2->jp2_img_state |= JP2_IMG_STATE_UNKNOWN;
 2733|  9.68k|        }
 2734|       |
 2735|  21.3k|        if (box.type == JP2_IHDR) {
  ------------------
  |  |   52|  21.3k|#define     JP2_IHDR 0x69686472    /**< Image header box */
  ------------------
  |  Branch (2735:13): [True: 9.14k, False: 12.1k]
  ------------------
 2736|  9.14k|            l_has_ihdr = 1;
 2737|  9.14k|        }
 2738|       |
 2739|  21.3k|        p_header_data += l_current_data_size;
 2740|  21.3k|        p_header_size -= box.length;
 2741|  21.3k|    }
 2742|       |
 2743|  8.46k|    if (l_has_ihdr == 0) {
  ------------------
  |  Branch (2743:9): [True: 64, False: 8.39k]
  ------------------
 2744|     64|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     64|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2745|     64|                      "Stream error while reading JP2 Header box: no 'ihdr' box.\n");
 2746|     64|        return OPJ_FALSE;
  ------------------
  |  |  118|     64|#define OPJ_FALSE 0
  ------------------
 2747|     64|    }
 2748|       |
 2749|  8.39k|    jp2->jp2_state |= JP2_STATE_HEADER;
 2750|  8.39k|    jp2->has_jp2h = 1;
 2751|       |
 2752|  8.39k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.39k|#define OPJ_TRUE 1
  ------------------
 2753|  8.46k|}
jp2.c:opj_jp2_read_boxhdr_char:
 2761|  21.6k|{
 2762|  21.6k|    OPJ_UINT32 l_value;
 2763|       |
 2764|       |    /* preconditions */
 2765|  21.6k|    assert(p_data != 00);
 2766|  21.6k|    assert(box != 00);
 2767|  21.6k|    assert(p_number_bytes_read != 00);
 2768|  21.6k|    assert(p_manager != 00);
 2769|       |
 2770|  21.6k|    if (p_box_max_size < 8) {
  ------------------
  |  Branch (2770:9): [True: 37, False: 21.5k]
  ------------------
 2771|     37|        opj_event_msg(p_manager, EVT_ERROR, "Cannot handle box of less than 8 bytes\n");
  ------------------
  |  |   66|     37|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2772|     37|        return OPJ_FALSE;
  ------------------
  |  |  118|     37|#define OPJ_FALSE 0
  ------------------
 2773|     37|    }
 2774|       |
 2775|       |    /* process read data */
 2776|  21.5k|    opj_read_bytes(p_data, &l_value, 4);
  ------------------
  |  |   65|  21.5k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2777|  21.5k|    p_data += 4;
 2778|  21.5k|    box->length = (OPJ_UINT32)(l_value);
 2779|       |
 2780|  21.5k|    opj_read_bytes(p_data, &l_value, 4);
  ------------------
  |  |   65|  21.5k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2781|  21.5k|    p_data += 4;
 2782|  21.5k|    box->type = (OPJ_UINT32)(l_value);
 2783|       |
 2784|  21.5k|    *p_number_bytes_read = 8;
 2785|       |
 2786|       |    /* do we have a "special very large box ?" */
 2787|       |    /* read then the XLBox */
 2788|  21.5k|    if (box->length == 1) {
  ------------------
  |  Branch (2788:9): [True: 217, False: 21.3k]
  ------------------
 2789|    217|        OPJ_UINT32 l_xl_part_size;
 2790|       |
 2791|    217|        if (p_box_max_size < 16) {
  ------------------
  |  Branch (2791:13): [True: 5, False: 212]
  ------------------
 2792|      5|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2793|      5|                          "Cannot handle XL box of less than 16 bytes\n");
 2794|      5|            return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 2795|      5|        }
 2796|       |
 2797|    212|        opj_read_bytes(p_data, &l_xl_part_size, 4);
  ------------------
  |  |   65|    212|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2798|    212|        p_data += 4;
 2799|    212|        *p_number_bytes_read += 4;
 2800|       |
 2801|    212|        if (l_xl_part_size != 0) {
  ------------------
  |  Branch (2801:13): [True: 46, False: 166]
  ------------------
 2802|     46|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     46|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2803|     46|                          "Cannot handle box sizes higher than 2^32\n");
 2804|     46|            return OPJ_FALSE;
  ------------------
  |  |  118|     46|#define OPJ_FALSE 0
  ------------------
 2805|     46|        }
 2806|       |
 2807|    166|        opj_read_bytes(p_data, &l_value, 4);
  ------------------
  |  |   65|    166|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2808|    166|        *p_number_bytes_read += 4;
 2809|    166|        box->length = (OPJ_UINT32)(l_value);
 2810|       |
 2811|    166|        if (box->length == 0) {
  ------------------
  |  Branch (2811:13): [True: 2, False: 164]
  ------------------
 2812|      2|            opj_event_msg(p_manager, EVT_ERROR, "Cannot handle box of undefined sizes\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2813|      2|            return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 2814|      2|        }
 2815|  21.3k|    } else if (box->length == 0) {
  ------------------
  |  Branch (2815:16): [True: 8, False: 21.3k]
  ------------------
 2816|      8|        opj_event_msg(p_manager, EVT_ERROR, "Cannot handle box of undefined sizes\n");
  ------------------
  |  |   66|      8|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2817|      8|        return OPJ_FALSE;
  ------------------
  |  |  118|      8|#define OPJ_FALSE 0
  ------------------
 2818|      8|    }
 2819|  21.5k|    if (box->length < *p_number_bytes_read) {
  ------------------
  |  Branch (2819:9): [True: 2, False: 21.5k]
  ------------------
 2820|      2|        opj_event_msg(p_manager, EVT_ERROR, "Box length is inconsistent.\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2821|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 2822|      2|    }
 2823|  21.5k|    return OPJ_TRUE;
  ------------------
  |  |  117|  21.5k|#define OPJ_TRUE 1
  ------------------
 2824|  21.5k|}
jp2.c:opj_jp2_img_find_handler:
 2505|  55.4k|{
 2506|  55.4k|    OPJ_UINT32 i, l_handler_size = sizeof(jp2_img_header) / sizeof(
 2507|  55.4k|                                       opj_jp2_header_handler_t);
 2508|   301k|    for (i = 0; i < l_handler_size; ++i) {
  ------------------
  |  Branch (2508:17): [True: 262k, False: 38.6k]
  ------------------
 2509|   262k|        if (jp2_img_header[i].id == p_id) {
  ------------------
  |  Branch (2509:13): [True: 16.7k, False: 245k]
  ------------------
 2510|  16.7k|            return &jp2_img_header[i];
 2511|  16.7k|        }
 2512|   262k|    }
 2513|       |
 2514|  38.6k|    return NULL;
 2515|  55.4k|}
jp2.c:opj_jp2_read_ihdr:
  565|  10.5k|{
  566|       |    /* preconditions */
  567|  10.5k|    assert(p_image_header_data != 00);
  568|  10.5k|    assert(jp2 != 00);
  569|  10.5k|    assert(p_manager != 00);
  570|       |
  571|  10.5k|    if (jp2->comps != NULL) {
  ------------------
  |  Branch (571:9): [True: 2.38k, False: 8.17k]
  ------------------
  572|  2.38k|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  2.38k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
  573|  2.38k|                      "Ignoring ihdr box. First ihdr box already read\n");
  574|  2.38k|        return OPJ_TRUE;
  ------------------
  |  |  117|  2.38k|#define OPJ_TRUE 1
  ------------------
  575|  2.38k|    }
  576|       |
  577|  8.17k|    if (p_image_header_size != 14) {
  ------------------
  |  Branch (577:9): [True: 10, False: 8.16k]
  ------------------
  578|     10|        opj_event_msg(p_manager, EVT_ERROR, "Bad image header box (bad size)\n");
  ------------------
  |  |   66|     10|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  579|     10|        return OPJ_FALSE;
  ------------------
  |  |  118|     10|#define OPJ_FALSE 0
  ------------------
  580|     10|    }
  581|       |
  582|  8.16k|    opj_read_bytes(p_image_header_data, &(jp2->h), 4);          /* HEIGHT */
  ------------------
  |  |   65|  8.16k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  583|  8.16k|    p_image_header_data += 4;
  584|  8.16k|    opj_read_bytes(p_image_header_data, &(jp2->w), 4);          /* WIDTH */
  ------------------
  |  |   65|  8.16k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  585|  8.16k|    p_image_header_data += 4;
  586|  8.16k|    opj_read_bytes(p_image_header_data, &(jp2->numcomps), 2);   /* NC */
  ------------------
  |  |   65|  8.16k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  587|  8.16k|    p_image_header_data += 2;
  588|       |
  589|  8.16k|    if (jp2->h < 1 || jp2->w < 1 || jp2->numcomps < 1) {
  ------------------
  |  Branch (589:9): [True: 1, False: 8.16k]
  |  Branch (589:23): [True: 4, False: 8.16k]
  |  Branch (589:37): [True: 8, False: 8.15k]
  ------------------
  590|     13|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     13|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  591|     13|                      "Wrong values for: w(%d) h(%d) numcomps(%d) (ihdr)\n",
  592|     13|                      jp2->w, jp2->h, jp2->numcomps);
  593|     13|        return OPJ_FALSE;
  ------------------
  |  |  118|     13|#define OPJ_FALSE 0
  ------------------
  594|     13|    }
  595|  8.15k|    if ((jp2->numcomps - 1U) >=
  ------------------
  |  Branch (595:9): [True: 35, False: 8.11k]
  ------------------
  596|  8.15k|            16384U) { /* unsigned underflow is well defined: 1U <= jp2->numcomps <= 16384U */
  597|     35|        opj_event_msg(p_manager, EVT_ERROR, "Invalid number of components (ihdr)\n");
  ------------------
  |  |   66|     35|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  598|     35|        return OPJ_FALSE;
  ------------------
  |  |  118|     35|#define OPJ_FALSE 0
  ------------------
  599|     35|    }
  600|       |
  601|       |    /* allocate memory for components */
  602|  8.11k|    jp2->comps = (opj_jp2_comps_t*) opj_calloc(jp2->numcomps,
  603|  8.11k|                 sizeof(opj_jp2_comps_t));
  604|  8.11k|    if (jp2->comps == 0) {
  ------------------
  |  Branch (604:9): [True: 0, False: 8.11k]
  ------------------
  605|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  606|      0|                      "Not enough memory to handle image header (ihdr)\n");
  607|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  608|      0|    }
  609|       |
  610|  8.11k|    opj_read_bytes(p_image_header_data, &(jp2->bpc), 1);        /* BPC */
  ------------------
  |  |   65|  8.11k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  611|  8.11k|    ++ p_image_header_data;
  612|       |
  613|  8.11k|    opj_read_bytes(p_image_header_data, &(jp2->C), 1);          /* C */
  ------------------
  |  |   65|  8.11k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  614|  8.11k|    ++ p_image_header_data;
  615|       |
  616|       |    /* Should be equal to 7 cf. chapter about image header box of the norm */
  617|  8.11k|    if (jp2->C != 7) {
  ------------------
  |  Branch (617:9): [True: 5.65k, False: 2.46k]
  ------------------
  618|  5.65k|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|  5.65k|#define EVT_INFO    4   /**< Debug event type */
  ------------------
  619|  5.65k|                      "JP2 IHDR box: compression type indicate that the file is not a conforming JP2 file (%d) \n",
  620|  5.65k|                      jp2->C);
  621|  5.65k|    }
  622|       |
  623|  8.11k|    opj_read_bytes(p_image_header_data, &(jp2->UnkC), 1);       /* UnkC */
  ------------------
  |  |   65|  8.11k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  624|  8.11k|    ++ p_image_header_data;
  625|  8.11k|    opj_read_bytes(p_image_header_data, &(jp2->IPR), 1);        /* IPR */
  ------------------
  |  |   65|  8.11k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  626|  8.11k|    ++ p_image_header_data;
  627|       |
  628|  8.11k|    jp2->j2k->m_cp.allow_different_bit_depth_sign = (jp2->bpc == 255);
  629|  8.11k|    jp2->j2k->ihdr_w = jp2->w;
  630|  8.11k|    jp2->j2k->ihdr_h = jp2->h;
  631|  8.11k|    jp2->has_ihdr = 1;
  632|       |
  633|  8.11k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.11k|#define OPJ_TRUE 1
  ------------------
  634|  8.11k|}
jp2.c:opj_jp2_read_colr:
 1469|  2.34k|{
 1470|  2.34k|    OPJ_UINT32 l_value;
 1471|       |
 1472|       |    /* preconditions */
 1473|  2.34k|    assert(jp2 != 00);
 1474|  2.34k|    assert(p_colr_header_data != 00);
 1475|  2.34k|    assert(p_manager != 00);
 1476|       |
 1477|  2.34k|    if (p_colr_header_size < 3) {
  ------------------
  |  Branch (1477:9): [True: 2, False: 2.34k]
  ------------------
 1478|      2|        opj_event_msg(p_manager, EVT_ERROR, "Bad COLR header box (bad size)\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1479|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 1480|      2|    }
 1481|       |
 1482|       |    /* Part 1, I.5.3.3 : 'A conforming JP2 reader shall ignore all Colour
 1483|       |     * Specification boxes after the first.'
 1484|       |    */
 1485|  2.34k|    if (jp2->color.jp2_has_colr) {
  ------------------
  |  Branch (1485:9): [True: 627, False: 1.72k]
  ------------------
 1486|    627|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|    627|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 1487|    627|                      "A conforming JP2 reader shall ignore all Colour Specification boxes after the first, so we ignore this one.\n");
 1488|    627|        p_colr_header_data += p_colr_header_size;
 1489|    627|        return OPJ_TRUE;
  ------------------
  |  |  117|    627|#define OPJ_TRUE 1
  ------------------
 1490|    627|    }
 1491|       |
 1492|  1.72k|    opj_read_bytes(p_colr_header_data, &jp2->meth, 1);          /* METH */
  ------------------
  |  |   65|  1.72k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1493|  1.72k|    ++p_colr_header_data;
 1494|       |
 1495|  1.72k|    opj_read_bytes(p_colr_header_data, &jp2->precedence, 1);    /* PRECEDENCE */
  ------------------
  |  |   65|  1.72k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1496|  1.72k|    ++p_colr_header_data;
 1497|       |
 1498|  1.72k|    opj_read_bytes(p_colr_header_data, &jp2->approx, 1);        /* APPROX */
  ------------------
  |  |   65|  1.72k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1499|  1.72k|    ++p_colr_header_data;
 1500|       |
 1501|  1.72k|    if (jp2->meth == 1) {
  ------------------
  |  Branch (1501:9): [True: 968, False: 752]
  ------------------
 1502|    968|        if (p_colr_header_size < 7) {
  ------------------
  |  Branch (1502:13): [True: 1, False: 967]
  ------------------
 1503|      1|            opj_event_msg(p_manager, EVT_ERROR, "Bad COLR header box (bad size: %d)\n",
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1504|      1|                          p_colr_header_size);
 1505|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 1506|      1|        }
 1507|    967|        if ((p_colr_header_size > 7) &&
  ------------------
  |  Branch (1507:13): [True: 34, False: 933]
  ------------------
 1508|    967|                (jp2->enumcs != 14)) { /* handled below for CIELab) */
  ------------------
  |  Branch (1508:17): [True: 34, False: 0]
  ------------------
 1509|       |            /* testcase Altona_Technical_v20_x4.pdf */
 1510|     34|            opj_event_msg(p_manager, EVT_WARNING, "Bad COLR header box (bad size: %d)\n",
  ------------------
  |  |   67|     34|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1511|     34|                          p_colr_header_size);
 1512|     34|        }
 1513|       |
 1514|    967|        opj_read_bytes(p_colr_header_data, &jp2->enumcs, 4);        /* EnumCS */
  ------------------
  |  |   65|    967|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1515|       |
 1516|    967|        p_colr_header_data += 4;
 1517|       |
 1518|    967|        if (jp2->enumcs == 14) { /* CIELab */
  ------------------
  |  Branch (1518:13): [True: 21, False: 946]
  ------------------
 1519|     21|            OPJ_UINT32 *cielab;
 1520|     21|            OPJ_UINT32 rl, ol, ra, oa, rb, ob, il;
 1521|       |
 1522|     21|            cielab = (OPJ_UINT32*)opj_malloc(9 * sizeof(OPJ_UINT32));
 1523|     21|            if (cielab == NULL) {
  ------------------
  |  Branch (1523:17): [True: 0, False: 21]
  ------------------
 1524|      0|                opj_event_msg(p_manager, EVT_ERROR, "Not enough memory for cielab\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1525|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1526|      0|            }
 1527|     21|            cielab[0] = 14; /* enumcs */
 1528|       |
 1529|       |            /* default values */
 1530|     21|            rl = ra = rb = ol = oa = ob = 0;
 1531|     21|            il = 0x00443530; /* D50 */
 1532|     21|            cielab[1] = 0x44454600;/* DEF */
 1533|       |
 1534|     21|            if (p_colr_header_size == 35) {
  ------------------
  |  Branch (1534:17): [True: 1, False: 20]
  ------------------
 1535|      1|                opj_read_bytes(p_colr_header_data, &rl, 4);
  ------------------
  |  |   65|      1|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1536|      1|                p_colr_header_data += 4;
 1537|      1|                opj_read_bytes(p_colr_header_data, &ol, 4);
  ------------------
  |  |   65|      1|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1538|      1|                p_colr_header_data += 4;
 1539|      1|                opj_read_bytes(p_colr_header_data, &ra, 4);
  ------------------
  |  |   65|      1|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1540|      1|                p_colr_header_data += 4;
 1541|      1|                opj_read_bytes(p_colr_header_data, &oa, 4);
  ------------------
  |  |   65|      1|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1542|      1|                p_colr_header_data += 4;
 1543|      1|                opj_read_bytes(p_colr_header_data, &rb, 4);
  ------------------
  |  |   65|      1|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1544|      1|                p_colr_header_data += 4;
 1545|      1|                opj_read_bytes(p_colr_header_data, &ob, 4);
  ------------------
  |  |   65|      1|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1546|      1|                p_colr_header_data += 4;
 1547|      1|                opj_read_bytes(p_colr_header_data, &il, 4);
  ------------------
  |  |   65|      1|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1548|      1|                p_colr_header_data += 4;
 1549|       |
 1550|      1|                cielab[1] = 0;
 1551|     20|            } else if (p_colr_header_size != 7) {
  ------------------
  |  Branch (1551:24): [True: 6, False: 14]
  ------------------
 1552|      6|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      6|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1553|      6|                              "Bad COLR header box (CIELab, bad size: %d)\n", p_colr_header_size);
 1554|      6|            }
 1555|     21|            cielab[2] = rl;
 1556|     21|            cielab[4] = ra;
 1557|     21|            cielab[6] = rb;
 1558|     21|            cielab[3] = ol;
 1559|     21|            cielab[5] = oa;
 1560|     21|            cielab[7] = ob;
 1561|     21|            cielab[8] = il;
 1562|       |
 1563|     21|            jp2->color.icc_profile_buf = (OPJ_BYTE*)cielab;
 1564|     21|            jp2->color.icc_profile_len = 0;
 1565|     21|        }
 1566|    967|        jp2->color.jp2_has_colr = 1;
 1567|    967|    } else if (jp2->meth == 2) {
  ------------------
  |  Branch (1567:16): [True: 54, False: 698]
  ------------------
 1568|       |        /* ICC profile */
 1569|     54|        OPJ_INT32 it_icc_value = 0;
 1570|     54|        OPJ_INT32 icc_len = (OPJ_INT32)p_colr_header_size - 3;
 1571|       |
 1572|     54|        jp2->color.icc_profile_len = (OPJ_UINT32)icc_len;
 1573|     54|        jp2->color.icc_profile_buf = (OPJ_BYTE*) opj_calloc(1, (size_t)icc_len);
 1574|     54|        if (!jp2->color.icc_profile_buf) {
  ------------------
  |  Branch (1574:13): [True: 1, False: 53]
  ------------------
 1575|      1|            jp2->color.icc_profile_len = 0;
 1576|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 1577|      1|        }
 1578|       |
 1579|    741|        for (it_icc_value = 0; it_icc_value < icc_len; ++it_icc_value) {
  ------------------
  |  Branch (1579:32): [True: 688, False: 53]
  ------------------
 1580|    688|            opj_read_bytes(p_colr_header_data, &l_value, 1);    /* icc values */
  ------------------
  |  |   65|    688|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1581|    688|            ++p_colr_header_data;
 1582|    688|            jp2->color.icc_profile_buf[it_icc_value] = (OPJ_BYTE) l_value;
 1583|    688|        }
 1584|       |
 1585|     53|        jp2->color.jp2_has_colr = 1;
 1586|    698|    } else if (jp2->meth > 2) {
  ------------------
  |  Branch (1586:16): [True: 582, False: 116]
  ------------------
 1587|       |        /*  ISO/IEC 15444-1:2004 (E), Table I.9 Legal METH values:
 1588|       |        conforming JP2 reader shall ignore the entire Colour Specification box.*/
 1589|    582|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|    582|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 1590|    582|                      "COLR BOX meth value is not a regular value (%d), "
 1591|    582|                      "so we will ignore the entire Colour Specification box. \n", jp2->meth);
 1592|    582|    }
 1593|       |
 1594|  1.71k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.71k|#define OPJ_TRUE 1
  ------------------
 1595|  1.72k|}
jp2.c:opj_jp2_read_bpcc:
  732|  1.39k|{
  733|  1.39k|    OPJ_UINT32 i;
  734|       |
  735|       |    /* preconditions */
  736|  1.39k|    assert(p_bpc_header_data != 00);
  737|  1.39k|    assert(jp2 != 00);
  738|  1.39k|    assert(p_manager != 00);
  739|       |
  740|       |
  741|  1.39k|    if (jp2->bpc != 255) {
  ------------------
  |  Branch (741:9): [True: 1.28k, False: 103]
  ------------------
  742|  1.28k|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  1.28k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
  743|  1.28k|                      "A BPCC header box is available although BPC given by the IHDR box (%d) indicate components bit depth is constant\n",
  744|  1.28k|                      jp2->bpc);
  745|  1.28k|    }
  746|       |
  747|       |    /* and length is relevant */
  748|  1.39k|    if (p_bpc_header_size != jp2->numcomps) {
  ------------------
  |  Branch (748:9): [True: 14, False: 1.37k]
  ------------------
  749|     14|        opj_event_msg(p_manager, EVT_ERROR, "Bad BPCC header box (bad size)\n");
  ------------------
  |  |   66|     14|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  750|     14|        return OPJ_FALSE;
  ------------------
  |  |  118|     14|#define OPJ_FALSE 0
  ------------------
  751|     14|    }
  752|       |
  753|       |    /* read info for each component */
  754|  2.19k|    for (i = 0; i < jp2->numcomps; ++i) {
  ------------------
  |  Branch (754:17): [True: 817, False: 1.37k]
  ------------------
  755|    817|        opj_read_bytes(p_bpc_header_data, &jp2->comps[i].bpcc,
  ------------------
  |  |   65|    817|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  756|    817|                       1);  /* read each BPCC component */
  757|    817|        ++p_bpc_header_data;
  758|    817|    }
  759|       |
  760|  1.37k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.37k|#define OPJ_TRUE 1
  ------------------
  761|  1.39k|}
jp2.c:opj_jp2_read_pclr:
 1157|    273|{
 1158|    273|    opj_jp2_pclr_t *jp2_pclr;
 1159|    273|    OPJ_BYTE *channel_size, *channel_sign;
 1160|    273|    OPJ_UINT32 *entries;
 1161|    273|    OPJ_UINT16 nr_entries, nr_channels;
 1162|    273|    OPJ_UINT16 i, j;
 1163|    273|    OPJ_UINT32 l_value;
 1164|    273|    OPJ_BYTE *orig_header_data = p_pclr_header_data;
 1165|       |
 1166|       |    /* preconditions */
 1167|    273|    assert(p_pclr_header_data != 00);
 1168|    273|    assert(jp2 != 00);
 1169|    273|    assert(p_manager != 00);
 1170|    273|    (void)p_pclr_header_size;
 1171|       |
 1172|    273|    if (jp2->color.jp2_pclr) {
  ------------------
  |  Branch (1172:9): [True: 2, False: 271]
  ------------------
 1173|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 1174|      2|    }
 1175|       |
 1176|    271|    if (p_pclr_header_size < 3) {
  ------------------
  |  Branch (1176:9): [True: 4, False: 267]
  ------------------
 1177|      4|        return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
 1178|      4|    }
 1179|       |
 1180|    267|    opj_read_bytes(p_pclr_header_data, &l_value, 2);    /* NE */
  ------------------
  |  |   65|    267|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1181|    267|    p_pclr_header_data += 2;
 1182|    267|    nr_entries = (OPJ_UINT16) l_value;
 1183|    267|    if ((nr_entries == 0U) || (nr_entries > 1024U)) {
  ------------------
  |  Branch (1183:9): [True: 2, False: 265]
  |  Branch (1183:31): [True: 10, False: 255]
  ------------------
 1184|     12|        opj_event_msg(p_manager, EVT_ERROR, "Invalid PCLR box. Reports %d entries\n",
  ------------------
  |  |   66|     12|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1185|     12|                      (int)nr_entries);
 1186|     12|        return OPJ_FALSE;
  ------------------
  |  |  118|     12|#define OPJ_FALSE 0
  ------------------
 1187|     12|    }
 1188|       |
 1189|    255|    opj_read_bytes(p_pclr_header_data, &l_value, 1);    /* NPC */
  ------------------
  |  |   65|    255|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1190|    255|    ++p_pclr_header_data;
 1191|    255|    nr_channels = (OPJ_UINT16) l_value;
 1192|    255|    if (nr_channels == 0U) {
  ------------------
  |  Branch (1192:9): [True: 1, False: 254]
  ------------------
 1193|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1194|      1|                      "Invalid PCLR box. Reports 0 palette columns\n");
 1195|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 1196|      1|    }
 1197|       |
 1198|    254|    if (p_pclr_header_size < 3 + (OPJ_UINT32)nr_channels) {
  ------------------
  |  Branch (1198:9): [True: 8, False: 246]
  ------------------
 1199|      8|        return OPJ_FALSE;
  ------------------
  |  |  118|      8|#define OPJ_FALSE 0
  ------------------
 1200|      8|    }
 1201|       |
 1202|    246|    entries = (OPJ_UINT32*) opj_malloc(sizeof(OPJ_UINT32) * nr_channels *
 1203|    246|                                       nr_entries);
 1204|    246|    if (!entries) {
  ------------------
  |  Branch (1204:9): [True: 0, False: 246]
  ------------------
 1205|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1206|      0|    }
 1207|    246|    channel_size = (OPJ_BYTE*) opj_malloc(nr_channels);
 1208|    246|    if (!channel_size) {
  ------------------
  |  Branch (1208:9): [True: 0, False: 246]
  ------------------
 1209|      0|        opj_free(entries);
 1210|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1211|      0|    }
 1212|    246|    channel_sign = (OPJ_BYTE*) opj_malloc(nr_channels);
 1213|    246|    if (!channel_sign) {
  ------------------
  |  Branch (1213:9): [True: 0, False: 246]
  ------------------
 1214|      0|        opj_free(entries);
 1215|      0|        opj_free(channel_size);
 1216|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1217|      0|    }
 1218|       |
 1219|    246|    jp2_pclr = (opj_jp2_pclr_t*)opj_malloc(sizeof(opj_jp2_pclr_t));
 1220|    246|    if (!jp2_pclr) {
  ------------------
  |  Branch (1220:9): [True: 0, False: 246]
  ------------------
 1221|      0|        opj_free(entries);
 1222|      0|        opj_free(channel_size);
 1223|      0|        opj_free(channel_sign);
 1224|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1225|      0|    }
 1226|       |
 1227|    246|    jp2_pclr->channel_sign = channel_sign;
 1228|    246|    jp2_pclr->channel_size = channel_size;
 1229|    246|    jp2_pclr->entries = entries;
 1230|    246|    jp2_pclr->nr_entries = nr_entries;
 1231|    246|    jp2_pclr->nr_channels = (OPJ_BYTE) l_value;
 1232|    246|    jp2_pclr->cmap = NULL;
 1233|       |
 1234|    246|    jp2->color.jp2_pclr = jp2_pclr;
 1235|       |
 1236|  2.36k|    for (i = 0; i < nr_channels; ++i) {
  ------------------
  |  Branch (1236:17): [True: 2.11k, False: 246]
  ------------------
 1237|  2.11k|        opj_read_bytes(p_pclr_header_data, &l_value, 1);    /* Bi */
  ------------------
  |  |   65|  2.11k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1238|  2.11k|        ++p_pclr_header_data;
 1239|       |
 1240|  2.11k|        channel_size[i] = (OPJ_BYTE)((l_value & 0x7f) + 1);
 1241|  2.11k|        channel_sign[i] = (l_value & 0x80) ? 1 : 0;
  ------------------
  |  Branch (1241:27): [True: 346, False: 1.77k]
  ------------------
 1242|  2.11k|    }
 1243|       |
 1244|  1.53k|    for (j = 0; j < nr_entries; ++j) {
  ------------------
  |  Branch (1244:17): [True: 1.33k, False: 199]
  ------------------
 1245|  36.4k|        for (i = 0; i < nr_channels; ++i) {
  ------------------
  |  Branch (1245:21): [True: 35.1k, False: 1.28k]
  ------------------
 1246|  35.1k|            OPJ_UINT32 bytes_to_read = (OPJ_UINT32)((channel_size[i] + 7) >> 3);
 1247|       |
 1248|  35.1k|            if (bytes_to_read > sizeof(OPJ_UINT32)) {
  ------------------
  |  Branch (1248:17): [True: 10.4k, False: 24.6k]
  ------------------
 1249|  10.4k|                bytes_to_read = sizeof(OPJ_UINT32);
 1250|  10.4k|            }
 1251|  35.1k|            if ((ptrdiff_t)p_pclr_header_size < (ptrdiff_t)(p_pclr_header_data -
  ------------------
  |  Branch (1251:17): [True: 47, False: 35.0k]
  ------------------
 1252|  35.1k|                    orig_header_data) + (ptrdiff_t)bytes_to_read) {
 1253|     47|                return OPJ_FALSE;
  ------------------
  |  |  118|     47|#define OPJ_FALSE 0
  ------------------
 1254|     47|            }
 1255|       |
 1256|  35.0k|            opj_read_bytes(p_pclr_header_data, &l_value, bytes_to_read);    /* Cji */
  ------------------
  |  |   65|  35.0k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1257|  35.0k|            p_pclr_header_data += bytes_to_read;
 1258|  35.0k|            *entries = (OPJ_UINT32) l_value;
 1259|  35.0k|            entries++;
 1260|  35.0k|        }
 1261|  1.33k|    }
 1262|       |
 1263|    199|    return OPJ_TRUE;
  ------------------
  |  |  117|    199|#define OPJ_TRUE 1
  ------------------
 1264|    246|}
jp2.c:opj_jp2_read_cmap:
 1271|    190|{
 1272|    190|    opj_jp2_cmap_comp_t *cmap;
 1273|    190|    OPJ_BYTE i, nr_channels;
 1274|    190|    OPJ_UINT32 l_value;
 1275|       |
 1276|       |    /* preconditions */
 1277|    190|    assert(jp2 != 00);
 1278|    190|    assert(p_cmap_header_data != 00);
 1279|    190|    assert(p_manager != 00);
 1280|    190|    (void)p_cmap_header_size;
 1281|       |
 1282|       |    /* Need nr_channels: */
 1283|    190|    if (jp2->color.jp2_pclr == NULL) {
  ------------------
  |  Branch (1283:9): [True: 3, False: 187]
  ------------------
 1284|      3|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1285|      3|                      "Need to read a PCLR box before the CMAP box.\n");
 1286|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 1287|      3|    }
 1288|       |
 1289|       |    /* Part 1, I.5.3.5: 'There shall be at most one Component Mapping box
 1290|       |     * inside a JP2 Header box' :
 1291|       |    */
 1292|    187|    if (jp2->color.jp2_pclr->cmap) {
  ------------------
  |  Branch (1292:9): [True: 2, False: 185]
  ------------------
 1293|      2|        opj_event_msg(p_manager, EVT_ERROR, "Only one CMAP box is allowed.\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1294|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 1295|      2|    }
 1296|       |
 1297|    185|    nr_channels = jp2->color.jp2_pclr->nr_channels;
 1298|    185|    if (p_cmap_header_size < (OPJ_UINT32)nr_channels * 4) {
  ------------------
  |  Branch (1298:9): [True: 3, False: 182]
  ------------------
 1299|      3|        opj_event_msg(p_manager, EVT_ERROR, "Insufficient data for CMAP box.\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1300|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 1301|      3|    }
 1302|       |
 1303|    182|    cmap = (opj_jp2_cmap_comp_t*) opj_malloc(nr_channels * sizeof(
 1304|    182|                opj_jp2_cmap_comp_t));
 1305|    182|    if (!cmap) {
  ------------------
  |  Branch (1305:9): [True: 0, False: 182]
  ------------------
 1306|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1307|      0|    }
 1308|       |
 1309|       |
 1310|    729|    for (i = 0; i < nr_channels; ++i) {
  ------------------
  |  Branch (1310:17): [True: 547, False: 182]
  ------------------
 1311|    547|        opj_read_bytes(p_cmap_header_data, &l_value, 2);            /* CMP^i */
  ------------------
  |  |   65|    547|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1312|    547|        p_cmap_header_data += 2;
 1313|    547|        cmap[i].cmp = (OPJ_UINT16) l_value;
 1314|       |
 1315|    547|        opj_read_bytes(p_cmap_header_data, &l_value, 1);            /* MTYP^i */
  ------------------
  |  |   65|    547|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1316|    547|        ++p_cmap_header_data;
 1317|    547|        cmap[i].mtyp = (OPJ_BYTE) l_value;
 1318|       |
 1319|    547|        opj_read_bytes(p_cmap_header_data, &l_value, 1);            /* PCOL^i */
  ------------------
  |  |   65|    547|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1320|    547|        ++p_cmap_header_data;
 1321|    547|        cmap[i].pcol = (OPJ_BYTE) l_value;
 1322|    547|    }
 1323|       |
 1324|    182|    jp2->color.jp2_pclr->cmap = cmap;
 1325|       |
 1326|    182|    return OPJ_TRUE;
  ------------------
  |  |  117|    182|#define OPJ_TRUE 1
  ------------------
 1327|    182|}
jp2.c:opj_jp2_read_cdef:
 1397|    140|{
 1398|    140|    opj_jp2_cdef_info_t *cdef_info;
 1399|    140|    OPJ_UINT16 i;
 1400|    140|    OPJ_UINT32 l_value;
 1401|       |
 1402|       |    /* preconditions */
 1403|    140|    assert(jp2 != 00);
 1404|    140|    assert(p_cdef_header_data != 00);
 1405|    140|    assert(p_manager != 00);
 1406|    140|    (void)p_cdef_header_size;
 1407|       |
 1408|       |    /* Part 1, I.5.3.6: 'The shall be at most one Channel Definition box
 1409|       |     * inside a JP2 Header box.'*/
 1410|    140|    if (jp2->color.jp2_cdef) {
  ------------------
  |  Branch (1410:9): [True: 1, False: 139]
  ------------------
 1411|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 1412|      1|    }
 1413|       |
 1414|    139|    if (p_cdef_header_size < 2) {
  ------------------
  |  Branch (1414:9): [True: 2, False: 137]
  ------------------
 1415|      2|        opj_event_msg(p_manager, EVT_ERROR, "Insufficient data for CDEF box.\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1416|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 1417|      2|    }
 1418|       |
 1419|    137|    opj_read_bytes(p_cdef_header_data, &l_value, 2);        /* N */
  ------------------
  |  |   65|    137|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1420|    137|    p_cdef_header_data += 2;
 1421|       |
 1422|    137|    if ((OPJ_UINT16)l_value == 0) { /* szukw000: FIXME */
  ------------------
  |  Branch (1422:9): [True: 1, False: 136]
  ------------------
 1423|      1|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1424|      1|                      "Number of channel description is equal to zero in CDEF box.\n");
 1425|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 1426|      1|    }
 1427|       |
 1428|    136|    if (p_cdef_header_size < 2 + (OPJ_UINT32)(OPJ_UINT16)l_value * 6) {
  ------------------
  |  Branch (1428:9): [True: 23, False: 113]
  ------------------
 1429|     23|        opj_event_msg(p_manager, EVT_ERROR, "Insufficient data for CDEF box.\n");
  ------------------
  |  |   66|     23|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1430|     23|        return OPJ_FALSE;
  ------------------
  |  |  118|     23|#define OPJ_FALSE 0
  ------------------
 1431|     23|    }
 1432|       |
 1433|    113|    cdef_info = (opj_jp2_cdef_info_t*) opj_malloc(l_value * sizeof(
 1434|    113|                    opj_jp2_cdef_info_t));
 1435|    113|    if (!cdef_info) {
  ------------------
  |  Branch (1435:9): [True: 0, False: 113]
  ------------------
 1436|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1437|      0|    }
 1438|       |
 1439|    113|    jp2->color.jp2_cdef = (opj_jp2_cdef_t*)opj_malloc(sizeof(opj_jp2_cdef_t));
 1440|    113|    if (!jp2->color.jp2_cdef) {
  ------------------
  |  Branch (1440:9): [True: 0, False: 113]
  ------------------
 1441|      0|        opj_free(cdef_info);
 1442|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1443|      0|    }
 1444|    113|    jp2->color.jp2_cdef->info = cdef_info;
 1445|    113|    jp2->color.jp2_cdef->n = (OPJ_UINT16) l_value;
 1446|       |
 1447|    702|    for (i = 0; i < jp2->color.jp2_cdef->n; ++i) {
  ------------------
  |  Branch (1447:17): [True: 589, False: 113]
  ------------------
 1448|    589|        opj_read_bytes(p_cdef_header_data, &l_value, 2);            /* Cn^i */
  ------------------
  |  |   65|    589|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1449|    589|        p_cdef_header_data += 2;
 1450|    589|        cdef_info[i].cn = (OPJ_UINT16) l_value;
 1451|       |
 1452|    589|        opj_read_bytes(p_cdef_header_data, &l_value, 2);            /* Typ^i */
  ------------------
  |  |   65|    589|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1453|    589|        p_cdef_header_data += 2;
 1454|    589|        cdef_info[i].typ = (OPJ_UINT16) l_value;
 1455|       |
 1456|    589|        opj_read_bytes(p_cdef_header_data, &l_value, 2);            /* Asoc^i */
  ------------------
  |  |   65|    589|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1457|    589|        p_cdef_header_data += 2;
 1458|    589|        cdef_info[i].asoc = (OPJ_UINT16) l_value;
 1459|    589|    }
 1460|       |
 1461|    113|    return OPJ_TRUE;
  ------------------
  |  |  117|    113|#define OPJ_TRUE 1
  ------------------
 1462|    113|}
jp2.c:opj_jp2_exec:
 2423|  25.3k|{
 2424|  25.3k|    OPJ_BOOL(** l_procedure)(opj_jp2_t * jp2, opj_stream_private_t *,
 2425|  25.3k|                             opj_event_mgr_t *) = 00;
 2426|  25.3k|    OPJ_BOOL l_result = OPJ_TRUE;
  ------------------
  |  |  117|  25.3k|#define OPJ_TRUE 1
  ------------------
 2427|  25.3k|    OPJ_UINT32 l_nb_proc, i;
 2428|       |
 2429|       |    /* preconditions */
 2430|  25.3k|    assert(p_procedure_list != 00);
 2431|  25.3k|    assert(jp2 != 00);
 2432|  25.3k|    assert(stream != 00);
 2433|  25.3k|    assert(p_manager != 00);
 2434|       |
 2435|  25.3k|    l_nb_proc = opj_procedure_list_get_nb_procedures(p_procedure_list);
 2436|  25.3k|    l_procedure = (OPJ_BOOL(**)(opj_jp2_t * jp2, opj_stream_private_t *,
 2437|  25.3k|                                opj_event_mgr_t *)) opj_procedure_list_get_first_procedure(p_procedure_list);
 2438|       |
 2439|  41.4k|    for (i = 0; i < l_nb_proc; ++i) {
  ------------------
  |  Branch (2439:17): [True: 16.1k, False: 25.3k]
  ------------------
 2440|  16.1k|        l_result = l_result && (*l_procedure)(jp2, stream, p_manager);
  ------------------
  |  Branch (2440:20): [True: 16.1k, False: 0]
  |  Branch (2440:32): [True: 15.1k, False: 918]
  ------------------
 2441|  16.1k|        ++l_procedure;
 2442|  16.1k|    }
 2443|       |
 2444|       |    /* and clear the procedure list at the end. */
 2445|  25.3k|    opj_procedure_list_clear(p_procedure_list);
 2446|  25.3k|    return l_result;
 2447|  25.3k|}
jp2.c:opj_jp2_setup_decoding_validation:
 2915|  9.22k|{
 2916|       |    /* preconditions */
 2917|  9.22k|    assert(jp2 != 00);
 2918|  9.22k|    assert(p_manager != 00);
 2919|       |
 2920|  9.22k|    OPJ_UNUSED(jp2);
  ------------------
  |  |   47|  9.22k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2921|  9.22k|    OPJ_UNUSED(p_manager);
  ------------------
  |  |   47|  9.22k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2922|       |
 2923|       |    /* DEVELOPER CORNER, add your custom validation procedure */
 2924|       |
 2925|  9.22k|    return OPJ_TRUE;
  ------------------
  |  |  117|  9.22k|#define OPJ_TRUE 1
  ------------------
 2926|  9.22k|}
jp2.c:opj_jp2_setup_header_reading:
 2965|  9.22k|{
 2966|       |    /* preconditions */
 2967|  9.22k|    assert(jp2 != 00);
 2968|  9.22k|    assert(p_manager != 00);
 2969|       |
 2970|  9.22k|    if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,
  ------------------
  |  Branch (2970:9): [True: 0, False: 9.22k]
  ------------------
 2971|  9.22k|                                           (opj_procedure)opj_jp2_read_header_procedure, p_manager)) {
 2972|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2973|      0|    }
 2974|       |
 2975|       |    /* DEVELOPER CORNER, add your custom procedures */
 2976|       |
 2977|  9.22k|    return OPJ_TRUE;
  ------------------
  |  |  117|  9.22k|#define OPJ_TRUE 1
  ------------------
 2978|  9.22k|}

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

opj_mqc_init_dec:
  441|   229k|{
  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|   229k|    opj_mqc_init_dec_common(mqc, bp, len, extra_writable_bytes);
  448|   229k|    opj_mqc_setcurctx(mqc, 0);
  ------------------
  |  |  139|   229k|#define opj_mqc_setcurctx(mqc, ctxno)   (mqc)->curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  ------------------
  449|   229k|    mqc->end_of_byte_stream_counter = 0;
  450|   229k|    if (len == 0) {
  ------------------
  |  Branch (450:9): [True: 76.3k, False: 153k]
  ------------------
  451|  76.3k|        mqc->c = 0xff << 16;
  452|   153k|    } else {
  453|   153k|        mqc->c = (OPJ_UINT32)(*mqc->bp << 16);
  454|   153k|    }
  455|       |
  456|   229k|    opj_mqc_bytein(mqc);
  457|   229k|    mqc->c <<= 7;
  458|   229k|    mqc->ct -= 7;
  459|   229k|    mqc->a = 0x8000;
  460|   229k|}
opj_mqc_raw_init_dec:
  465|  28.3k|{
  466|  28.3k|    opj_mqc_init_dec_common(mqc, bp, len, extra_writable_bytes);
  467|  28.3k|    mqc->c = 0;
  468|  28.3k|    mqc->ct = 0;
  469|  28.3k|}
opq_mqc_finish_dec:
  473|   257k|{
  474|       |    /* Restore the bytes overwritten by opj_mqc_init_dec_common() */
  475|   257k|    memcpy(mqc->end, mqc->backup, OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|   257k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
  476|   257k|}
opj_mqc_resetstates:
  479|  2.62M|{
  480|  2.62M|    OPJ_UINT32 i;
  481|  52.5M|    for (i = 0; i < MQC_NUMCTXS; i++) {
  ------------------
  |  |   69|  52.5M|#define MQC_NUMCTXS 19
  ------------------
  |  Branch (481:17): [True: 49.8M, False: 2.62M]
  ------------------
  482|  49.8M|        mqc->ctxs[i] = mqc_states;
  483|  49.8M|    }
  484|  2.62M|}
opj_mqc_setstate:
  488|  7.87M|{
  489|  7.87M|    mqc->ctxs[ctxno] = &mqc_states[msb + (OPJ_UINT32)(prob << 1)];
  490|  7.87M|}
mqc.c:opj_mqc_init_dec_common:
  424|   257k|{
  425|   257k|    (void)extra_writable_bytes;
  426|       |
  427|   257k|    assert(extra_writable_bytes >= OPJ_COMMON_CBLK_DATA_EXTRA);
  428|   257k|    mqc->start = bp;
  429|   257k|    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|   257k|    memcpy(mqc->backup, mqc->end, OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|   257k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
  435|   257k|    mqc->end[0] = 0xFF;
  436|   257k|    mqc->end[1] = 0xFF;
  437|   257k|    mqc->bp = bp;
  438|   257k|}

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

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

tcd.c:opj_lrintf:
  175|   246M|{
  176|   246M|    return lrintf(f);
  177|   246M|}

image.c:opj_uint_max:
   84|  15.1k|{
   85|  15.1k|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 0, False: 15.1k]
  ------------------
   86|  15.1k|}
image.c:opj_uint_min:
   66|  15.1k|{
   67|  15.1k|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 92, False: 15.0k]
  ------------------
   68|  15.1k|}
image.c:opj_uint_adds:
   93|  15.1k|{
   94|  15.1k|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|  15.1k|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|  15.1k|}
image.c:opj_uint_ceildiv:
  171|   115k|{
  172|   115k|    assert(b);
  173|   115k|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|   115k|}
image.c:opj_uint_ceildivpow2:
  210|  57.9k|{
  211|  57.9k|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|  57.9k|}
j2k.c:opj_int_ceildiv:
  161|   132k|{
  162|   132k|    assert(b);
  163|   132k|    return (OPJ_INT32)(((OPJ_INT64)a + b - 1) / b);
  164|   132k|}
j2k.c:opj_uint_min:
   66|  9.00k|{
   67|  9.00k|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 2.90k, False: 6.09k]
  ------------------
   68|  9.00k|}
j2k.c:opj_uint_adds:
   93|  15.6k|{
   94|  15.6k|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|  15.6k|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|  15.6k|}
j2k.c:opj_uint_ceildivpow2:
  210|  36.2k|{
  211|  36.2k|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|  36.2k|}
j2k.c:opj_int_ceildivpow2:
  192|   103k|{
  193|   103k|    return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
  194|   103k|}
pi.c:opj_uint_max:
   84|  13.7k|{
   85|  13.7k|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 1.27k, False: 12.4k]
  ------------------
   86|  13.7k|}
pi.c:opj_uint_min:
   66|  1.25M|{
   67|  1.25M|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 527k, False: 722k]
  ------------------
   68|  1.25M|}
pi.c:opj_uint_adds:
   93|  13.7k|{
   94|  13.7k|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|  13.7k|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|  13.7k|}
pi.c:opj_uint_ceildiv:
  171|   101k|{
  172|   101k|    assert(b);
  173|   101k|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|   101k|}
pi.c:opj_uint_ceildivpow2:
  210|   842k|{
  211|   842k|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|   842k|}
pi.c:opj_uint_floordivpow2:
  228|   974k|{
  229|   974k|    return a >> b;
  230|   974k|}
pi.c:opj_uint64_ceildiv_res_uint32:
  182|  4.62M|{
  183|  4.62M|    assert(b);
  184|  4.62M|    return (OPJ_UINT32)((a + b - 1) / b);
  185|  4.62M|}
tcd.c:opj_int_ceildiv:
  161|   103k|{
  162|   103k|    assert(b);
  163|   103k|    return (OPJ_INT32)(((OPJ_INT64)a + b - 1) / b);
  164|   103k|}
tcd.c:opj_int_ceildivpow2:
  192|  6.10M|{
  193|  6.10M|    return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
  194|  6.10M|}
tcd.c:opj_int_floordivpow2:
  219|  5.19M|{
  220|  5.19M|    return a >> b;
  221|  5.19M|}
tcd.c:opj_int64_ceildivpow2:
  201|  1.39M|{
  202|  1.39M|    return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
  203|  1.39M|}
tcd.c:opj_int_max:
   75|   231M|{
   76|   231M|    return (a > b) ? a : b;
  ------------------
  |  Branch (76:12): [True: 157M, False: 74.2M]
  ------------------
   77|   231M|}
tcd.c:opj_int_min:
   57|   231M|{
   58|   231M|    return a < b ? a : b;
  ------------------
  |  Branch (58:12): [True: 157M, False: 74.2M]
  ------------------
   59|   231M|}
tcd.c:opj_uint_max:
   84|  1.01G|{
   85|  1.01G|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 20.4M, False: 997M]
  ------------------
   86|  1.01G|}
tcd.c:opj_uint_ceildiv:
  171|  2.03G|{
  172|  2.03G|    assert(b);
  173|  2.03G|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|  2.03G|}
tcd.c:opj_uint_min:
   66|  1.01G|{
   67|  1.01G|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 109M, False: 908M]
  ------------------
   68|  1.01G|}
tcd.c:opj_uint_ceildivpow2:
  210|  1.52G|{
  211|  1.52G|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|  1.52G|}
tcd.c:opj_int_clamp:
  118|   344M|{
  119|   344M|    if (a < min) {
  ------------------
  |  Branch (119:9): [True: 26.1M, False: 318M]
  ------------------
  120|  26.1M|        return min;
  121|  26.1M|    }
  122|   318M|    if (a > max) {
  ------------------
  |  Branch (122:9): [True: 24.8M, False: 293M]
  ------------------
  123|  24.8M|        return max;
  124|  24.8M|    }
  125|   293M|    return a;
  126|   318M|}
tcd.c:opj_int64_clamp:
  139|   246M|{
  140|   246M|    if (a < min) {
  ------------------
  |  Branch (140:9): [True: 8.55M, False: 238M]
  ------------------
  141|  8.55M|        return min;
  142|  8.55M|    }
  143|   238M|    if (a > max) {
  ------------------
  |  Branch (143:9): [True: 8.56M, False: 229M]
  ------------------
  144|  8.56M|        return max;
  145|  8.56M|    }
  146|   229M|    return a;
  147|   238M|}
tcd.c:opj_uint_adds:
   93|  1.01G|{
   94|  1.01G|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|  1.01G|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|  1.01G|}
dwt.c:opj_uint_min:
   66|  2.17M|{
   67|  2.17M|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 1.20M, False: 971k]
  ------------------
   68|  2.17M|}
dwt.c:opj_int_min:
   57|  1.25M|{
   58|  1.25M|    return a < b ? a : b;
  ------------------
  |  Branch (58:12): [True: 0, False: 1.25M]
  ------------------
   59|  1.25M|}
dwt.c:opj_int_add_no_overflow:
  298|  14.5M|{
  299|  14.5M|    void* pa = &a;
  300|  14.5M|    void* pb = &b;
  301|  14.5M|    OPJ_UINT32* upa = (OPJ_UINT32*)pa;
  302|  14.5M|    OPJ_UINT32* upb = (OPJ_UINT32*)pb;
  303|  14.5M|    OPJ_UINT32 ures = *upa + *upb;
  304|  14.5M|    void* pures = &ures;
  305|  14.5M|    OPJ_INT32* ipres = (OPJ_INT32*)pures;
  306|  14.5M|    return *ipres;
  307|  14.5M|}
dwt.c:opj_int_sub_no_overflow:
  317|  2.18M|{
  318|  2.18M|    void* pa = &a;
  319|  2.18M|    void* pb = &b;
  320|  2.18M|    OPJ_UINT32* upa = (OPJ_UINT32*)pa;
  321|  2.18M|    OPJ_UINT32* upb = (OPJ_UINT32*)pb;
  322|  2.18M|    OPJ_UINT32 ures = *upa - *upb;
  323|  2.18M|    void* pures = &ures;
  324|  2.18M|    OPJ_INT32* ipres = (OPJ_INT32*)pures;
  325|  2.18M|    return *ipres;
  326|  2.18M|}
dwt.c:opj_uint_ceildivpow2:
  210|   245k|{
  211|   245k|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|   245k|}
dwt.c:opj_uint_subs:
  103|   610k|{
  104|   610k|    return (a >= b) ? a - b : 0;
  ------------------
  |  Branch (104:12): [True: 406k, False: 203k]
  ------------------
  105|   610k|}
dwt.c:opj_uint_adds:
   93|   203k|{
   94|   203k|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|   203k|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|   203k|}
dwt.c:opj_uint_max:
   84|   101k|{
   85|   101k|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 45.5k, False: 56.1k]
  ------------------
   86|   101k|}
t2.c:opj_uint_max:
   84|   119M|{
   85|   119M|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 40.4k, False: 119M]
  ------------------
   86|   119M|}
t2.c:opj_uint_floorlog2:
  249|   819k|{
  250|   819k|    OPJ_UINT32  l;
  251|  1.46M|    for (l = 0; a > 1; ++l) {
  ------------------
  |  Branch (251:17): [True: 642k, False: 819k]
  ------------------
  252|   642k|        a >>= 1;
  253|   642k|    }
  254|   819k|    return l;
  255|   819k|}
t2.c:opj_int_min:
   57|   697k|{
   58|   697k|    return a < b ? a : b;
  ------------------
  |  Branch (58:12): [True: 373k, False: 323k]
  ------------------
   59|   697k|}
sparse_array.c:opj_uint_ceildiv:
  171|  32.0k|{
  172|  32.0k|    assert(b);
  173|  32.0k|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|  32.0k|}
sparse_array.c:opj_uint_min:
   66|  26.6M|{
   67|  26.6M|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 10.8M, False: 15.7M]
  ------------------
   68|  26.6M|}

opj_malloc:
  192|   256M|{
  193|   256M|    if (size == 0U) { /* prevent implementation defined behavior of realloc */
  ------------------
  |  Branch (193:9): [True: 1, False: 256M]
  ------------------
  194|      1|        return NULL;
  195|      1|    }
  196|   256M|    return malloc(size);
  197|   256M|}
opj_calloc:
  199|   127M|{
  200|   127M|    if (num == 0 || size == 0) {
  ------------------
  |  Branch (200:9): [True: 12, False: 127M]
  |  Branch (200:21): [True: 1, False: 127M]
  ------------------
  201|       |        /* prevent implementation defined behavior of realloc */
  202|     13|        return NULL;
  203|     13|    }
  204|   127M|    return calloc(num, size);
  205|   127M|}
opj_aligned_malloc:
  208|   993k|{
  209|   993k|    return opj_aligned_alloc_n(16U, size);
  210|   993k|}
opj_aligned_32_malloc:
  217|  5.03k|{
  218|  5.03k|    return opj_aligned_alloc_n(32U, size);
  219|  5.03k|}
opj_aligned_free:
  226|   113M|{
  227|   113M|#if defined(OPJ_HAVE_POSIX_MEMALIGN) || defined(OPJ_HAVE_MEMALIGN)
  228|   113M|    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|   113M|}
opj_realloc:
  240|   290k|{
  241|   290k|    if (new_size == 0U) { /* prevent implementation defined behavior of realloc */
  ------------------
  |  Branch (241:9): [True: 0, False: 290k]
  ------------------
  242|      0|        return NULL;
  243|      0|    }
  244|   290k|    return realloc(ptr, new_size);
  245|   290k|}
opj_free:
  247|   384M|{
  248|   384M|    free(ptr);
  249|   384M|}
opj_malloc.c:opj_aligned_alloc_n:
   44|   998k|{
   45|   998k|    void* ptr;
   46|       |
   47|       |    /* alignment shall be power of 2 */
   48|   998k|    assert((alignment != 0U) && ((alignment & (alignment - 1U)) == 0U));
   49|       |    /* alignment shall be at least sizeof(void*) */
   50|   998k|    assert(alignment >= sizeof(void*));
   51|       |
   52|   998k|    if (size == 0U) { /* prevent implementation defined behavior of realloc */
  ------------------
  |  Branch (52:9): [True: 583, False: 997k]
  ------------------
   53|    583|        return NULL;
   54|    583|    }
   55|       |
   56|   997k|#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|   997k|    if (posix_memalign(&ptr, alignment, size)) {
  ------------------
  |  Branch (61:9): [True: 0, False: 997k]
  ------------------
   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|   997k|    return ptr;
  106|   998k|}

opj_pi_create_decode:
 1392|  6.88k|{
 1393|  6.88k|    OPJ_UINT32 numcomps = p_image->numcomps;
 1394|       |
 1395|       |    /* loop */
 1396|  6.88k|    OPJ_UINT32 pino;
 1397|  6.88k|    OPJ_UINT32 compno, resno;
 1398|       |
 1399|       |    /* to store w, h, dx and dy for all components and resolutions */
 1400|  6.88k|    OPJ_UINT32 * l_tmp_data;
 1401|  6.88k|    OPJ_UINT32 ** l_tmp_ptr;
 1402|       |
 1403|       |    /* encoding parameters to set */
 1404|  6.88k|    OPJ_UINT32 l_max_res;
 1405|  6.88k|    OPJ_UINT32 l_max_prec;
 1406|  6.88k|    OPJ_UINT32 l_tx0, l_tx1, l_ty0, l_ty1;
 1407|  6.88k|    OPJ_UINT32 l_dx_min, l_dy_min;
 1408|  6.88k|    OPJ_UINT32 l_bound;
 1409|  6.88k|    OPJ_UINT32 l_step_p, l_step_c, l_step_r, l_step_l ;
 1410|  6.88k|    OPJ_UINT32 l_data_stride;
 1411|       |
 1412|       |    /* pointers */
 1413|  6.88k|    opj_pi_iterator_t *l_pi = 00;
 1414|  6.88k|    opj_tcp_t *l_tcp = 00;
 1415|  6.88k|    const opj_tccp_t *l_tccp = 00;
 1416|  6.88k|    opj_pi_comp_t *l_current_comp = 00;
 1417|  6.88k|    opj_image_comp_t * l_img_comp = 00;
 1418|  6.88k|    opj_pi_iterator_t * l_current_pi = 00;
 1419|  6.88k|    OPJ_UINT32 * l_encoding_value_ptr = 00;
 1420|       |
 1421|       |    /* preconditions in debug */
 1422|  6.88k|    assert(p_cp != 00);
 1423|  6.88k|    assert(p_image != 00);
 1424|  6.88k|    assert(p_tile_no < p_cp->tw * p_cp->th);
 1425|       |
 1426|       |    /* initializations */
 1427|  6.88k|    l_tcp = &p_cp->tcps[p_tile_no];
 1428|  6.88k|    l_bound = l_tcp->numpocs + 1;
 1429|       |
 1430|  6.88k|    l_data_stride = 4 * OPJ_J2K_MAXRLVLS;
  ------------------
  |  |  152|  6.88k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  ------------------
 1431|  6.88k|    l_tmp_data = (OPJ_UINT32*)opj_malloc(
 1432|  6.88k|                     l_data_stride * numcomps * sizeof(OPJ_UINT32));
 1433|  6.88k|    if
 1434|  6.88k|    (! l_tmp_data) {
  ------------------
  |  Branch (1434:6): [True: 0, False: 6.88k]
  ------------------
 1435|      0|        return 00;
 1436|      0|    }
 1437|  6.88k|    l_tmp_ptr = (OPJ_UINT32**)opj_malloc(
 1438|  6.88k|                    numcomps * sizeof(OPJ_UINT32 *));
 1439|  6.88k|    if
 1440|  6.88k|    (! l_tmp_ptr) {
  ------------------
  |  Branch (1440:6): [True: 0, False: 6.88k]
  ------------------
 1441|      0|        opj_free(l_tmp_data);
 1442|      0|        return 00;
 1443|      0|    }
 1444|       |
 1445|       |    /* memory allocation for pi */
 1446|  6.88k|    l_pi = opj_pi_create(p_image, p_cp, p_tile_no, manager);
 1447|  6.88k|    if (!l_pi) {
  ------------------
  |  Branch (1447:9): [True: 0, False: 6.88k]
  ------------------
 1448|      0|        opj_free(l_tmp_data);
 1449|      0|        opj_free(l_tmp_ptr);
 1450|      0|        return 00;
 1451|      0|    }
 1452|       |
 1453|  6.88k|    l_encoding_value_ptr = l_tmp_data;
 1454|       |    /* update pointer array */
 1455|  6.88k|    for
 1456|  32.3k|    (compno = 0; compno < numcomps; ++compno) {
  ------------------
  |  Branch (1456:18): [True: 25.4k, False: 6.88k]
  ------------------
 1457|  25.4k|        l_tmp_ptr[compno] = l_encoding_value_ptr;
 1458|  25.4k|        l_encoding_value_ptr += l_data_stride;
 1459|  25.4k|    }
 1460|       |    /* get encoding parameters */
 1461|  6.88k|    opj_get_all_encoding_parameters(p_image, p_cp, p_tile_no, &l_tx0, &l_tx1,
 1462|  6.88k|                                    &l_ty0, &l_ty1, &l_dx_min, &l_dy_min, &l_max_prec, &l_max_res, l_tmp_ptr);
 1463|       |
 1464|       |    /* step calculations */
 1465|  6.88k|    l_step_p = 1;
 1466|  6.88k|    l_step_c = l_max_prec * l_step_p;
 1467|  6.88k|    l_step_r = numcomps * l_step_c;
 1468|  6.88k|    l_step_l = l_max_res * l_step_r;
 1469|       |
 1470|       |    /* set values for first packet iterator */
 1471|  6.88k|    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|  6.88k|    l_current_pi->include = 00;
 1477|  6.88k|    if (l_step_l <= (UINT_MAX / (l_tcp->numlayers + 1U))) {
  ------------------
  |  Branch (1477:9): [True: 6.87k, False: 3]
  ------------------
 1478|  6.87k|        l_current_pi->include_size = (l_tcp->numlayers + 1U) * l_step_l;
 1479|  6.87k|        l_current_pi->include = (OPJ_INT16*) opj_calloc(
 1480|  6.87k|                                    l_current_pi->include_size, sizeof(OPJ_INT16));
 1481|  6.87k|    }
 1482|       |
 1483|  6.88k|    if (!l_current_pi->include) {
  ------------------
  |  Branch (1483:9): [True: 14, False: 6.86k]
  ------------------
 1484|     14|        opj_free(l_tmp_data);
 1485|     14|        opj_free(l_tmp_ptr);
 1486|     14|        opj_pi_destroy(l_pi, l_bound);
 1487|     14|        return 00;
 1488|     14|    }
 1489|       |
 1490|       |    /* special treatment for the first packet iterator */
 1491|  6.86k|    l_current_comp = l_current_pi->comps;
 1492|  6.86k|    l_img_comp = p_image->comps;
 1493|  6.86k|    l_tccp = l_tcp->tccps;
 1494|       |
 1495|  6.86k|    l_current_pi->tx0 = l_tx0;
 1496|  6.86k|    l_current_pi->ty0 = l_ty0;
 1497|  6.86k|    l_current_pi->tx1 = l_tx1;
 1498|  6.86k|    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|  6.86k|    l_current_pi->step_p = l_step_p;
 1504|  6.86k|    l_current_pi->step_c = l_step_c;
 1505|  6.86k|    l_current_pi->step_r = l_step_r;
 1506|  6.86k|    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|  6.86k|    for
 1510|  32.2k|    (compno = 0; compno < numcomps; ++compno) {
  ------------------
  |  Branch (1510:18): [True: 25.4k, False: 6.86k]
  ------------------
 1511|  25.4k|        opj_pi_resolution_t *l_res = l_current_comp->resolutions;
 1512|  25.4k|        l_encoding_value_ptr = l_tmp_ptr[compno];
 1513|       |
 1514|  25.4k|        l_current_comp->dx = l_img_comp->dx;
 1515|  25.4k|        l_current_comp->dy = l_img_comp->dy;
 1516|       |        /* resolutions have already been initialized */
 1517|  25.4k|        for
 1518|   165k|        (resno = 0; resno < l_current_comp->numresolutions; resno++) {
  ------------------
  |  Branch (1518:21): [True: 140k, False: 25.4k]
  ------------------
 1519|   140k|            l_res->pdx = *(l_encoding_value_ptr++);
 1520|   140k|            l_res->pdy = *(l_encoding_value_ptr++);
 1521|   140k|            l_res->pw =  *(l_encoding_value_ptr++);
 1522|   140k|            l_res->ph =  *(l_encoding_value_ptr++);
 1523|   140k|            ++l_res;
 1524|   140k|        }
 1525|  25.4k|        ++l_current_comp;
 1526|  25.4k|        ++l_img_comp;
 1527|  25.4k|        ++l_tccp;
 1528|  25.4k|    }
 1529|  6.86k|    ++l_current_pi;
 1530|       |
 1531|  15.2k|    for (pino = 1 ; pino < l_bound ; ++pino) {
  ------------------
  |  Branch (1531:21): [True: 8.37k, False: 6.86k]
  ------------------
 1532|  8.37k|        l_current_comp = l_current_pi->comps;
 1533|  8.37k|        l_img_comp = p_image->comps;
 1534|  8.37k|        l_tccp = l_tcp->tccps;
 1535|       |
 1536|  8.37k|        l_current_pi->tx0 = l_tx0;
 1537|  8.37k|        l_current_pi->ty0 = l_ty0;
 1538|  8.37k|        l_current_pi->tx1 = l_tx1;
 1539|  8.37k|        l_current_pi->ty1 = l_ty1;
 1540|       |        /*l_current_pi->dx = l_dx_min;*/
 1541|       |        /*l_current_pi->dy = l_dy_min;*/
 1542|  8.37k|        l_current_pi->step_p = l_step_p;
 1543|  8.37k|        l_current_pi->step_c = l_step_c;
 1544|  8.37k|        l_current_pi->step_r = l_step_r;
 1545|  8.37k|        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.37k|        for
 1549|  40.5k|        (compno = 0; compno < numcomps; ++compno) {
  ------------------
  |  Branch (1549:22): [True: 32.1k, False: 8.37k]
  ------------------
 1550|  32.1k|            opj_pi_resolution_t *l_res = l_current_comp->resolutions;
 1551|  32.1k|            l_encoding_value_ptr = l_tmp_ptr[compno];
 1552|       |
 1553|  32.1k|            l_current_comp->dx = l_img_comp->dx;
 1554|  32.1k|            l_current_comp->dy = l_img_comp->dy;
 1555|       |            /* resolutions have already been initialized */
 1556|  32.1k|            for
 1557|   370k|            (resno = 0; resno < l_current_comp->numresolutions; resno++) {
  ------------------
  |  Branch (1557:25): [True: 337k, False: 32.1k]
  ------------------
 1558|   337k|                l_res->pdx = *(l_encoding_value_ptr++);
 1559|   337k|                l_res->pdy = *(l_encoding_value_ptr++);
 1560|   337k|                l_res->pw =  *(l_encoding_value_ptr++);
 1561|   337k|                l_res->ph =  *(l_encoding_value_ptr++);
 1562|   337k|                ++l_res;
 1563|   337k|            }
 1564|  32.1k|            ++l_current_comp;
 1565|  32.1k|            ++l_img_comp;
 1566|  32.1k|            ++l_tccp;
 1567|  32.1k|        }
 1568|       |        /* special treatment*/
 1569|  8.37k|        l_current_pi->include = (l_current_pi - 1)->include;
 1570|  8.37k|        l_current_pi->include_size = (l_current_pi - 1)->include_size;
 1571|  8.37k|        ++l_current_pi;
 1572|  8.37k|    }
 1573|  6.86k|    opj_free(l_tmp_data);
 1574|  6.86k|    l_tmp_data = 00;
 1575|  6.86k|    opj_free(l_tmp_ptr);
 1576|  6.86k|    l_tmp_ptr = 00;
 1577|  6.86k|    if
 1578|  6.86k|    (l_tcp->POC) {
  ------------------
  |  Branch (1578:6): [True: 758, False: 6.11k]
  ------------------
 1579|    758|        opj_pi_update_decode_poc(l_pi, l_tcp, l_max_prec, l_max_res);
 1580|  6.11k|    } else {
 1581|  6.11k|        opj_pi_update_decode_not_poc(l_pi, l_tcp, l_max_prec, l_max_res);
 1582|  6.11k|    }
 1583|  6.86k|    return l_pi;
 1584|  6.88k|}
opj_pi_destroy:
 2068|  6.88k|{
 2069|  6.88k|    OPJ_UINT32 compno, pino;
 2070|  6.88k|    opj_pi_iterator_t *l_current_pi = p_pi;
 2071|  6.88k|    if (p_pi) {
  ------------------
  |  Branch (2071:9): [True: 6.88k, False: 0]
  ------------------
 2072|  6.88k|        if (p_pi->include) {
  ------------------
  |  Branch (2072:13): [True: 6.86k, False: 14]
  ------------------
 2073|  6.86k|            opj_free(p_pi->include);
 2074|  6.86k|            p_pi->include = 00;
 2075|  6.86k|        }
 2076|  22.1k|        for (pino = 0; pino < p_nb_elements; ++pino) {
  ------------------
  |  Branch (2076:24): [True: 15.3k, False: 6.88k]
  ------------------
 2077|  15.3k|            if (l_current_pi->comps) {
  ------------------
  |  Branch (2077:17): [True: 15.3k, False: 0]
  ------------------
 2078|  15.3k|                opj_pi_comp_t *l_current_component = l_current_pi->comps;
 2079|  73.1k|                for (compno = 0; compno < l_current_pi->numcomps; compno++) {
  ------------------
  |  Branch (2079:34): [True: 57.8k, False: 15.3k]
  ------------------
 2080|  57.8k|                    if (l_current_component->resolutions) {
  ------------------
  |  Branch (2080:25): [True: 57.8k, False: 0]
  ------------------
 2081|  57.8k|                        opj_free(l_current_component->resolutions);
 2082|  57.8k|                        l_current_component->resolutions = 00;
 2083|  57.8k|                    }
 2084|       |
 2085|  57.8k|                    ++l_current_component;
 2086|  57.8k|                }
 2087|  15.3k|                opj_free(l_current_pi->comps);
 2088|  15.3k|                l_current_pi->comps = 0;
 2089|  15.3k|            }
 2090|  15.3k|            ++l_current_pi;
 2091|  15.3k|        }
 2092|  6.88k|        opj_free(p_pi);
 2093|  6.88k|    }
 2094|  6.88k|}
opj_pi_next:
 2132|   251M|{
 2133|   251M|    switch (pi->poc.prg) {
  ------------------
  |  Branch (2133:13): [True: 3.33k, False: 251M]
  ------------------
 2134|   141M|    case OPJ_LRCP:
  ------------------
  |  Branch (2134:5): [True: 141M, False: 109M]
  ------------------
 2135|   141M|        return opj_pi_next_lrcp(pi);
 2136|  10.7M|    case OPJ_RLCP:
  ------------------
  |  Branch (2136:5): [True: 10.7M, False: 240M]
  ------------------
 2137|  10.7M|        return opj_pi_next_rlcp(pi);
 2138|  16.8M|    case OPJ_RPCL:
  ------------------
  |  Branch (2138:5): [True: 16.8M, False: 234M]
  ------------------
 2139|  16.8M|        return opj_pi_next_rpcl(pi);
 2140|  67.0M|    case OPJ_PCRL:
  ------------------
  |  Branch (2140:5): [True: 67.0M, False: 184M]
  ------------------
 2141|  67.0M|        return opj_pi_next_pcrl(pi);
 2142|  14.9M|    case OPJ_CPRL:
  ------------------
  |  Branch (2142:5): [True: 14.9M, False: 236M]
  ------------------
 2143|  14.9M|        return opj_pi_next_cprl(pi);
 2144|      0|    case OPJ_PROG_UNKNOWN:
  ------------------
  |  Branch (2144:5): [True: 0, False: 251M]
  ------------------
 2145|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2146|   251M|    }
 2147|       |
 2148|  3.33k|    return OPJ_FALSE;
  ------------------
  |  |  118|  3.33k|#define OPJ_FALSE 0
  ------------------
 2149|   251M|}
pi.c:opj_pi_create:
 1018|  6.88k|{
 1019|       |    /* loop*/
 1020|  6.88k|    OPJ_UINT32 pino, compno;
 1021|       |    /* number of poc in the p_pi*/
 1022|  6.88k|    OPJ_UINT32 l_poc_bound;
 1023|       |
 1024|       |    /* pointers to tile coding parameters and components.*/
 1025|  6.88k|    opj_pi_iterator_t *l_pi = 00;
 1026|  6.88k|    opj_tcp_t *tcp = 00;
 1027|  6.88k|    const opj_tccp_t *tccp = 00;
 1028|       |
 1029|       |    /* current packet iterator being allocated*/
 1030|  6.88k|    opj_pi_iterator_t *l_current_pi = 00;
 1031|       |
 1032|       |    /* preconditions in debug*/
 1033|  6.88k|    assert(cp != 00);
 1034|  6.88k|    assert(image != 00);
 1035|  6.88k|    assert(tileno < cp->tw * cp->th);
 1036|       |
 1037|       |    /* initializations*/
 1038|  6.88k|    tcp = &cp->tcps[tileno];
 1039|  6.88k|    l_poc_bound = tcp->numpocs + 1;
 1040|       |
 1041|       |    /* memory allocations*/
 1042|  6.88k|    l_pi = (opj_pi_iterator_t*) opj_calloc((l_poc_bound),
 1043|  6.88k|                                           sizeof(opj_pi_iterator_t));
 1044|  6.88k|    if (!l_pi) {
  ------------------
  |  Branch (1044:9): [True: 0, False: 6.88k]
  ------------------
 1045|      0|        return NULL;
 1046|      0|    }
 1047|       |
 1048|  6.88k|    l_current_pi = l_pi;
 1049|  22.1k|    for (pino = 0; pino < l_poc_bound ; ++pino) {
  ------------------
  |  Branch (1049:20): [True: 15.3k, False: 6.88k]
  ------------------
 1050|       |
 1051|  15.3k|        l_current_pi->manager = manager;
 1052|       |
 1053|  15.3k|        l_current_pi->comps = (opj_pi_comp_t*) opj_calloc(image->numcomps,
 1054|  15.3k|                              sizeof(opj_pi_comp_t));
 1055|  15.3k|        if (! l_current_pi->comps) {
  ------------------
  |  Branch (1055:13): [True: 0, False: 15.3k]
  ------------------
 1056|      0|            opj_pi_destroy(l_pi, l_poc_bound);
 1057|      0|            return NULL;
 1058|      0|        }
 1059|       |
 1060|  15.3k|        l_current_pi->numcomps = image->numcomps;
 1061|       |
 1062|  73.1k|        for (compno = 0; compno < image->numcomps; ++compno) {
  ------------------
  |  Branch (1062:26): [True: 57.8k, False: 15.3k]
  ------------------
 1063|  57.8k|            opj_pi_comp_t *comp = &l_current_pi->comps[compno];
 1064|       |
 1065|  57.8k|            tccp = &tcp->tccps[compno];
 1066|       |
 1067|  57.8k|            comp->resolutions = (opj_pi_resolution_t*) opj_calloc(tccp->numresolutions,
 1068|  57.8k|                                sizeof(opj_pi_resolution_t));
 1069|  57.8k|            if (!comp->resolutions) {
  ------------------
  |  Branch (1069:17): [True: 0, False: 57.8k]
  ------------------
 1070|      0|                opj_pi_destroy(l_pi, l_poc_bound);
 1071|      0|                return 00;
 1072|      0|            }
 1073|       |
 1074|  57.8k|            comp->numresolutions = tccp->numresolutions;
 1075|  57.8k|        }
 1076|  15.3k|        ++l_current_pi;
 1077|  15.3k|    }
 1078|  6.88k|    return l_pi;
 1079|  6.88k|}
pi.c:opj_get_all_encoding_parameters:
  890|  6.88k|{
  891|       |    /* loop*/
  892|  6.88k|    OPJ_UINT32 compno, resno;
  893|       |
  894|       |    /* pointers*/
  895|  6.88k|    const opj_tcp_t *tcp = 00;
  896|  6.88k|    const opj_tccp_t * l_tccp = 00;
  897|  6.88k|    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|  6.88k|    OPJ_UINT32 * lResolutionPtr;
  901|       |
  902|       |    /* position in x and y of tile*/
  903|  6.88k|    OPJ_UINT32 p, q;
  904|       |
  905|       |    /* non-corrected (in regard to image offset) tile offset */
  906|  6.88k|    OPJ_UINT32 l_tx0, l_ty0;
  907|       |
  908|       |    /* preconditions in debug*/
  909|  6.88k|    assert(p_cp != 00);
  910|  6.88k|    assert(p_image != 00);
  911|  6.88k|    assert(tileno < p_cp->tw * p_cp->th);
  912|       |
  913|       |    /* initializations*/
  914|  6.88k|    tcp = &p_cp->tcps [tileno];
  915|  6.88k|    l_tccp = tcp->tccps;
  916|  6.88k|    l_img_comp = p_image->comps;
  917|       |
  918|       |    /* position in x and y of tile*/
  919|  6.88k|    p = tileno % p_cp->tw;
  920|  6.88k|    q = tileno / p_cp->tw;
  921|       |
  922|       |    /* here calculation of tx0, tx1, ty0, ty1, maxprec, l_dx and l_dy */
  923|  6.88k|    l_tx0 = p_cp->tx0 + p *
  924|  6.88k|            p_cp->tdx; /* can't be greater than p_image->x1 so won't overflow */
  925|  6.88k|    *p_tx0 = opj_uint_max(l_tx0, p_image->x0);
  926|  6.88k|    *p_tx1 = opj_uint_min(opj_uint_adds(l_tx0, p_cp->tdx), p_image->x1);
  927|  6.88k|    l_ty0 = p_cp->ty0 + q *
  928|  6.88k|            p_cp->tdy; /* can't be greater than p_image->y1 so won't overflow */
  929|  6.88k|    *p_ty0 = opj_uint_max(l_ty0, p_image->y0);
  930|  6.88k|    *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|  6.88k|    *p_max_prec = 0;
  934|  6.88k|    *p_max_res = 0;
  935|       |
  936|       |    /* take the largest value for dx_min and dy_min*/
  937|  6.88k|    *p_dx_min = 0x7fffffff;
  938|  6.88k|    *p_dy_min = 0x7fffffff;
  939|       |
  940|  32.3k|    for (compno = 0; compno < p_image->numcomps; ++compno) {
  ------------------
  |  Branch (940:22): [True: 25.4k, False: 6.88k]
  ------------------
  941|       |        /* arithmetic variables to calculate*/
  942|  25.4k|        OPJ_UINT32 l_level_no;
  943|  25.4k|        OPJ_UINT32 l_rx0, l_ry0, l_rx1, l_ry1;
  944|  25.4k|        OPJ_UINT32 l_px0, l_py0, l_px1, py1;
  945|  25.4k|        OPJ_UINT32 l_product;
  946|  25.4k|        OPJ_UINT32 l_tcx0, l_tcy0, l_tcx1, l_tcy1;
  947|  25.4k|        OPJ_UINT32 l_pdx, l_pdy, l_pw, l_ph;
  948|       |
  949|  25.4k|        lResolutionPtr = p_resolutions ? p_resolutions[compno] : NULL;
  ------------------
  |  Branch (949:26): [True: 25.4k, False: 0]
  ------------------
  950|       |
  951|  25.4k|        l_tcx0 = opj_uint_ceildiv(*p_tx0, l_img_comp->dx);
  952|  25.4k|        l_tcy0 = opj_uint_ceildiv(*p_ty0, l_img_comp->dy);
  953|  25.4k|        l_tcx1 = opj_uint_ceildiv(*p_tx1, l_img_comp->dx);
  954|  25.4k|        l_tcy1 = opj_uint_ceildiv(*p_ty1, l_img_comp->dy);
  955|       |
  956|  25.4k|        if (l_tccp->numresolutions > *p_max_res) {
  ------------------
  |  Branch (956:13): [True: 6.94k, False: 18.5k]
  ------------------
  957|  6.94k|            *p_max_res = l_tccp->numresolutions;
  958|  6.94k|        }
  959|       |
  960|       |        /* use custom size for precincts*/
  961|  25.4k|        l_level_no = l_tccp->numresolutions;
  962|   165k|        for (resno = 0; resno < l_tccp->numresolutions; ++resno) {
  ------------------
  |  Branch (962:25): [True: 140k, False: 25.4k]
  ------------------
  963|   140k|            OPJ_UINT32 l_dx, l_dy;
  964|       |
  965|   140k|            --l_level_no;
  966|       |
  967|       |            /* precinct width and height*/
  968|   140k|            l_pdx = l_tccp->prcw[resno];
  969|   140k|            l_pdy = l_tccp->prch[resno];
  970|   140k|            if (lResolutionPtr) {
  ------------------
  |  Branch (970:17): [True: 140k, False: 0]
  ------------------
  971|   140k|                *lResolutionPtr++ = l_pdx;
  972|   140k|                *lResolutionPtr++ = l_pdy;
  973|   140k|            }
  974|   140k|            if (l_pdx + l_level_no < 32 &&
  ------------------
  |  Branch (974:17): [True: 115k, False: 25.0k]
  ------------------
  975|   140k|                    l_img_comp->dx <= UINT_MAX / (1u << (l_pdx + l_level_no))) {
  ------------------
  |  Branch (975:21): [True: 102k, False: 12.6k]
  ------------------
  976|   102k|                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|   102k|                *p_dx_min = opj_uint_min(*p_dx_min, l_dx);
  979|   102k|            }
  980|   140k|            if (l_pdy + l_level_no < 32 &&
  ------------------
  |  Branch (980:17): [True: 115k, False: 25.0k]
  ------------------
  981|   140k|                    l_img_comp->dy <= UINT_MAX / (1u << (l_pdy + l_level_no))) {
  ------------------
  |  Branch (981:21): [True: 104k, False: 10.5k]
  ------------------
  982|   104k|                l_dy = l_img_comp->dy * (1u << (l_pdy + l_level_no));
  983|   104k|                *p_dy_min = opj_uint_min(*p_dy_min, l_dy);
  984|   104k|            }
  985|       |
  986|       |            /* various calculations of extents*/
  987|   140k|            l_rx0 = opj_uint_ceildivpow2(l_tcx0, l_level_no);
  988|   140k|            l_ry0 = opj_uint_ceildivpow2(l_tcy0, l_level_no);
  989|   140k|            l_rx1 = opj_uint_ceildivpow2(l_tcx1, l_level_no);
  990|   140k|            l_ry1 = opj_uint_ceildivpow2(l_tcy1, l_level_no);
  991|   140k|            l_px0 = opj_uint_floordivpow2(l_rx0, l_pdx) << l_pdx;
  992|   140k|            l_py0 = opj_uint_floordivpow2(l_ry0, l_pdy) << l_pdy;
  993|   140k|            l_px1 = opj_uint_ceildivpow2(l_rx1, l_pdx) << l_pdx;
  994|   140k|            py1 = opj_uint_ceildivpow2(l_ry1, l_pdy) << l_pdy;
  995|   140k|            l_pw = (l_rx0 == l_rx1) ? 0 : ((l_px1 - l_px0) >> l_pdx);
  ------------------
  |  Branch (995:20): [True: 40.0k, False: 100k]
  ------------------
  996|   140k|            l_ph = (l_ry0 == l_ry1) ? 0 : ((py1 - l_py0) >> l_pdy);
  ------------------
  |  Branch (996:20): [True: 43.0k, False: 97.3k]
  ------------------
  997|   140k|            if (lResolutionPtr) {
  ------------------
  |  Branch (997:17): [True: 140k, False: 0]
  ------------------
  998|   140k|                *lResolutionPtr++ = l_pw;
  999|   140k|                *lResolutionPtr++ = l_ph;
 1000|   140k|            }
 1001|   140k|            l_product = l_pw * l_ph;
 1002|       |
 1003|       |            /* update precision*/
 1004|   140k|            if (l_product > *p_max_prec) {
  ------------------
  |  Branch (1004:17): [True: 7.93k, False: 132k]
  ------------------
 1005|  7.93k|                *p_max_prec = l_product;
 1006|  7.93k|            }
 1007|       |
 1008|   140k|        }
 1009|  25.4k|        ++l_tccp;
 1010|  25.4k|        ++l_img_comp;
 1011|  25.4k|    }
 1012|  6.88k|}
pi.c:opj_pi_update_decode_poc:
 1219|    758|{
 1220|       |    /* loop*/
 1221|    758|    OPJ_UINT32 pino;
 1222|       |
 1223|       |    /* encoding parameters to set*/
 1224|    758|    OPJ_UINT32 l_bound;
 1225|       |
 1226|    758|    opj_pi_iterator_t * l_current_pi = 00;
 1227|    758|    opj_poc_t* l_current_poc = 0;
 1228|       |
 1229|    758|    OPJ_ARG_NOT_USED(p_max_res);
  ------------------
  |  |  142|    758|#define OPJ_ARG_NOT_USED(x) (void)(x)
  ------------------
 1230|       |
 1231|       |    /* preconditions in debug*/
 1232|    758|    assert(p_pi != 00);
 1233|    758|    assert(p_tcp != 00);
 1234|       |
 1235|       |    /* initializations*/
 1236|    758|    l_bound = p_tcp->numpocs + 1;
 1237|    758|    l_current_pi = p_pi;
 1238|    758|    l_current_poc = p_tcp->pocs;
 1239|       |
 1240|  9.88k|    for (pino = 0; pino < l_bound; ++pino) {
  ------------------
  |  Branch (1240:20): [True: 9.12k, False: 758]
  ------------------
 1241|  9.12k|        l_current_pi->poc.prg = l_current_poc->prg; /* Progression Order #0 */
 1242|  9.12k|        l_current_pi->first = 1;
 1243|       |
 1244|  9.12k|        l_current_pi->poc.resno0 =
 1245|  9.12k|            l_current_poc->resno0; /* Resolution Level Index #0 (Start) */
 1246|  9.12k|        l_current_pi->poc.compno0 =
 1247|  9.12k|            l_current_poc->compno0; /* Component Index #0 (Start) */
 1248|  9.12k|        l_current_pi->poc.layno0 = 0;
 1249|  9.12k|        l_current_pi->poc.precno0 = 0;
 1250|  9.12k|        l_current_pi->poc.resno1 =
 1251|  9.12k|            l_current_poc->resno1; /* Resolution Level Index #0 (End) */
 1252|  9.12k|        l_current_pi->poc.compno1 =
 1253|  9.12k|            l_current_poc->compno1; /* Component Index #0 (End) */
 1254|  9.12k|        l_current_pi->poc.layno1 = opj_uint_min(l_current_poc->layno1,
 1255|  9.12k|                                                p_tcp->numlayers); /* Layer Index #0 (End) */
 1256|  9.12k|        l_current_pi->poc.precno1 = p_max_precision;
 1257|  9.12k|        ++l_current_pi;
 1258|  9.12k|        ++l_current_poc;
 1259|  9.12k|    }
 1260|    758|}
pi.c:opj_pi_update_decode_not_poc:
 1266|  6.11k|{
 1267|       |    /* loop*/
 1268|  6.11k|    OPJ_UINT32 pino;
 1269|       |
 1270|       |    /* encoding parameters to set*/
 1271|  6.11k|    OPJ_UINT32 l_bound;
 1272|       |
 1273|  6.11k|    opj_pi_iterator_t * l_current_pi = 00;
 1274|       |    /* preconditions in debug*/
 1275|  6.11k|    assert(p_tcp != 00);
 1276|  6.11k|    assert(p_pi != 00);
 1277|       |
 1278|       |    /* initializations*/
 1279|  6.11k|    l_bound = p_tcp->numpocs + 1;
 1280|  6.11k|    l_current_pi = p_pi;
 1281|       |
 1282|  12.2k|    for (pino = 0; pino < l_bound; ++pino) {
  ------------------
  |  Branch (1282:20): [True: 6.11k, False: 6.11k]
  ------------------
 1283|  6.11k|        l_current_pi->poc.prg = p_tcp->prg;
 1284|  6.11k|        l_current_pi->first = 1;
 1285|  6.11k|        l_current_pi->poc.resno0 = 0;
 1286|  6.11k|        l_current_pi->poc.compno0 = 0;
 1287|  6.11k|        l_current_pi->poc.layno0 = 0;
 1288|  6.11k|        l_current_pi->poc.precno0 = 0;
 1289|  6.11k|        l_current_pi->poc.resno1 = p_max_res;
 1290|  6.11k|        l_current_pi->poc.compno1 = l_current_pi->numcomps;
 1291|  6.11k|        l_current_pi->poc.layno1 = p_tcp->numlayers;
 1292|  6.11k|        l_current_pi->poc.precno1 = p_max_precision;
 1293|  6.11k|        ++l_current_pi;
 1294|  6.11k|    }
 1295|  6.11k|}
pi.c:opj_pi_next_lrcp:
  238|   141M|{
  239|   141M|    opj_pi_comp_t *comp = NULL;
  240|   141M|    opj_pi_resolution_t *res = NULL;
  241|   141M|    OPJ_UINT32 index = 0;
  242|       |
  243|   141M|    if (pi->poc.compno0 >= pi->numcomps ||
  ------------------
  |  Branch (243:9): [True: 1.01k, False: 141M]
  ------------------
  244|   141M|            pi->poc.compno1 >= pi->numcomps + 1) {
  ------------------
  |  Branch (244:13): [True: 0, False: 141M]
  ------------------
  245|  1.01k|        opj_event_msg(pi->manager, EVT_ERROR,
  ------------------
  |  |   66|  1.01k|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  246|  1.01k|                      "opj_pi_next_lrcp(): invalid compno0/compno1\n");
  247|  1.01k|        return OPJ_FALSE;
  ------------------
  |  |  118|  1.01k|#define OPJ_FALSE 0
  ------------------
  248|  1.01k|    }
  249|       |
  250|   141M|    if (!pi->first) {
  ------------------
  |  Branch (250:9): [True: 141M, False: 3.36k]
  ------------------
  251|   141M|        comp = &pi->comps[pi->compno];
  252|   141M|        res = &comp->resolutions[pi->resno];
  253|   141M|        goto LABEL_SKIP;
  254|   141M|    } else {
  255|  3.36k|        pi->first = 0;
  256|  3.36k|    }
  257|       |
  258|  3.69M|    for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
  ------------------
  |  Branch (258:38): [True: 3.68M, False: 3.21k]
  ------------------
  259|  27.8M|        for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1;
  ------------------
  |  Branch (259:42): [True: 24.1M, False: 3.68M]
  ------------------
  260|  24.1M|                pi->resno++) {
  261|   104M|            for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
  ------------------
  |  Branch (261:48): [True: 80.4M, False: 24.1M]
  ------------------
  262|  80.4M|                comp = &pi->comps[pi->compno];
  263|  80.4M|                if (pi->resno >= comp->numresolutions) {
  ------------------
  |  Branch (263:21): [True: 25.0M, False: 55.4M]
  ------------------
  264|  25.0M|                    continue;
  265|  25.0M|                }
  266|  55.4M|                res = &comp->resolutions[pi->resno];
  267|  55.4M|                if (!pi->tp_on) {
  ------------------
  |  Branch (267:21): [True: 55.4M, False: 0]
  ------------------
  268|  55.4M|                    pi->poc.precno1 = res->pw * res->ph;
  269|  55.4M|                }
  270|   197M|                for (pi->precno = pi->poc.precno0; pi->precno < pi->poc.precno1; pi->precno++) {
  ------------------
  |  Branch (270:52): [True: 141M, False: 55.4M]
  ------------------
  271|   141M|                    index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno *
  272|   141M|                            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|   141M|                    if (index >= pi->include_size) {
  ------------------
  |  Branch (279:25): [True: 0, False: 141M]
  ------------------
  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|   141M|                    if (!pi->include[index]) {
  ------------------
  |  Branch (283:25): [True: 141M, False: 1.00k]
  ------------------
  284|   141M|                        pi->include[index] = 1;
  285|   141M|                        return OPJ_TRUE;
  ------------------
  |  |  117|   141M|#define OPJ_TRUE 1
  ------------------
  286|   141M|                    }
  287|   141M|LABEL_SKIP:
  288|   141M|                    ;
  289|   141M|                }
  290|  55.4M|            }
  291|  24.1M|        }
  292|  3.68M|    }
  293|       |
  294|  3.21k|    return OPJ_FALSE;
  ------------------
  |  |  118|  3.21k|#define OPJ_FALSE 0
  ------------------
  295|  3.36k|}
pi.c:opj_pi_next_rlcp:
  298|  10.7M|{
  299|  10.7M|    opj_pi_comp_t *comp = NULL;
  300|  10.7M|    opj_pi_resolution_t *res = NULL;
  301|  10.7M|    OPJ_UINT32 index = 0;
  302|       |
  303|  10.7M|    if (pi->poc.compno0 >= pi->numcomps ||
  ------------------
  |  Branch (303:9): [True: 241, False: 10.7M]
  ------------------
  304|  10.7M|            pi->poc.compno1 >= pi->numcomps + 1) {
  ------------------
  |  Branch (304:13): [True: 0, False: 10.7M]
  ------------------
  305|    241|        opj_event_msg(pi->manager, EVT_ERROR,
  ------------------
  |  |   66|    241|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  306|    241|                      "opj_pi_next_rlcp(): invalid compno0/compno1\n");
  307|    241|        return OPJ_FALSE;
  ------------------
  |  |  118|    241|#define OPJ_FALSE 0
  ------------------
  308|    241|    }
  309|       |
  310|  10.7M|    if (!pi->first) {
  ------------------
  |  Branch (310:9): [True: 10.6M, False: 588]
  ------------------
  311|  10.6M|        comp = &pi->comps[pi->compno];
  312|  10.6M|        res = &comp->resolutions[pi->resno];
  313|  10.6M|        goto LABEL_SKIP;
  314|  10.6M|    } else {
  315|    588|        pi->first = 0;
  316|    588|    }
  317|       |
  318|  5.97k|    for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) {
  ------------------
  |  Branch (318:38): [True: 5.43k, False: 538]
  ------------------
  319|  6.47M|        for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
  ------------------
  |  Branch (319:42): [True: 6.46M, False: 5.38k]
  ------------------
  320|  27.1M|            for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
  ------------------
  |  Branch (320:48): [True: 20.6M, False: 6.46M]
  ------------------
  321|  20.6M|                comp = &pi->comps[pi->compno];
  322|  20.6M|                if (pi->resno >= comp->numresolutions) {
  ------------------
  |  Branch (322:21): [True: 183k, False: 20.4M]
  ------------------
  323|   183k|                    continue;
  324|   183k|                }
  325|  20.4M|                res = &comp->resolutions[pi->resno];
  326|  20.4M|                if (!pi->tp_on) {
  ------------------
  |  Branch (326:21): [True: 20.4M, False: 0]
  ------------------
  327|  20.4M|                    pi->poc.precno1 = res->pw * res->ph;
  328|  20.4M|                }
  329|  31.1M|                for (pi->precno = pi->poc.precno0; pi->precno < pi->poc.precno1; pi->precno++) {
  ------------------
  |  Branch (329:52): [True: 10.7M, False: 20.4M]
  ------------------
  330|  10.7M|                    index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno *
  331|  10.7M|                            pi->step_c + pi->precno * pi->step_p;
  332|  10.7M|                    if (index >= pi->include_size) {
  ------------------
  |  Branch (332:25): [True: 0, False: 10.7M]
  ------------------
  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|  10.7M|                    if (!pi->include[index]) {
  ------------------
  |  Branch (336:25): [True: 10.6M, False: 1.72k]
  ------------------
  337|  10.6M|                        pi->include[index] = 1;
  338|  10.6M|                        return OPJ_TRUE;
  ------------------
  |  |  117|  10.6M|#define OPJ_TRUE 1
  ------------------
  339|  10.6M|                    }
  340|  10.7M|LABEL_SKIP:
  341|  10.7M|                    ;
  342|  10.7M|                }
  343|  20.4M|            }
  344|  6.46M|        }
  345|  5.43k|    }
  346|       |
  347|    538|    return OPJ_FALSE;
  ------------------
  |  |  118|    538|#define OPJ_FALSE 0
  ------------------
  348|    588|}
pi.c:opj_pi_next_rpcl:
  351|  16.8M|{
  352|  16.8M|    opj_pi_comp_t *comp = NULL;
  353|  16.8M|    opj_pi_resolution_t *res = NULL;
  354|  16.8M|    OPJ_UINT32 index = 0;
  355|       |
  356|  16.8M|    if (pi->poc.compno0 >= pi->numcomps ||
  ------------------
  |  Branch (356:9): [True: 110, False: 16.8M]
  ------------------
  357|  16.8M|            pi->poc.compno1 >= pi->numcomps + 1) {
  ------------------
  |  Branch (357:13): [True: 0, False: 16.8M]
  ------------------
  358|    110|        opj_event_msg(pi->manager, EVT_ERROR,
  ------------------
  |  |   66|    110|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  359|    110|                      "opj_pi_next_rpcl(): invalid compno0/compno1\n");
  360|    110|        return OPJ_FALSE;
  ------------------
  |  |  118|    110|#define OPJ_FALSE 0
  ------------------
  361|    110|    }
  362|       |
  363|  16.8M|    if (!pi->first) {
  ------------------
  |  Branch (363:9): [True: 16.8M, False: 1.93k]
  ------------------
  364|  16.8M|        goto LABEL_SKIP;
  365|  16.8M|    } else {
  366|  1.93k|        OPJ_UINT32 compno, resno;
  367|  1.93k|        pi->first = 0;
  368|  1.93k|        pi->dx = 0;
  369|  1.93k|        pi->dy = 0;
  370|  11.6k|        for (compno = 0; compno < pi->numcomps; compno++) {
  ------------------
  |  Branch (370:26): [True: 9.75k, False: 1.93k]
  ------------------
  371|  9.75k|            comp = &pi->comps[compno];
  372|  79.5k|            for (resno = 0; resno < comp->numresolutions; resno++) {
  ------------------
  |  Branch (372:29): [True: 69.7k, False: 9.75k]
  ------------------
  373|  69.7k|                OPJ_UINT32 dx, dy;
  374|  69.7k|                res = &comp->resolutions[resno];
  375|  69.7k|                if (res->pdx + comp->numresolutions - 1 - resno < 32 &&
  ------------------
  |  Branch (375:21): [True: 53.6k, False: 16.0k]
  ------------------
  376|  69.7k|                        comp->dx <= UINT_MAX / (1u << (res->pdx + comp->numresolutions - 1 - resno))) {
  ------------------
  |  Branch (376:25): [True: 49.2k, False: 4.43k]
  ------------------
  377|  49.2k|                    dx = comp->dx * (1u << (res->pdx + comp->numresolutions - 1 - resno));
  378|  49.2k|                    pi->dx = !pi->dx ? dx : opj_uint_min(pi->dx, dx);
  ------------------
  |  Branch (378:30): [True: 1.93k, False: 47.3k]
  ------------------
  379|  49.2k|                }
  380|  69.7k|                if (res->pdy + comp->numresolutions - 1 - resno < 32 &&
  ------------------
  |  Branch (380:21): [True: 53.6k, False: 16.0k]
  ------------------
  381|  69.7k|                        comp->dy <= UINT_MAX / (1u << (res->pdy + comp->numresolutions - 1 - resno))) {
  ------------------
  |  Branch (381:25): [True: 49.2k, False: 4.49k]
  ------------------
  382|  49.2k|                    dy = comp->dy * (1u << (res->pdy + comp->numresolutions - 1 - resno));
  383|  49.2k|                    pi->dy = !pi->dy ? dy : opj_uint_min(pi->dy, dy);
  ------------------
  |  Branch (383:30): [True: 1.93k, False: 47.2k]
  ------------------
  384|  49.2k|                }
  385|  69.7k|            }
  386|  9.75k|        }
  387|  1.93k|        if (pi->dx == 0 || pi->dy == 0) {
  ------------------
  |  Branch (387:13): [True: 0, False: 1.93k]
  |  Branch (387:28): [True: 0, False: 1.93k]
  ------------------
  388|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  389|      0|        }
  390|  1.93k|    }
  391|  1.93k|    if (!pi->tp_on) {
  ------------------
  |  Branch (391:9): [True: 1.93k, False: 0]
  ------------------
  392|  1.93k|        pi->poc.ty0 = pi->ty0;
  393|  1.93k|        pi->poc.tx0 = pi->tx0;
  394|  1.93k|        pi->poc.ty1 = pi->ty1;
  395|  1.93k|        pi->poc.tx1 = pi->tx1;
  396|  1.93k|    }
  397|  32.7k|    for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) {
  ------------------
  |  Branch (397:38): [True: 30.9k, False: 1.86k]
  ------------------
  398|   471k|        for (pi->y = (OPJ_UINT32)pi->poc.ty0; pi->y < (OPJ_UINT32)pi->poc.ty1;
  ------------------
  |  Branch (398:47): [True: 440k, False: 30.8k]
  ------------------
  399|   440k|                pi->y += (pi->dy - (pi->y % pi->dy))) {
  400|  12.3M|            for (pi->x = (OPJ_UINT32)pi->poc.tx0; pi->x < (OPJ_UINT32)pi->poc.tx1;
  ------------------
  |  Branch (400:51): [True: 11.9M, False: 440k]
  ------------------
  401|  11.9M|                    pi->x += (pi->dx - (pi->x % pi->dx))) {
  402|  73.1M|                for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
  ------------------
  |  Branch (402:52): [True: 61.1M, False: 11.9M]
  ------------------
  403|  61.1M|                    OPJ_UINT32 levelno;
  404|  61.1M|                    OPJ_UINT32 trx0, try0;
  405|  61.1M|                    OPJ_UINT32  trx1, try1;
  406|  61.1M|                    OPJ_UINT32  rpx, rpy;
  407|  61.1M|                    OPJ_UINT32  prci, prcj;
  408|  61.1M|                    comp = &pi->comps[pi->compno];
  409|  61.1M|                    if (pi->resno >= comp->numresolutions) {
  ------------------
  |  Branch (409:25): [True: 60.6M, False: 541k]
  ------------------
  410|  60.6M|                        continue;
  411|  60.6M|                    }
  412|   541k|                    res = &comp->resolutions[pi->resno];
  413|   541k|                    levelno = comp->numresolutions - 1 - pi->resno;
  414|       |
  415|   541k|                    if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << levelno) >> levelno) != comp->dx ||
  ------------------
  |  Branch (415:25): [True: 0, False: 541k]
  ------------------
  416|   541k|                            (OPJ_UINT32)(((OPJ_UINT64)comp->dy << levelno) >> levelno) != comp->dy) {
  ------------------
  |  Branch (416:29): [True: 0, False: 541k]
  ------------------
  417|      0|                        continue;
  418|      0|                    }
  419|       |
  420|   541k|                    trx0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx0,
  421|   541k|                                                         ((OPJ_UINT64)comp->dx << levelno));
  422|   541k|                    try0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty0,
  423|   541k|                                                         ((OPJ_UINT64)comp->dy << levelno));
  424|   541k|                    trx1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx1,
  425|   541k|                                                         ((OPJ_UINT64)comp->dx << levelno));
  426|   541k|                    try1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty1,
  427|   541k|                                                         ((OPJ_UINT64)comp->dy << levelno));
  428|   541k|                    rpx = res->pdx + levelno;
  429|   541k|                    rpy = res->pdy + levelno;
  430|       |
  431|   541k|                    if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << rpx) >> rpx) != comp->dx ||
  ------------------
  |  Branch (431:25): [True: 0, False: 541k]
  ------------------
  432|   541k|                            (OPJ_UINT32)(((OPJ_UINT64)comp->dy << rpy) >> rpy) != comp->dy) {
  ------------------
  |  Branch (432:29): [True: 0, False: 541k]
  ------------------
  433|      0|                        continue;
  434|      0|                    }
  435|       |
  436|       |                    /* See ISO-15441. B.12.1.3 Resolution level-position-component-layer progression */
  437|   541k|                    if (!(((OPJ_UINT64)pi->y % ((OPJ_UINT64)comp->dy << rpy) == 0) ||
  ------------------
  |  Branch (437:27): [True: 109k, False: 432k]
  ------------------
  438|   541k|                            ((pi->y == pi->ty0) &&
  ------------------
  |  Branch (438:30): [True: 68.6k, False: 363k]
  ------------------
  439|   432k|                             (((OPJ_UINT64)try0 << levelno) % ((OPJ_UINT64)1U << rpy))))) {
  ------------------
  |  Branch (439:30): [True: 67.4k, False: 1.21k]
  ------------------
  440|   365k|                        continue;
  441|   365k|                    }
  442|   176k|                    if (!(((OPJ_UINT64)pi->x % ((OPJ_UINT64)comp->dx << rpx) == 0) ||
  ------------------
  |  Branch (442:27): [True: 55.6k, False: 120k]
  ------------------
  443|   176k|                            ((pi->x == pi->tx0) &&
  ------------------
  |  Branch (443:30): [True: 11.8k, False: 109k]
  ------------------
  444|   120k|                             (((OPJ_UINT64)trx0 << levelno) % ((OPJ_UINT64)1U << rpx))))) {
  ------------------
  |  Branch (444:30): [True: 11.4k, False: 348]
  ------------------
  445|   109k|                        continue;
  446|   109k|                    }
  447|       |
  448|  67.1k|                    if ((res->pw == 0) || (res->ph == 0)) {
  ------------------
  |  Branch (448:25): [True: 6.78k, False: 60.3k]
  |  Branch (448:43): [True: 3.08k, False: 57.2k]
  ------------------
  449|  9.87k|                        continue;
  450|  9.87k|                    }
  451|       |
  452|  57.2k|                    if ((trx0 == trx1) || (try0 == try1)) {
  ------------------
  |  Branch (452:25): [True: 0, False: 57.2k]
  |  Branch (452:43): [True: 0, False: 57.2k]
  ------------------
  453|      0|                        continue;
  454|      0|                    }
  455|       |
  456|  57.2k|                    prci = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->x,
  457|  57.2k|                                                 ((OPJ_UINT64)comp->dx << levelno)), res->pdx)
  458|  57.2k|                           - opj_uint_floordivpow2(trx0, res->pdx);
  459|  57.2k|                    prcj = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->y,
  460|  57.2k|                                                 ((OPJ_UINT64)comp->dy << levelno)), res->pdy)
  461|  57.2k|                           - opj_uint_floordivpow2(try0, res->pdy);
  462|  57.2k|                    pi->precno = prci + prcj * res->pw;
  463|  17.0M|                    for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
  ------------------
  |  Branch (463:54): [True: 17.0M, False: 57.1k]
  ------------------
  464|  17.0M|                        index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno *
  465|  17.0M|                                pi->step_c + pi->precno * pi->step_p;
  466|  17.0M|                        if (index >= pi->include_size) {
  ------------------
  |  Branch (466:29): [True: 0, False: 17.0M]
  ------------------
  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|  17.0M|                        if (!pi->include[index]) {
  ------------------
  |  Branch (470:29): [True: 16.8M, False: 159k]
  ------------------
  471|  16.8M|                            pi->include[index] = 1;
  472|  16.8M|                            return OPJ_TRUE;
  ------------------
  |  |  117|  16.8M|#define OPJ_TRUE 1
  ------------------
  473|  16.8M|                        }
  474|  17.0M|LABEL_SKIP:
  475|  17.0M|                        ;
  476|  17.0M|                    }
  477|  57.2k|                }
  478|  11.9M|            }
  479|   440k|        }
  480|  30.9k|    }
  481|       |
  482|  1.86k|    return OPJ_FALSE;
  ------------------
  |  |  118|  1.86k|#define OPJ_FALSE 0
  ------------------
  483|  1.93k|}
pi.c:opj_pi_next_pcrl:
  486|  67.0M|{
  487|  67.0M|    opj_pi_comp_t *comp = NULL;
  488|  67.0M|    opj_pi_resolution_t *res = NULL;
  489|  67.0M|    OPJ_UINT32 index = 0;
  490|       |
  491|  67.0M|    if (pi->poc.compno0 >= pi->numcomps ||
  ------------------
  |  Branch (491:9): [True: 1.65k, False: 67.0M]
  ------------------
  492|  67.0M|            pi->poc.compno1 >= pi->numcomps + 1) {
  ------------------
  |  Branch (492:13): [True: 0, False: 67.0M]
  ------------------
  493|  1.65k|        opj_event_msg(pi->manager, EVT_ERROR,
  ------------------
  |  |   66|  1.65k|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  494|  1.65k|                      "opj_pi_next_pcrl(): invalid compno0/compno1\n");
  495|  1.65k|        return OPJ_FALSE;
  ------------------
  |  |  118|  1.65k|#define OPJ_FALSE 0
  ------------------
  496|  1.65k|    }
  497|       |
  498|  67.0M|    if (!pi->first) {
  ------------------
  |  Branch (498:9): [True: 67.0M, False: 1.99k]
  ------------------
  499|  67.0M|        comp = &pi->comps[pi->compno];
  500|  67.0M|        goto LABEL_SKIP;
  501|  67.0M|    } else {
  502|  1.99k|        OPJ_UINT32 compno, resno;
  503|  1.99k|        pi->first = 0;
  504|  1.99k|        pi->dx = 0;
  505|  1.99k|        pi->dy = 0;
  506|  9.55k|        for (compno = 0; compno < pi->numcomps; compno++) {
  ------------------
  |  Branch (506:26): [True: 7.55k, False: 1.99k]
  ------------------
  507|  7.55k|            comp = &pi->comps[compno];
  508|  52.6k|            for (resno = 0; resno < comp->numresolutions; resno++) {
  ------------------
  |  Branch (508:29): [True: 45.0k, False: 7.55k]
  ------------------
  509|  45.0k|                OPJ_UINT32 dx, dy;
  510|  45.0k|                res = &comp->resolutions[resno];
  511|  45.0k|                if (res->pdx + comp->numresolutions - 1 - resno < 32 &&
  ------------------
  |  Branch (511:21): [True: 36.6k, False: 8.47k]
  ------------------
  512|  45.0k|                        comp->dx <= UINT_MAX / (1u << (res->pdx + comp->numresolutions - 1 - resno))) {
  ------------------
  |  Branch (512:25): [True: 31.0k, False: 5.55k]
  ------------------
  513|  31.0k|                    dx = comp->dx * (1u << (res->pdx + comp->numresolutions - 1 - resno));
  514|  31.0k|                    pi->dx = !pi->dx ? dx : opj_uint_min(pi->dx, dx);
  ------------------
  |  Branch (514:30): [True: 1.99k, False: 29.0k]
  ------------------
  515|  31.0k|                }
  516|  45.0k|                if (res->pdy + comp->numresolutions - 1 - resno < 32 &&
  ------------------
  |  Branch (516:21): [True: 36.6k, False: 8.47k]
  ------------------
  517|  45.0k|                        comp->dy <= UINT_MAX / (1u << (res->pdy + comp->numresolutions - 1 - resno))) {
  ------------------
  |  Branch (517:25): [True: 33.0k, False: 3.52k]
  ------------------
  518|  33.0k|                    dy = comp->dy * (1u << (res->pdy + comp->numresolutions - 1 - resno));
  519|  33.0k|                    pi->dy = !pi->dy ? dy : opj_uint_min(pi->dy, dy);
  ------------------
  |  Branch (519:30): [True: 1.99k, False: 31.1k]
  ------------------
  520|  33.0k|                }
  521|  45.0k|            }
  522|  7.55k|        }
  523|  1.99k|        if (pi->dx == 0 || pi->dy == 0) {
  ------------------
  |  Branch (523:13): [True: 0, False: 1.99k]
  |  Branch (523:28): [True: 0, False: 1.99k]
  ------------------
  524|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  525|      0|        }
  526|  1.99k|    }
  527|  1.99k|    if (!pi->tp_on) {
  ------------------
  |  Branch (527:9): [True: 1.99k, False: 0]
  ------------------
  528|  1.99k|        pi->poc.ty0 = pi->ty0;
  529|  1.99k|        pi->poc.tx0 = pi->tx0;
  530|  1.99k|        pi->poc.ty1 = pi->ty1;
  531|  1.99k|        pi->poc.tx1 = pi->tx1;
  532|  1.99k|    }
  533|  6.53k|    for (pi->y = (OPJ_UINT32)pi->poc.ty0; pi->y < (OPJ_UINT32)pi->poc.ty1;
  ------------------
  |  Branch (533:43): [True: 4.61k, False: 1.92k]
  ------------------
  534|  4.61k|            pi->y += (pi->dy - (pi->y % pi->dy))) {
  535|  42.2k|        for (pi->x = (OPJ_UINT32)pi->poc.tx0; pi->x < (OPJ_UINT32)pi->poc.tx1;
  ------------------
  |  Branch (535:47): [True: 37.7k, False: 4.53k]
  ------------------
  536|  37.7k|                pi->x += (pi->dx - (pi->x % pi->dx))) {
  537|   267k|            for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
  ------------------
  |  Branch (537:48): [True: 229k, False: 37.6k]
  ------------------
  538|   229k|                comp = &pi->comps[pi->compno];
  539|   229k|                for (pi->resno = pi->poc.resno0;
  540|   567k|                        pi->resno < opj_uint_min(pi->poc.resno1, comp->numresolutions); pi->resno++) {
  ------------------
  |  Branch (540:25): [True: 337k, False: 229k]
  ------------------
  541|   337k|                    OPJ_UINT32 levelno;
  542|   337k|                    OPJ_UINT32 trx0, try0;
  543|   337k|                    OPJ_UINT32 trx1, try1;
  544|   337k|                    OPJ_UINT32 rpx, rpy;
  545|   337k|                    OPJ_UINT32 prci, prcj;
  546|   337k|                    res = &comp->resolutions[pi->resno];
  547|   337k|                    levelno = comp->numresolutions - 1 - pi->resno;
  548|       |
  549|   337k|                    if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << levelno) >> levelno) != comp->dx ||
  ------------------
  |  Branch (549:25): [True: 0, False: 337k]
  ------------------
  550|   337k|                            (OPJ_UINT32)(((OPJ_UINT64)comp->dy << levelno) >> levelno) != comp->dy) {
  ------------------
  |  Branch (550:29): [True: 0, False: 337k]
  ------------------
  551|      0|                        continue;
  552|      0|                    }
  553|       |
  554|   337k|                    trx0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx0,
  555|   337k|                                                         ((OPJ_UINT64)comp->dx << levelno));
  556|   337k|                    try0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty0,
  557|   337k|                                                         ((OPJ_UINT64)comp->dy << levelno));
  558|   337k|                    trx1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx1,
  559|   337k|                                                         ((OPJ_UINT64)comp->dx << levelno));
  560|   337k|                    try1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty1,
  561|   337k|                                                         ((OPJ_UINT64)comp->dy << levelno));
  562|   337k|                    rpx = res->pdx + levelno;
  563|   337k|                    rpy = res->pdy + levelno;
  564|       |
  565|   337k|                    if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << rpx) >> rpx) != comp->dx ||
  ------------------
  |  Branch (565:25): [True: 0, False: 337k]
  ------------------
  566|   337k|                            (OPJ_UINT32)(((OPJ_UINT64)comp->dy << rpy) >> rpy) != comp->dy) {
  ------------------
  |  Branch (566:29): [True: 0, False: 337k]
  ------------------
  567|      0|                        continue;
  568|      0|                    }
  569|       |
  570|       |                    /* See ISO-15441. B.12.1.4 Position-component-resolution level-layer progression */
  571|   337k|                    if (!(((OPJ_UINT64)pi->y % ((OPJ_UINT64)comp->dy << rpy) == 0) ||
  ------------------
  |  Branch (571:27): [True: 51.0k, False: 286k]
  ------------------
  572|   337k|                            ((pi->y == pi->ty0) &&
  ------------------
  |  Branch (572:30): [True: 51.8k, False: 234k]
  ------------------
  573|   286k|                             (((OPJ_UINT64)try0 << levelno) % ((OPJ_UINT64)1U << rpy))))) {
  ------------------
  |  Branch (573:30): [True: 50.9k, False: 908]
  ------------------
  574|   235k|                        continue;
  575|   235k|                    }
  576|   101k|                    if (!(((OPJ_UINT64)pi->x % ((OPJ_UINT64)comp->dx << rpx) == 0) ||
  ------------------
  |  Branch (576:27): [True: 22.6k, False: 79.3k]
  ------------------
  577|   101k|                            ((pi->x == pi->tx0) &&
  ------------------
  |  Branch (577:30): [True: 4.66k, False: 74.6k]
  ------------------
  578|  79.3k|                             (((OPJ_UINT64)trx0 << levelno) % ((OPJ_UINT64)1U << rpx))))) {
  ------------------
  |  Branch (578:30): [True: 4.34k, False: 318]
  ------------------
  579|  74.9k|                        continue;
  580|  74.9k|                    }
  581|       |
  582|  26.9k|                    if ((res->pw == 0) || (res->ph == 0)) {
  ------------------
  |  Branch (582:25): [True: 2.19k, False: 24.7k]
  |  Branch (582:43): [True: 1.55k, False: 23.1k]
  ------------------
  583|  3.75k|                        continue;
  584|  3.75k|                    }
  585|       |
  586|  23.1k|                    if ((trx0 == trx1) || (try0 == try1)) {
  ------------------
  |  Branch (586:25): [True: 0, False: 23.1k]
  |  Branch (586:43): [True: 0, False: 23.1k]
  ------------------
  587|      0|                        continue;
  588|      0|                    }
  589|       |
  590|  23.1k|                    prci = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->x,
  591|  23.1k|                                                 ((OPJ_UINT64)comp->dx << levelno)), res->pdx)
  592|  23.1k|                           - opj_uint_floordivpow2(trx0, res->pdx);
  593|  23.1k|                    prcj = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->y,
  594|  23.1k|                                                 ((OPJ_UINT64)comp->dy << levelno)), res->pdy)
  595|  23.1k|                           - opj_uint_floordivpow2(try0, res->pdy);
  596|  23.1k|                    pi->precno = prci + prcj * res->pw;
  597|  67.2M|                    for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
  ------------------
  |  Branch (597:54): [True: 67.2M, False: 23.1k]
  ------------------
  598|  67.2M|                        index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno *
  599|  67.2M|                                pi->step_c + pi->precno * pi->step_p;
  600|  67.2M|                        if (index >= pi->include_size) {
  ------------------
  |  Branch (600:29): [True: 0, False: 67.2M]
  ------------------
  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|  67.2M|                        if (!pi->include[index]) {
  ------------------
  |  Branch (604:29): [True: 67.0M, False: 125k]
  ------------------
  605|  67.0M|                            pi->include[index] = 1;
  606|  67.0M|                            return OPJ_TRUE;
  ------------------
  |  |  117|  67.0M|#define OPJ_TRUE 1
  ------------------
  607|  67.0M|                        }
  608|  67.2M|LABEL_SKIP:
  609|  67.2M|                        ;
  610|  67.2M|                    }
  611|  23.1k|                }
  612|   229k|            }
  613|  37.7k|        }
  614|  4.61k|    }
  615|       |
  616|  1.92k|    return OPJ_FALSE;
  ------------------
  |  |  118|  1.92k|#define OPJ_FALSE 0
  ------------------
  617|  1.99k|}
pi.c:opj_pi_next_cprl:
  620|  14.9M|{
  621|  14.9M|    opj_pi_comp_t *comp = NULL;
  622|  14.9M|    opj_pi_resolution_t *res = NULL;
  623|  14.9M|    OPJ_UINT32 index = 0;
  624|       |
  625|  14.9M|    if (pi->poc.compno0 >= pi->numcomps ||
  ------------------
  |  Branch (625:9): [True: 173, False: 14.9M]
  ------------------
  626|  14.9M|            pi->poc.compno1 >= pi->numcomps + 1) {
  ------------------
  |  Branch (626:13): [True: 0, False: 14.9M]
  ------------------
  627|    173|        opj_event_msg(pi->manager, EVT_ERROR,
  ------------------
  |  |   66|    173|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  628|    173|                      "opj_pi_next_cprl(): invalid compno0/compno1\n");
  629|    173|        return OPJ_FALSE;
  ------------------
  |  |  118|    173|#define OPJ_FALSE 0
  ------------------
  630|    173|    }
  631|       |
  632|  14.9M|    if (!pi->first) {
  ------------------
  |  Branch (632:9): [True: 14.9M, False: 683]
  ------------------
  633|  14.9M|        comp = &pi->comps[pi->compno];
  634|  14.9M|        goto LABEL_SKIP;
  635|  14.9M|    } else {
  636|    683|        pi->first = 0;
  637|    683|    }
  638|       |
  639|  2.40k|    for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
  ------------------
  |  Branch (639:40): [True: 1.78k, False: 628]
  ------------------
  640|  1.78k|        OPJ_UINT32 resno;
  641|  1.78k|        comp = &pi->comps[pi->compno];
  642|  1.78k|        pi->dx = 0;
  643|  1.78k|        pi->dy = 0;
  644|  26.1k|        for (resno = 0; resno < comp->numresolutions; resno++) {
  ------------------
  |  Branch (644:25): [True: 24.3k, False: 1.78k]
  ------------------
  645|  24.3k|            OPJ_UINT32 dx, dy;
  646|  24.3k|            res = &comp->resolutions[resno];
  647|  24.3k|            if (res->pdx + comp->numresolutions - 1 - resno < 32 &&
  ------------------
  |  Branch (647:17): [True: 16.1k, False: 8.14k]
  ------------------
  648|  24.3k|                    comp->dx <= UINT_MAX / (1u << (res->pdx + comp->numresolutions - 1 - resno))) {
  ------------------
  |  Branch (648:21): [True: 13.2k, False: 2.93k]
  ------------------
  649|  13.2k|                dx = comp->dx * (1u << (res->pdx + comp->numresolutions - 1 - resno));
  650|  13.2k|                pi->dx = !pi->dx ? dx : opj_uint_min(pi->dx, dx);
  ------------------
  |  Branch (650:26): [True: 1.78k, False: 11.4k]
  ------------------
  651|  13.2k|            }
  652|  24.3k|            if (res->pdy + comp->numresolutions - 1 - resno < 32 &&
  ------------------
  |  Branch (652:17): [True: 16.1k, False: 8.14k]
  ------------------
  653|  24.3k|                    comp->dy <= UINT_MAX / (1u << (res->pdy + comp->numresolutions - 1 - resno))) {
  ------------------
  |  Branch (653:21): [True: 14.2k, False: 1.92k]
  ------------------
  654|  14.2k|                dy = comp->dy * (1u << (res->pdy + comp->numresolutions - 1 - resno));
  655|  14.2k|                pi->dy = !pi->dy ? dy : opj_uint_min(pi->dy, dy);
  ------------------
  |  Branch (655:26): [True: 1.78k, False: 12.4k]
  ------------------
  656|  14.2k|            }
  657|  24.3k|        }
  658|  1.78k|        if (pi->dx == 0 || pi->dy == 0) {
  ------------------
  |  Branch (658:13): [True: 0, False: 1.78k]
  |  Branch (658:28): [True: 0, False: 1.78k]
  ------------------
  659|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  660|      0|        }
  661|  1.78k|        if (!pi->tp_on) {
  ------------------
  |  Branch (661:13): [True: 1.78k, False: 0]
  ------------------
  662|  1.78k|            pi->poc.ty0 = pi->ty0;
  663|  1.78k|            pi->poc.tx0 = pi->tx0;
  664|  1.78k|            pi->poc.ty1 = pi->ty1;
  665|  1.78k|            pi->poc.tx1 = pi->tx1;
  666|  1.78k|        }
  667|  7.95k|        for (pi->y = (OPJ_UINT32)pi->poc.ty0; pi->y < (OPJ_UINT32)pi->poc.ty1;
  ------------------
  |  Branch (667:47): [True: 6.22k, False: 1.72k]
  ------------------
  668|  6.22k|                pi->y += (pi->dy - (pi->y % pi->dy))) {
  669|  90.8k|            for (pi->x = (OPJ_UINT32)pi->poc.tx0; pi->x < (OPJ_UINT32)pi->poc.tx1;
  ------------------
  |  Branch (669:51): [True: 84.7k, False: 6.17k]
  ------------------
  670|  84.7k|                    pi->x += (pi->dx - (pi->x % pi->dx))) {
  671|  84.7k|                for (pi->resno = pi->poc.resno0;
  672|   274k|                        pi->resno < opj_uint_min(pi->poc.resno1, comp->numresolutions); pi->resno++) {
  ------------------
  |  Branch (672:25): [True: 189k, False: 84.6k]
  ------------------
  673|   189k|                    OPJ_UINT32 levelno;
  674|   189k|                    OPJ_UINT32 trx0, try0;
  675|   189k|                    OPJ_UINT32 trx1, try1;
  676|   189k|                    OPJ_UINT32 rpx, rpy;
  677|   189k|                    OPJ_UINT32 prci, prcj;
  678|   189k|                    res = &comp->resolutions[pi->resno];
  679|   189k|                    levelno = comp->numresolutions - 1 - pi->resno;
  680|       |
  681|   189k|                    if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << levelno) >> levelno) != comp->dx ||
  ------------------
  |  Branch (681:25): [True: 0, False: 189k]
  ------------------
  682|   189k|                            (OPJ_UINT32)(((OPJ_UINT64)comp->dy << levelno) >> levelno) != comp->dy) {
  ------------------
  |  Branch (682:29): [True: 0, False: 189k]
  ------------------
  683|      0|                        continue;
  684|      0|                    }
  685|       |
  686|   189k|                    trx0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx0,
  687|   189k|                                                         ((OPJ_UINT64)comp->dx << levelno));
  688|   189k|                    try0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty0,
  689|   189k|                                                         ((OPJ_UINT64)comp->dy << levelno));
  690|   189k|                    trx1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx1,
  691|   189k|                                                         ((OPJ_UINT64)comp->dx << levelno));
  692|   189k|                    try1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty1,
  693|   189k|                                                         ((OPJ_UINT64)comp->dy << levelno));
  694|   189k|                    rpx = res->pdx + levelno;
  695|   189k|                    rpy = res->pdy + levelno;
  696|       |
  697|   189k|                    if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << rpx) >> rpx) != comp->dx ||
  ------------------
  |  Branch (697:25): [True: 0, False: 189k]
  ------------------
  698|   189k|                            (OPJ_UINT32)(((OPJ_UINT64)comp->dy << rpy) >> rpy) != comp->dy) {
  ------------------
  |  Branch (698:29): [True: 0, False: 189k]
  ------------------
  699|      0|                        continue;
  700|      0|                    }
  701|       |
  702|       |                    /* See ISO-15441. B.12.1.5 Component-position-resolution level-layer progression */
  703|   189k|                    if (!(((OPJ_UINT64)pi->y % ((OPJ_UINT64)comp->dy << rpy) == 0) ||
  ------------------
  |  Branch (703:27): [True: 66.7k, False: 122k]
  ------------------
  704|   189k|                            ((pi->y == pi->ty0) &&
  ------------------
  |  Branch (704:30): [True: 89.0k, False: 33.7k]
  ------------------
  705|   122k|                             (((OPJ_UINT64)try0 << levelno) % ((OPJ_UINT64)1U << rpy))))) {
  ------------------
  |  Branch (705:30): [True: 88.6k, False: 400]
  ------------------
  706|  34.1k|                        continue;
  707|  34.1k|                    }
  708|   155k|                    if (!(((OPJ_UINT64)pi->x % ((OPJ_UINT64)comp->dx << rpx) == 0) ||
  ------------------
  |  Branch (708:27): [True: 94.7k, False: 60.6k]
  ------------------
  709|   155k|                            ((pi->x == pi->tx0) &&
  ------------------
  |  Branch (709:30): [True: 11.5k, False: 49.0k]
  ------------------
  710|  60.6k|                             (((OPJ_UINT64)trx0 << levelno) % ((OPJ_UINT64)1U << rpx))))) {
  ------------------
  |  Branch (710:30): [True: 11.2k, False: 291]
  ------------------
  711|  49.3k|                        continue;
  712|  49.3k|                    }
  713|       |
  714|   105k|                    if ((res->pw == 0) || (res->ph == 0)) {
  ------------------
  |  Branch (714:25): [True: 8.75k, False: 97.2k]
  |  Branch (714:43): [True: 4.12k, False: 93.0k]
  ------------------
  715|  12.8k|                        continue;
  716|  12.8k|                    }
  717|       |
  718|  93.0k|                    if ((trx0 == trx1) || (try0 == try1)) {
  ------------------
  |  Branch (718:25): [True: 0, False: 93.0k]
  |  Branch (718:43): [True: 0, False: 93.0k]
  ------------------
  719|      0|                        continue;
  720|      0|                    }
  721|       |
  722|  93.0k|                    prci = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->x,
  723|  93.0k|                                                 ((OPJ_UINT64)comp->dx << levelno)), res->pdx)
  724|  93.0k|                           - opj_uint_floordivpow2(trx0, res->pdx);
  725|  93.0k|                    prcj = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->y,
  726|  93.0k|                                                 ((OPJ_UINT64)comp->dy << levelno)), res->pdy)
  727|  93.0k|                           - opj_uint_floordivpow2(try0, res->pdy);
  728|  93.0k|                    pi->precno = (OPJ_UINT32)(prci + prcj * res->pw);
  729|  15.0M|                    for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
  ------------------
  |  Branch (729:54): [True: 14.9M, False: 93.0k]
  ------------------
  730|  14.9M|                        index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno *
  731|  14.9M|                                pi->step_c + pi->precno * pi->step_p;
  732|  14.9M|                        if (index >= pi->include_size) {
  ------------------
  |  Branch (732:29): [True: 0, False: 14.9M]
  ------------------
  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|  14.9M|                        if (!pi->include[index]) {
  ------------------
  |  Branch (736:29): [True: 14.9M, False: 11.3k]
  ------------------
  737|  14.9M|                            pi->include[index] = 1;
  738|  14.9M|                            return OPJ_TRUE;
  ------------------
  |  |  117|  14.9M|#define OPJ_TRUE 1
  ------------------
  739|  14.9M|                        }
  740|  14.9M|LABEL_SKIP:
  741|  14.9M|                        ;
  742|  14.9M|                    }
  743|  93.0k|                }
  744|  84.7k|            }
  745|  6.22k|        }
  746|  1.78k|    }
  747|       |
  748|    628|    return OPJ_FALSE;
  ------------------
  |  |  118|    628|#define OPJ_FALSE 0
  ------------------
  749|    683|}

opj_sparse_array_int32_create:
   49|  16.0k|{
   50|  16.0k|    opj_sparse_array_int32_t* sa;
   51|       |
   52|  16.0k|    if (width == 0 || height == 0 || block_width == 0 || block_height == 0) {
  ------------------
  |  Branch (52:9): [True: 0, False: 16.0k]
  |  Branch (52:23): [True: 0, False: 16.0k]
  |  Branch (52:38): [True: 0, False: 16.0k]
  |  Branch (52:58): [True: 0, False: 16.0k]
  ------------------
   53|      0|        return NULL;
   54|      0|    }
   55|  16.0k|    if (block_width > ((OPJ_UINT32)~0U) / block_height / sizeof(OPJ_INT32)) {
  ------------------
  |  Branch (55:9): [True: 0, False: 16.0k]
  ------------------
   56|      0|        return NULL;
   57|      0|    }
   58|       |
   59|  16.0k|    sa = (opj_sparse_array_int32_t*) opj_calloc(1,
   60|  16.0k|            sizeof(opj_sparse_array_int32_t));
   61|  16.0k|    sa->width = width;
   62|  16.0k|    sa->height = height;
   63|  16.0k|    sa->block_width = block_width;
   64|  16.0k|    sa->block_height = block_height;
   65|  16.0k|    sa->block_count_hor = opj_uint_ceildiv(width, block_width);
   66|  16.0k|    sa->block_count_ver = opj_uint_ceildiv(height, block_height);
   67|  16.0k|    if (sa->block_count_hor > ((OPJ_UINT32)~0U) / sa->block_count_ver) {
  ------------------
  |  Branch (67:9): [True: 0, False: 16.0k]
  ------------------
   68|      0|        opj_free(sa);
   69|      0|        return NULL;
   70|      0|    }
   71|  16.0k|    sa->data_blocks = (OPJ_INT32**) opj_calloc(sizeof(OPJ_INT32*),
   72|  16.0k|                      (size_t) sa->block_count_hor * sa->block_count_ver);
   73|  16.0k|    if (sa->data_blocks == NULL) {
  ------------------
  |  Branch (73:9): [True: 0, False: 16.0k]
  ------------------
   74|      0|        opj_free(sa);
   75|      0|        return NULL;
   76|      0|    }
   77|       |
   78|  16.0k|    return sa;
   79|  16.0k|}
opj_sparse_array_int32_free:
   82|  16.0k|{
   83|  16.0k|    if (sa) {
  ------------------
  |  Branch (83:9): [True: 16.0k, False: 0]
  ------------------
   84|  16.0k|        OPJ_UINT32 i;
   85|  47.7M|        for (i = 0; i < sa->block_count_hor * sa->block_count_ver; i++) {
  ------------------
  |  Branch (85:21): [True: 47.7M, False: 16.0k]
  ------------------
   86|  47.7M|            if (sa->data_blocks[i]) {
  ------------------
  |  Branch (86:17): [True: 380k, False: 47.3M]
  ------------------
   87|   380k|                opj_free(sa->data_blocks[i]);
   88|   380k|            }
   89|  47.7M|        }
   90|  16.0k|        opj_free(sa->data_blocks);
   91|  16.0k|        opj_free(sa);
   92|  16.0k|    }
   93|  16.0k|}
opj_sparse_array_is_region_valid:
  100|  6.73M|{
  101|  6.73M|    return !(x0 >= sa->width || x1 <= x0 || x1 > sa->width ||
  ------------------
  |  Branch (101:14): [True: 26.9k, False: 6.70M]
  |  Branch (101:33): [True: 137k, False: 6.56M]
  |  Branch (101:45): [True: 0, False: 6.56M]
  ------------------
  102|  6.73M|             y0 >= sa->height || y1 <= y0 || y1 > sa->height);
  ------------------
  |  Branch (102:14): [True: 2.22k, False: 6.56M]
  |  Branch (102:34): [True: 60.7k, False: 6.50M]
  |  Branch (102:46): [True: 0, False: 6.50M]
  ------------------
  103|  6.73M|}
opj_sparse_array_int32_read:
  320|  4.72M|{
  321|  4.72M|    return opj_sparse_array_int32_read_or_write(
  322|  4.72M|               (opj_sparse_array_int32_t*)sa, x0, y0, x1, y1,
  323|  4.72M|               dest,
  324|  4.72M|               dest_col_stride,
  325|  4.72M|               dest_line_stride,
  326|  4.72M|               forgiving,
  327|  4.72M|               OPJ_TRUE);
  ------------------
  |  |  117|  4.72M|#define OPJ_TRUE 1
  ------------------
  328|  4.72M|}
opj_sparse_array_int32_write:
  339|  2.00M|{
  340|  2.00M|    return opj_sparse_array_int32_read_or_write(sa, x0, y0, x1, y1,
  341|  2.00M|            (OPJ_INT32*)src,
  342|  2.00M|            src_col_stride,
  343|  2.00M|            src_line_stride,
  344|  2.00M|            forgiving,
  345|  2.00M|            OPJ_FALSE);
  ------------------
  |  |  118|  2.00M|#define OPJ_FALSE 0
  ------------------
  346|  2.00M|}
sparse_array.c:opj_sparse_array_int32_read_or_write:
  116|  6.73M|{
  117|  6.73M|    OPJ_UINT32 y, block_y;
  118|  6.73M|    OPJ_UINT32 y_incr = 0;
  119|  6.73M|    const OPJ_UINT32 block_width = sa->block_width;
  120|       |
  121|  6.73M|    if (!opj_sparse_array_is_region_valid(sa, x0, y0, x1, y1)) {
  ------------------
  |  Branch (121:9): [True: 227k, False: 6.50M]
  ------------------
  122|   227k|        return forgiving;
  123|   227k|    }
  124|       |
  125|  6.50M|    block_y = y0 / sa->block_height;
  126|  15.7M|    for (y = y0; y < y1; block_y ++, y += y_incr) {
  ------------------
  |  Branch (126:18): [True: 9.28M, False: 6.50M]
  ------------------
  127|  9.28M|        OPJ_UINT32 x, block_x;
  128|  9.28M|        OPJ_UINT32 x_incr = 0;
  129|  9.28M|        OPJ_UINT32 block_y_offset;
  130|  9.28M|        y_incr = (y == y0) ? sa->block_height - (y0 % sa->block_height) :
  ------------------
  |  Branch (130:18): [True: 6.50M, False: 2.78M]
  ------------------
  131|  9.28M|                 sa->block_height;
  132|  9.28M|        block_y_offset = sa->block_height - y_incr;
  133|  9.28M|        y_incr = opj_uint_min(y_incr, y1 - y);
  134|  9.28M|        block_x = x0 / block_width;
  135|  26.6M|        for (x = x0; x < x1; block_x ++, x += x_incr) {
  ------------------
  |  Branch (135:22): [True: 17.3M, False: 9.28M]
  ------------------
  136|  17.3M|            OPJ_UINT32 j;
  137|  17.3M|            OPJ_UINT32 block_x_offset;
  138|  17.3M|            OPJ_INT32* src_block;
  139|  17.3M|            x_incr = (x == x0) ? block_width - (x0 % block_width) : block_width;
  ------------------
  |  Branch (139:22): [True: 9.28M, False: 8.05M]
  ------------------
  140|  17.3M|            block_x_offset = block_width - x_incr;
  141|  17.3M|            x_incr = opj_uint_min(x_incr, x1 - x);
  142|  17.3M|            src_block = sa->data_blocks[block_y * sa->block_count_hor + block_x];
  143|  17.3M|            if (is_read_op) {
  ------------------
  |  Branch (143:17): [True: 10.5M, False: 6.74M]
  ------------------
  144|  10.5M|                if (src_block == NULL) {
  ------------------
  |  Branch (144:21): [True: 543, False: 10.5M]
  ------------------
  145|    543|                    if (buf_col_stride == 1) {
  ------------------
  |  Branch (145:25): [True: 0, False: 543]
  ------------------
  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|    543|                    } else {
  153|    543|                        OPJ_INT32* dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride +
  154|    543|                                              (x - x0) * buf_col_stride;
  155|  1.08k|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (155:37): [True: 543, False: 543]
  ------------------
  156|    543|                            OPJ_UINT32 k;
  157|  4.34k|                            for (k = 0; k < x_incr; k++) {
  ------------------
  |  Branch (157:41): [True: 3.80k, False: 543]
  ------------------
  158|  3.80k|                                dest_ptr[k * buf_col_stride] = 0;
  159|  3.80k|                            }
  160|    543|                            dest_ptr += buf_line_stride;
  161|    543|                        }
  162|    543|                    }
  163|  10.5M|                } else {
  164|  10.5M|                    const OPJ_INT32* OPJ_RESTRICT src_ptr = src_block + block_y_offset *
  165|  10.5M|                                                            (OPJ_SIZE_T)block_width + block_x_offset;
  166|  10.5M|                    if (buf_col_stride == 1) {
  ------------------
  |  Branch (166:25): [True: 1.73M, False: 8.86M]
  ------------------
  167|  1.73M|                        OPJ_INT32* OPJ_RESTRICT dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride
  168|  1.73M|                                                           +
  169|  1.73M|                                                           (x - x0) * buf_col_stride;
  170|  1.73M|                        if (x_incr == 4) {
  ------------------
  |  Branch (170:29): [True: 921k, False: 810k]
  ------------------
  171|       |                            /* Same code as general branch, but the compiler */
  172|       |                            /* can have an efficient memcpy() */
  173|   921k|                            (void)(x_incr); /* trick to silent cppcheck duplicateBranch warning */
  174|  40.8M|                            for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (174:41): [True: 39.9M, False: 921k]
  ------------------
  175|  39.9M|                                memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
  176|  39.9M|                                dest_ptr += buf_line_stride;
  177|  39.9M|                                src_ptr += block_width;
  178|  39.9M|                            }
  179|   921k|                        } else {
  180|  38.5M|                            for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (180:41): [True: 37.7M, False: 810k]
  ------------------
  181|  37.7M|                                memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
  182|  37.7M|                                dest_ptr += buf_line_stride;
  183|  37.7M|                                src_ptr += block_width;
  184|  37.7M|                            }
  185|   810k|                        }
  186|  8.86M|                    } else {
  187|  8.86M|                        OPJ_INT32* OPJ_RESTRICT dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride
  188|  8.86M|                                                           +
  189|  8.86M|                                                           (x - x0) * buf_col_stride;
  190|  8.86M|                        if (x_incr == 1) {
  ------------------
  |  Branch (190:29): [True: 256k, False: 8.60M]
  ------------------
  191|   512k|                            for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (191:41): [True: 256k, False: 256k]
  ------------------
  192|   256k|                                *dest_ptr = *src_ptr;
  193|   256k|                                dest_ptr += buf_line_stride;
  194|   256k|                                src_ptr += block_width;
  195|   256k|                            }
  196|  8.60M|                        } else if (y_incr == 1 && buf_col_stride == 2) {
  ------------------
  |  Branch (196:36): [True: 8.60M, False: 0]
  |  Branch (196:51): [True: 3.63M, False: 4.97M]
  ------------------
  197|  3.63M|                            OPJ_UINT32 k;
  198|  42.7M|                            for (k = 0; k < (x_incr & ~3U); k += 4) {
  ------------------
  |  Branch (198:41): [True: 39.0M, False: 3.63M]
  ------------------
  199|  39.0M|                                dest_ptr[k * buf_col_stride] = src_ptr[k];
  200|  39.0M|                                dest_ptr[(k + 1) * buf_col_stride] = src_ptr[k + 1];
  201|  39.0M|                                dest_ptr[(k + 2) * buf_col_stride] = src_ptr[k + 2];
  202|  39.0M|                                dest_ptr[(k + 3) * buf_col_stride] = src_ptr[k + 3];
  203|  39.0M|                            }
  204|  6.94M|                            for (; k < x_incr; k++) {
  ------------------
  |  Branch (204:36): [True: 3.31M, False: 3.63M]
  ------------------
  205|  3.31M|                                dest_ptr[k * buf_col_stride] = src_ptr[k];
  206|  3.31M|                            }
  207|  4.97M|                        } else if (x_incr >= 8 && buf_col_stride == 8) {
  ------------------
  |  Branch (207:36): [True: 4.04M, False: 926k]
  |  Branch (207:51): [True: 0, False: 4.04M]
  ------------------
  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|  4.97M|                        } else {
  223|       |                            /* General case */
  224|  9.94M|                            for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (224:41): [True: 4.97M, False: 4.97M]
  ------------------
  225|  4.97M|                                OPJ_UINT32 k;
  226|   208M|                                for (k = 0; k < x_incr; k++) {
  ------------------
  |  Branch (226:45): [True: 203M, False: 4.97M]
  ------------------
  227|   203M|                                    dest_ptr[k * buf_col_stride] = src_ptr[k];
  228|   203M|                                }
  229|  4.97M|                                dest_ptr += buf_line_stride;
  230|  4.97M|                                src_ptr += block_width;
  231|  4.97M|                            }
  232|  4.97M|                        }
  233|  8.86M|                    }
  234|  10.5M|                }
  235|  10.5M|            } else {
  236|  6.74M|                if (src_block == NULL) {
  ------------------
  |  Branch (236:21): [True: 380k, False: 6.36M]
  ------------------
  237|   380k|                    src_block = (OPJ_INT32*) opj_calloc(1,
  238|   380k|                                                        (size_t) sa->block_width * sa->block_height * sizeof(OPJ_INT32));
  239|   380k|                    if (src_block == NULL) {
  ------------------
  |  Branch (239:25): [True: 0, False: 380k]
  ------------------
  240|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  241|      0|                    }
  242|   380k|                    sa->data_blocks[block_y * sa->block_count_hor + block_x] = src_block;
  243|   380k|                }
  244|       |
  245|  6.74M|                if (buf_col_stride == 1) {
  ------------------
  |  Branch (245:21): [True: 6.23M, False: 515k]
  ------------------
  246|  6.23M|                    OPJ_INT32* OPJ_RESTRICT dest_ptr = src_block + block_y_offset *
  247|  6.23M|                                                       (OPJ_SIZE_T)block_width + block_x_offset;
  248|  6.23M|                    const OPJ_INT32* OPJ_RESTRICT src_ptr = buf + (y - y0) *
  249|  6.23M|                                                            (OPJ_SIZE_T)buf_line_stride + (x - x0) * buf_col_stride;
  250|  6.23M|                    if (x_incr == 4) {
  ------------------
  |  Branch (250:25): [True: 1.92M, False: 4.30M]
  ------------------
  251|       |                        /* Same code as general branch, but the compiler */
  252|       |                        /* can have an efficient memcpy() */
  253|  1.92M|                        (void)(x_incr); /* trick to silent cppcheck duplicateBranch warning */
  254|  97.9M|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (254:37): [True: 96.0M, False: 1.92M]
  ------------------
  255|  96.0M|                            memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
  256|  96.0M|                            dest_ptr += block_width;
  257|  96.0M|                            src_ptr += buf_line_stride;
  258|  96.0M|                        }
  259|  4.30M|                    } else {
  260|  51.2M|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (260:37): [True: 46.8M, False: 4.30M]
  ------------------
  261|  46.8M|                            memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
  262|  46.8M|                            dest_ptr += block_width;
  263|  46.8M|                            src_ptr += buf_line_stride;
  264|  46.8M|                        }
  265|  4.30M|                    }
  266|  6.23M|                } else {
  267|   515k|                    OPJ_INT32* OPJ_RESTRICT dest_ptr = src_block + block_y_offset *
  268|   515k|                                                       (OPJ_SIZE_T)block_width + block_x_offset;
  269|   515k|                    const OPJ_INT32* OPJ_RESTRICT src_ptr = buf + (y - y0) *
  270|   515k|                                                            (OPJ_SIZE_T)buf_line_stride + (x - x0) * buf_col_stride;
  271|   515k|                    if (x_incr == 1) {
  ------------------
  |  Branch (271:25): [True: 12.1k, False: 503k]
  ------------------
  272|  85.8k|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (272:37): [True: 73.7k, False: 12.1k]
  ------------------
  273|  73.7k|                            *dest_ptr = *src_ptr;
  274|  73.7k|                            src_ptr += buf_line_stride;
  275|  73.7k|                            dest_ptr += block_width;
  276|  73.7k|                        }
  277|   503k|                    } else if (x_incr >= 8 && buf_col_stride == 8) {
  ------------------
  |  Branch (277:32): [True: 475k, False: 27.6k]
  |  Branch (277:47): [True: 475k, False: 0]
  ------------------
  278|  4.24M|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (278:37): [True: 3.77M, False: 475k]
  ------------------
  279|  3.77M|                            OPJ_UINT32 k;
  280|  54.3M|                            for (k = 0; k < (x_incr & ~3U); k += 4) {
  ------------------
  |  Branch (280:41): [True: 50.5M, False: 3.77M]
  ------------------
  281|  50.5M|                                dest_ptr[k] = src_ptr[k * buf_col_stride];
  282|  50.5M|                                dest_ptr[k + 1] = src_ptr[(k + 1) * buf_col_stride];
  283|  50.5M|                                dest_ptr[k + 2] = src_ptr[(k + 2) * buf_col_stride];
  284|  50.5M|                                dest_ptr[k + 3] = src_ptr[(k + 3) * buf_col_stride];
  285|  50.5M|                            }
  286|  4.64M|                            for (; k < x_incr; k++) {
  ------------------
  |  Branch (286:36): [True: 869k, False: 3.77M]
  ------------------
  287|   869k|                                dest_ptr[k] = src_ptr[k * buf_col_stride];
  288|   869k|                            }
  289|  3.77M|                            src_ptr += buf_line_stride;
  290|  3.77M|                            dest_ptr += block_width;
  291|  3.77M|                        }
  292|   475k|                    } else {
  293|       |                        /* General case */
  294|   243k|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (294:37): [True: 215k, False: 27.6k]
  ------------------
  295|   215k|                            OPJ_UINT32 k;
  296|   915k|                            for (k = 0; k < x_incr; k++) {
  ------------------
  |  Branch (296:41): [True: 700k, False: 215k]
  ------------------
  297|   700k|                                dest_ptr[k] = src_ptr[k * buf_col_stride];
  298|   700k|                            }
  299|   215k|                            src_ptr += buf_line_stride;
  300|   215k|                            dest_ptr += block_width;
  301|   215k|                        }
  302|  27.6k|                    }
  303|   515k|                }
  304|  6.74M|            }
  305|  17.3M|        }
  306|  9.28M|    }
  307|       |
  308|  6.50M|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.50M|#define OPJ_TRUE 1
  ------------------
  309|  6.50M|}

opj_t1_create:
 1548|  5.97k|{
 1549|  5.97k|    opj_t1_t *l_t1 = 00;
 1550|       |
 1551|  5.97k|    l_t1 = (opj_t1_t*) opj_calloc(1, sizeof(opj_t1_t));
 1552|  5.97k|    if (!l_t1) {
  ------------------
  |  Branch (1552:9): [True: 0, False: 5.97k]
  ------------------
 1553|      0|        return 00;
 1554|      0|    }
 1555|       |
 1556|  5.97k|    l_t1->encoder = isEncoder;
 1557|       |
 1558|  5.97k|    return l_t1;
 1559|  5.97k|}
opj_t1_destroy:
 1568|  5.97k|{
 1569|  5.97k|    if (! p_t1) {
  ------------------
  |  Branch (1569:9): [True: 0, False: 5.97k]
  ------------------
 1570|      0|        return;
 1571|      0|    }
 1572|       |
 1573|  5.97k|    if (p_t1->data) {
  ------------------
  |  Branch (1573:9): [True: 5.97k, False: 1]
  ------------------
 1574|  5.97k|        opj_aligned_free(p_t1->data);
 1575|  5.97k|        p_t1->data = 00;
 1576|  5.97k|    }
 1577|       |
 1578|  5.97k|    if (p_t1->flags) {
  ------------------
  |  Branch (1578:9): [True: 5.97k, False: 1]
  ------------------
 1579|  5.97k|        opj_aligned_free(p_t1->flags);
 1580|  5.97k|        p_t1->flags = 00;
 1581|  5.97k|    }
 1582|       |
 1583|  5.97k|    opj_free(p_t1->cblkdatabuffer);
 1584|       |
 1585|  5.97k|    opj_free(p_t1);
 1586|  5.97k|}
opj_t1_decode_cblks:
 1843|  23.2k|{
 1844|  23.2k|    opj_thread_pool_t* tp = tcd->thread_pool;
 1845|  23.2k|    OPJ_UINT32 resno, bandno, precno, cblkno;
 1846|       |
 1847|       |#ifdef DEBUG_VERBOSE
 1848|       |    OPJ_UINT32 codeblocks_decoded = 0;
 1849|       |    printf("Enter opj_t1_decode_cblks()\n");
 1850|       |#endif
 1851|       |
 1852|   152k|    for (resno = 0; resno < tilec->minimum_num_resolutions; ++resno) {
  ------------------
  |  Branch (1852:21): [True: 129k, False: 22.7k]
  ------------------
 1853|   129k|        opj_tcd_resolution_t* res = &tilec->resolutions[resno];
 1854|       |
 1855|   471k|        for (bandno = 0; bandno < res->numbands; ++bandno) {
  ------------------
  |  Branch (1855:26): [True: 342k, False: 129k]
  ------------------
 1856|   342k|            opj_tcd_band_t* OPJ_RESTRICT band = &res->bands[bandno];
 1857|       |
 1858|   930k|            for (precno = 0; precno < res->pw * res->ph; ++precno) {
  ------------------
  |  Branch (1858:30): [True: 589k, False: 341k]
  ------------------
 1859|   589k|                opj_tcd_precinct_t* precinct = &band->precincts[precno];
 1860|       |
 1861|   589k|                if (!opj_tcd_is_subband_area_of_interest(tcd,
  ------------------
  |  Branch (1861:21): [True: 406k, False: 182k]
  ------------------
 1862|   589k|                        tilec->compno,
 1863|   589k|                        resno,
 1864|   589k|                        band->bandno,
 1865|   589k|                        (OPJ_UINT32)precinct->x0,
 1866|   589k|                        (OPJ_UINT32)precinct->y0,
 1867|   589k|                        (OPJ_UINT32)precinct->x1,
 1868|   589k|                        (OPJ_UINT32)precinct->y1)) {
 1869|  54.7M|                    for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) {
  ------------------
  |  Branch (1869:38): [True: 54.3M, False: 406k]
  ------------------
 1870|  54.3M|                        opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno];
 1871|  54.3M|                        if (cblk->decoded_data) {
  ------------------
  |  Branch (1871:29): [True: 0, False: 54.3M]
  ------------------
 1872|       |#ifdef DEBUG_VERBOSE
 1873|       |                            printf("Discarding codeblock %d,%d at resno=%d, bandno=%d\n",
 1874|       |                                   cblk->x0, cblk->y0, resno, bandno);
 1875|       |#endif
 1876|      0|                            opj_aligned_free(cblk->decoded_data);
 1877|      0|                            cblk->decoded_data = NULL;
 1878|      0|                        }
 1879|  54.3M|                    }
 1880|   406k|                    continue;
 1881|   406k|                }
 1882|       |
 1883|  7.54M|                for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) {
  ------------------
  |  Branch (1883:34): [True: 7.36M, False: 182k]
  ------------------
 1884|  7.36M|                    opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno];
 1885|  7.36M|                    opj_t1_cblk_decode_processing_job_t* job;
 1886|       |
 1887|  7.36M|                    if (!opj_tcd_is_subband_area_of_interest(tcd,
  ------------------
  |  Branch (1887:25): [True: 5.70M, False: 1.65M]
  ------------------
 1888|  7.36M|                            tilec->compno,
 1889|  7.36M|                            resno,
 1890|  7.36M|                            band->bandno,
 1891|  7.36M|                            (OPJ_UINT32)cblk->x0,
 1892|  7.36M|                            (OPJ_UINT32)cblk->y0,
 1893|  7.36M|                            (OPJ_UINT32)cblk->x1,
 1894|  7.36M|                            (OPJ_UINT32)cblk->y1)) {
 1895|  5.70M|                        if (cblk->decoded_data) {
  ------------------
  |  Branch (1895:29): [True: 0, False: 5.70M]
  ------------------
 1896|       |#ifdef DEBUG_VERBOSE
 1897|       |                            printf("Discarding codeblock %d,%d at resno=%d, bandno=%d\n",
 1898|       |                                   cblk->x0, cblk->y0, resno, bandno);
 1899|       |#endif
 1900|      0|                            opj_aligned_free(cblk->decoded_data);
 1901|      0|                            cblk->decoded_data = NULL;
 1902|      0|                        }
 1903|  5.70M|                        continue;
 1904|  5.70M|                    }
 1905|       |
 1906|  1.65M|                    if (!tcd->whole_tile_decoding) {
  ------------------
  |  Branch (1906:25): [True: 859k, False: 795k]
  ------------------
 1907|   859k|                        OPJ_UINT32 cblk_w = (OPJ_UINT32)(cblk->x1 - cblk->x0);
 1908|   859k|                        OPJ_UINT32 cblk_h = (OPJ_UINT32)(cblk->y1 - cblk->y0);
 1909|   859k|                        if (cblk->decoded_data != NULL) {
  ------------------
  |  Branch (1909:29): [True: 0, False: 859k]
  ------------------
 1910|       |#ifdef DEBUG_VERBOSE
 1911|       |                            printf("Reusing codeblock %d,%d at resno=%d, bandno=%d\n",
 1912|       |                                   cblk->x0, cblk->y0, resno, bandno);
 1913|       |#endif
 1914|      0|                            continue;
 1915|      0|                        }
 1916|   859k|                        if (cblk_w == 0 || cblk_h == 0) {
  ------------------
  |  Branch (1916:29): [True: 6.30k, False: 852k]
  |  Branch (1916:44): [True: 5.07k, False: 847k]
  ------------------
 1917|  11.3k|                            continue;
 1918|  11.3k|                        }
 1919|       |#ifdef DEBUG_VERBOSE
 1920|       |                        printf("Decoding codeblock %d,%d at resno=%d, bandno=%d\n",
 1921|       |                               cblk->x0, cblk->y0, resno, bandno);
 1922|       |#endif
 1923|   859k|                    }
 1924|       |
 1925|  1.64M|                    job = (opj_t1_cblk_decode_processing_job_t*) opj_calloc(1,
 1926|  1.64M|                            sizeof(opj_t1_cblk_decode_processing_job_t));
 1927|  1.64M|                    if (!job) {
  ------------------
  |  Branch (1927:25): [True: 0, False: 1.64M]
  ------------------
 1928|      0|                        *pret = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1929|      0|                        return;
 1930|      0|                    }
 1931|  1.64M|                    job->whole_tile_decoding = tcd->whole_tile_decoding;
 1932|  1.64M|                    job->resno = resno;
 1933|  1.64M|                    job->cblk = cblk;
 1934|  1.64M|                    job->band = band;
 1935|  1.64M|                    job->tilec = tilec;
 1936|  1.64M|                    job->tccp = tccp;
 1937|  1.64M|                    job->pret = pret;
 1938|  1.64M|                    job->p_manager_mutex = p_manager_mutex;
 1939|  1.64M|                    job->p_manager = p_manager;
 1940|  1.64M|                    job->check_pterm = check_pterm;
 1941|  1.64M|                    job->mustuse_cblkdatabuffer = opj_thread_pool_get_thread_count(tp) > 1;
 1942|  1.64M|                    opj_thread_pool_submit_job(tp, opj_t1_clbl_decode_processor, job);
 1943|       |#ifdef DEBUG_VERBOSE
 1944|       |                    codeblocks_decoded ++;
 1945|       |#endif
 1946|  1.64M|                    if (!(*pret)) {
  ------------------
  |  Branch (1946:25): [True: 500, False: 1.64M]
  ------------------
 1947|    500|                        return;
 1948|    500|                    }
 1949|  1.64M|                } /* cblkno */
 1950|   182k|            } /* precno */
 1951|   342k|        } /* bandno */
 1952|   129k|    } /* resno */
 1953|       |
 1954|       |#ifdef DEBUG_VERBOSE
 1955|       |    printf("Leave opj_t1_decode_cblks(). Number decoded: %d\n", codeblocks_decoded);
 1956|       |#endif
 1957|  22.7k|    return;
 1958|  23.2k|}
t1.c:opj_t1_clbl_decode_processor:
 1608|  1.64M|{
 1609|  1.64M|    opj_tcd_cblk_dec_t* cblk;
 1610|  1.64M|    opj_tcd_band_t* band;
 1611|  1.64M|    opj_tcd_tilecomp_t* tilec;
 1612|  1.64M|    opj_tccp_t* tccp;
 1613|  1.64M|    OPJ_INT32* OPJ_RESTRICT datap;
 1614|  1.64M|    OPJ_UINT32 cblk_w, cblk_h;
 1615|  1.64M|    OPJ_INT32 x, y;
 1616|  1.64M|    OPJ_UINT32 i, j;
 1617|  1.64M|    opj_t1_cblk_decode_processing_job_t* job;
 1618|  1.64M|    opj_t1_t* t1;
 1619|  1.64M|    OPJ_UINT32 resno;
 1620|  1.64M|    OPJ_UINT32 tile_w;
 1621|       |
 1622|  1.64M|    job = (opj_t1_cblk_decode_processing_job_t*) user_data;
 1623|       |
 1624|  1.64M|    cblk = job->cblk;
 1625|       |
 1626|  1.64M|    if (!job->whole_tile_decoding) {
  ------------------
  |  Branch (1626:9): [True: 847k, False: 795k]
  ------------------
 1627|   847k|        cblk_w = (OPJ_UINT32)(cblk->x1 - cblk->x0);
 1628|   847k|        cblk_h = (OPJ_UINT32)(cblk->y1 - cblk->y0);
 1629|       |
 1630|   847k|        cblk->decoded_data = (OPJ_INT32*)opj_aligned_malloc(sizeof(OPJ_INT32) *
 1631|   847k|                             cblk_w * cblk_h);
 1632|   847k|        if (cblk->decoded_data == NULL) {
  ------------------
  |  Branch (1632:13): [True: 0, False: 847k]
  ------------------
 1633|      0|            if (job->p_manager_mutex) {
  ------------------
  |  Branch (1633:17): [True: 0, False: 0]
  ------------------
 1634|      0|                opj_mutex_lock(job->p_manager_mutex);
 1635|      0|            }
 1636|      0|            opj_event_msg(job->p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1637|      0|                          "Cannot allocate cblk->decoded_data\n");
 1638|      0|            if (job->p_manager_mutex) {
  ------------------
  |  Branch (1638:17): [True: 0, False: 0]
  ------------------
 1639|      0|                opj_mutex_unlock(job->p_manager_mutex);
 1640|      0|            }
 1641|      0|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1642|      0|            opj_free(job);
 1643|      0|            return;
 1644|      0|        }
 1645|       |        /* Zero-init required */
 1646|   847k|        memset(cblk->decoded_data, 0, sizeof(OPJ_INT32) * cblk_w * cblk_h);
 1647|   847k|    } else if (cblk->decoded_data) {
  ------------------
  |  Branch (1647:16): [True: 0, False: 795k]
  ------------------
 1648|       |        /* Not sure if that code path can happen, but better be */
 1649|       |        /* safe than sorry */
 1650|      0|        opj_aligned_free(cblk->decoded_data);
 1651|      0|        cblk->decoded_data = NULL;
 1652|      0|    }
 1653|       |
 1654|  1.64M|    resno = job->resno;
 1655|  1.64M|    band = job->band;
 1656|  1.64M|    tilec = job->tilec;
 1657|  1.64M|    tccp = job->tccp;
 1658|  1.64M|    tile_w = (OPJ_UINT32)(tilec->resolutions[tilec->minimum_num_resolutions - 1].x1
 1659|  1.64M|                          -
 1660|  1.64M|                          tilec->resolutions[tilec->minimum_num_resolutions - 1].x0);
 1661|       |
 1662|  1.64M|    if (!*(job->pret)) {
  ------------------
  |  Branch (1662:9): [True: 0, False: 1.64M]
  ------------------
 1663|      0|        opj_free(job);
 1664|      0|        return;
 1665|      0|    }
 1666|       |
 1667|  1.64M|    t1 = (opj_t1_t*) opj_tls_get(tls, OPJ_TLS_KEY_T1);
  ------------------
  |  |   35|  1.64M|#define OPJ_TLS_KEY_T1  0
  ------------------
 1668|  1.64M|    if (t1 == NULL) {
  ------------------
  |  Branch (1668:9): [True: 5.97k, False: 1.63M]
  ------------------
 1669|  5.97k|        t1 = opj_t1_create(OPJ_FALSE);
  ------------------
  |  |  118|  5.97k|#define OPJ_FALSE 0
  ------------------
 1670|  5.97k|        if (t1 == NULL) {
  ------------------
  |  Branch (1670:13): [True: 0, False: 5.97k]
  ------------------
 1671|      0|            opj_event_msg(job->p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1672|      0|                          "Cannot allocate Tier 1 handle\n");
 1673|      0|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1674|      0|            opj_free(job);
 1675|      0|            return;
 1676|      0|        }
 1677|  5.97k|        if (!opj_tls_set(tls, OPJ_TLS_KEY_T1, t1, opj_t1_destroy_wrapper)) {
  ------------------
  |  |   35|  5.97k|#define OPJ_TLS_KEY_T1  0
  ------------------
  |  Branch (1677:13): [True: 0, False: 5.97k]
  ------------------
 1678|      0|            opj_event_msg(job->p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1679|      0|                          "Unable to set t1 handle as TLS\n");
 1680|      0|            opj_t1_destroy(t1);
 1681|      0|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1682|      0|            opj_free(job);
 1683|      0|            return;
 1684|      0|        }
 1685|  5.97k|    }
 1686|  1.64M|    t1->mustuse_cblkdatabuffer = job->mustuse_cblkdatabuffer;
 1687|       |
 1688|  1.64M|    if ((tccp->cblksty & J2K_CCP_CBLKSTY_HT) != 0) {
  ------------------
  |  |   64|  1.64M|#define J2K_CCP_CBLKSTY_HT 0x40       /**< (high throughput) HT codeblocks */
  ------------------
  |  Branch (1688:9): [True: 29.5k, False: 1.61M]
  ------------------
 1689|  29.5k|        if (OPJ_FALSE == opj_t1_ht_decode_cblk(
  ------------------
  |  |  118|  29.5k|#define OPJ_FALSE 0
  ------------------
  |  Branch (1689:13): [True: 429, False: 29.1k]
  ------------------
 1690|  29.5k|                    t1,
 1691|  29.5k|                    cblk,
 1692|  29.5k|                    band->bandno,
 1693|  29.5k|                    (OPJ_UINT32)tccp->roishift,
 1694|  29.5k|                    tccp->cblksty,
 1695|  29.5k|                    job->p_manager,
 1696|  29.5k|                    job->p_manager_mutex,
 1697|  29.5k|                    job->check_pterm)) {
 1698|    429|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|    429|#define OPJ_FALSE 0
  ------------------
 1699|    429|            opj_free(job);
 1700|    429|            return;
 1701|    429|        }
 1702|  1.61M|    } else {
 1703|  1.61M|        if (OPJ_FALSE == opj_t1_decode_cblk(
  ------------------
  |  |  118|  1.61M|#define OPJ_FALSE 0
  ------------------
  |  Branch (1703:13): [True: 71, False: 1.61M]
  ------------------
 1704|  1.61M|                    t1,
 1705|  1.61M|                    cblk,
 1706|  1.61M|                    band->bandno,
 1707|  1.61M|                    (OPJ_UINT32)tccp->roishift,
 1708|  1.61M|                    tccp->cblksty,
 1709|  1.61M|                    job->p_manager,
 1710|  1.61M|                    job->p_manager_mutex,
 1711|  1.61M|                    job->check_pterm)) {
 1712|     71|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|     71|#define OPJ_FALSE 0
  ------------------
 1713|     71|            opj_free(job);
 1714|     71|            return;
 1715|     71|        }
 1716|  1.61M|    }
 1717|       |
 1718|  1.64M|    x = cblk->x0 - band->x0;
 1719|  1.64M|    y = cblk->y0 - band->y0;
 1720|  1.64M|    if (band->bandno & 1) {
  ------------------
  |  Branch (1720:9): [True: 571k, False: 1.07M]
  ------------------
 1721|   571k|        opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
 1722|   571k|        x += pres->x1 - pres->x0;
 1723|   571k|    }
 1724|  1.64M|    if (band->bandno & 2) {
  ------------------
  |  Branch (1724:9): [True: 578k, False: 1.06M]
  ------------------
 1725|   578k|        opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
 1726|   578k|        y += pres->y1 - pres->y0;
 1727|   578k|    }
 1728|       |
 1729|  1.64M|    datap = cblk->decoded_data ? cblk->decoded_data : t1->data;
  ------------------
  |  Branch (1729:13): [True: 847k, False: 795k]
  ------------------
 1730|  1.64M|    cblk_w = t1->w;
 1731|  1.64M|    cblk_h = t1->h;
 1732|       |
 1733|  1.64M|    if (tccp->roishift) {
  ------------------
  |  Branch (1733:9): [True: 4.52k, False: 1.63M]
  ------------------
 1734|  4.52k|        if (tccp->roishift >= 31) {
  ------------------
  |  Branch (1734:13): [True: 120, False: 4.40k]
  ------------------
 1735|  2.02k|            for (j = 0; j < cblk_h; ++j) {
  ------------------
  |  Branch (1735:25): [True: 1.90k, False: 120]
  ------------------
 1736|   129k|                for (i = 0; i < cblk_w; ++i) {
  ------------------
  |  Branch (1736:29): [True: 127k, False: 1.90k]
  ------------------
 1737|   127k|                    datap[(j * cblk_w) + i] = 0;
 1738|   127k|                }
 1739|  1.90k|            }
 1740|  4.40k|        } else {
 1741|  4.40k|            OPJ_INT32 thresh = 1 << tccp->roishift;
 1742|  1.06M|            for (j = 0; j < cblk_h; ++j) {
  ------------------
  |  Branch (1742:25): [True: 1.06M, False: 4.40k]
  ------------------
 1743|  5.93M|                for (i = 0; i < cblk_w; ++i) {
  ------------------
  |  Branch (1743:29): [True: 4.87M, False: 1.06M]
  ------------------
 1744|  4.87M|                    OPJ_INT32 val = datap[(j * cblk_w) + i];
 1745|  4.87M|                    OPJ_INT32 mag = abs(val);
 1746|  4.87M|                    if (mag >= thresh) {
  ------------------
  |  Branch (1746:25): [True: 888k, False: 3.98M]
  ------------------
 1747|   888k|                        mag >>= tccp->roishift;
 1748|   888k|                        datap[(j * cblk_w) + i] = val < 0 ? -mag : mag;
  ------------------
  |  Branch (1748:51): [True: 431k, False: 457k]
  ------------------
 1749|   888k|                    }
 1750|  4.87M|                }
 1751|  1.06M|            }
 1752|  4.40k|        }
 1753|  4.52k|    }
 1754|       |
 1755|       |    /* Both can be non NULL if for example decoding a full tile and then */
 1756|       |    /* partially a tile. In which case partial decoding should be the */
 1757|       |    /* priority */
 1758|  1.64M|    assert((cblk->decoded_data != NULL) || (tilec->data != NULL));
 1759|       |
 1760|  1.64M|    if (cblk->decoded_data) {
  ------------------
  |  Branch (1760:9): [True: 847k, False: 795k]
  ------------------
 1761|   847k|        OPJ_UINT32 cblk_size = cblk_w * cblk_h;
 1762|   847k|        if (tccp->qmfbid == 1) {
  ------------------
  |  Branch (1762:13): [True: 354k, False: 493k]
  ------------------
 1763|   514M|            for (i = 0; i < cblk_size; ++i) {
  ------------------
  |  Branch (1763:25): [True: 514M, False: 354k]
  ------------------
 1764|   514M|                datap[i] /= 2;
 1765|   514M|            }
 1766|   493k|        } else {        /* if (tccp->qmfbid == 0) */
 1767|   493k|            const float stepsize = 0.5f * band->stepsize;
 1768|   493k|            i = 0;
 1769|   493k|#ifdef __SSE2__
 1770|   493k|            {
 1771|   493k|                const __m128 xmm_stepsize = _mm_set1_ps(stepsize);
 1772|  34.3M|                for (; i < (cblk_size & ~15U); i += 16) {
  ------------------
  |  Branch (1772:24): [True: 33.8M, False: 493k]
  ------------------
 1773|  33.8M|                    __m128 xmm0_data = _mm_cvtepi32_ps(_mm_load_si128((__m128i * const)(
 1774|  33.8M|                                                           datap + 0)));
 1775|  33.8M|                    __m128 xmm1_data = _mm_cvtepi32_ps(_mm_load_si128((__m128i * const)(
 1776|  33.8M|                                                           datap + 4)));
 1777|  33.8M|                    __m128 xmm2_data = _mm_cvtepi32_ps(_mm_load_si128((__m128i * const)(
 1778|  33.8M|                                                           datap + 8)));
 1779|  33.8M|                    __m128 xmm3_data = _mm_cvtepi32_ps(_mm_load_si128((__m128i * const)(
 1780|  33.8M|                                                           datap + 12)));
 1781|  33.8M|                    _mm_store_ps((float*)(datap +  0), _mm_mul_ps(xmm0_data, xmm_stepsize));
 1782|  33.8M|                    _mm_store_ps((float*)(datap +  4), _mm_mul_ps(xmm1_data, xmm_stepsize));
 1783|  33.8M|                    _mm_store_ps((float*)(datap +  8), _mm_mul_ps(xmm2_data, xmm_stepsize));
 1784|  33.8M|                    _mm_store_ps((float*)(datap + 12), _mm_mul_ps(xmm3_data, xmm_stepsize));
 1785|  33.8M|                    datap += 16;
 1786|  33.8M|                }
 1787|   493k|            }
 1788|   493k|#endif
 1789|  1.32M|            for (; i < cblk_size; ++i) {
  ------------------
  |  Branch (1789:20): [True: 836k, False: 493k]
  ------------------
 1790|   836k|                OPJ_FLOAT32 tmp = ((OPJ_FLOAT32)(*datap)) * stepsize;
 1791|   836k|                memcpy(datap, &tmp, sizeof(tmp));
 1792|   836k|                datap++;
 1793|   836k|            }
 1794|   493k|        }
 1795|   847k|    } else if (tccp->qmfbid == 1) {
  ------------------
  |  Branch (1795:16): [True: 59.7k, False: 735k]
  ------------------
 1796|  59.7k|        OPJ_INT32* OPJ_RESTRICT tiledp = &tilec->data[(OPJ_SIZE_T)y * tile_w +
 1797|  59.7k|                                                       (OPJ_SIZE_T)x];
 1798|   458k|        for (j = 0; j < cblk_h; ++j) {
  ------------------
  |  Branch (1798:21): [True: 398k, False: 59.7k]
  ------------------
 1799|   398k|            i = 0;
 1800|  1.99M|            for (; i < (cblk_w & ~(OPJ_UINT32)3U); i += 4U) {
  ------------------
  |  Branch (1800:20): [True: 1.59M, False: 398k]
  ------------------
 1801|  1.59M|                OPJ_INT32 tmp0 = datap[(j * cblk_w) + i + 0U];
 1802|  1.59M|                OPJ_INT32 tmp1 = datap[(j * cblk_w) + i + 1U];
 1803|  1.59M|                OPJ_INT32 tmp2 = datap[(j * cblk_w) + i + 2U];
 1804|  1.59M|                OPJ_INT32 tmp3 = datap[(j * cblk_w) + i + 3U];
 1805|  1.59M|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i + 0U] = tmp0 / 2;
 1806|  1.59M|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i + 1U] = tmp1 / 2;
 1807|  1.59M|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i + 2U] = tmp2 / 2;
 1808|  1.59M|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i + 3U] = tmp3 / 2;
 1809|  1.59M|            }
 1810|   672k|            for (; i < cblk_w; ++i) {
  ------------------
  |  Branch (1810:20): [True: 273k, False: 398k]
  ------------------
 1811|   273k|                OPJ_INT32 tmp = datap[(j * cblk_w) + i];
 1812|   273k|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i] = tmp / 2;
 1813|   273k|            }
 1814|   398k|        }
 1815|   735k|    } else {        /* if (tccp->qmfbid == 0) */
 1816|   735k|        const float stepsize = 0.5f * band->stepsize;
 1817|   735k|        OPJ_FLOAT32* OPJ_RESTRICT tiledp = (OPJ_FLOAT32*) &tilec->data[(OPJ_SIZE_T)y *
 1818|   735k|                                                         tile_w + (OPJ_SIZE_T)x];
 1819|  15.7M|        for (j = 0; j < cblk_h; ++j) {
  ------------------
  |  Branch (1819:21): [True: 15.0M, False: 735k]
  ------------------
 1820|  15.0M|            OPJ_FLOAT32* OPJ_RESTRICT tiledp2 = tiledp;
 1821|   157M|            for (i = 0; i < cblk_w; ++i) {
  ------------------
  |  Branch (1821:25): [True: 142M, False: 15.0M]
  ------------------
 1822|   142M|                OPJ_FLOAT32 tmp = (OPJ_FLOAT32) * datap * stepsize;
 1823|   142M|                *tiledp2 = tmp;
 1824|   142M|                datap++;
 1825|   142M|                tiledp2++;
 1826|   142M|            }
 1827|  15.0M|            tiledp += tile_w;
 1828|  15.0M|        }
 1829|   735k|    }
 1830|       |
 1831|  1.64M|    opj_free(job);
 1832|  1.64M|}
t1.c:opj_t1_destroy_wrapper:
 1603|  5.97k|{
 1604|  5.97k|    opj_t1_destroy((opj_t1_t*) t1);
 1605|  5.97k|}
t1.c:opj_t1_decode_cblk:
 1969|  1.61M|{
 1970|  1.61M|    opj_mqc_t *mqc = &(t1->mqc);   /* MQC component */
 1971|       |
 1972|  1.61M|    OPJ_INT32 bpno_plus_one;
 1973|  1.61M|    OPJ_UINT32 passtype;
 1974|  1.61M|    OPJ_UINT32 segno, passno;
 1975|  1.61M|    OPJ_BYTE* cblkdata = NULL;
 1976|  1.61M|    OPJ_UINT32 cblkdataindex = 0;
 1977|  1.61M|    OPJ_BYTE type = T1_TYPE_MQ; /* BYPASS mode */
  ------------------
  |  |   70|  1.61M|#define T1_TYPE_MQ 0    /**< Normal coding using entropy coder */
  ------------------
 1978|  1.61M|    OPJ_INT32* original_t1_data = NULL;
 1979|       |
 1980|  1.61M|    mqc->lut_ctxno_zc_orient = lut_ctxno_zc + (orient << 9);
 1981|       |
 1982|  1.61M|    if (!opj_t1_allocate_buffers(
  ------------------
  |  Branch (1982:9): [True: 0, False: 1.61M]
  ------------------
 1983|  1.61M|                t1,
 1984|  1.61M|                (OPJ_UINT32)(cblk->x1 - cblk->x0),
 1985|  1.61M|                (OPJ_UINT32)(cblk->y1 - cblk->y0))) {
 1986|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1987|      0|    }
 1988|       |
 1989|  1.61M|    bpno_plus_one = (OPJ_INT32)(roishift + cblk->numbps);
 1990|  1.61M|    if (bpno_plus_one >= 31) {
  ------------------
  |  Branch (1990:9): [True: 71, False: 1.61M]
  ------------------
 1991|     71|        if (p_manager_mutex) {
  ------------------
  |  Branch (1991:13): [True: 71, False: 0]
  ------------------
 1992|     71|            opj_mutex_lock(p_manager_mutex);
 1993|     71|        }
 1994|     71|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|     71|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1995|     71|                      "opj_t1_decode_cblk(): unsupported bpno_plus_one = %d >= 31\n",
 1996|     71|                      bpno_plus_one);
 1997|     71|        if (p_manager_mutex) {
  ------------------
  |  Branch (1997:13): [True: 71, False: 0]
  ------------------
 1998|     71|            opj_mutex_unlock(p_manager_mutex);
 1999|     71|        }
 2000|     71|        return OPJ_FALSE;
  ------------------
  |  |  118|     71|#define OPJ_FALSE 0
  ------------------
 2001|     71|    }
 2002|  1.61M|    passtype = 2;
 2003|       |
 2004|  1.61M|    opj_mqc_resetstates(mqc);
 2005|  1.61M|    opj_mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46);
  ------------------
  |  |   65|  1.61M|#define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
  |  |  ------------------
  |  |  |  |   64|  1.61M|#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  |  |  ------------------
  |  |  |  |  |  |   63|  1.61M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|  1.61M|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   61|  1.61M|#define T1_CTXNO_ZC  0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   55|  1.61M|#define T1_NUMCTXS_ZC  9
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|  1.61M|#define T1_NUMCTXS_SC  5
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|  1.61M|#define T1_NUMCTXS_MAG 3
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
  |  |  ------------------
  |  |  |  |   58|  1.61M|#define T1_NUMCTXS_AGG 1
  |  |  ------------------
  ------------------
 2006|  1.61M|    opj_mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3);
  ------------------
  |  |   64|  1.61M|#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  ------------------
  |  |  |  |   63|  1.61M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  1.61M|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   61|  1.61M|#define T1_CTXNO_ZC  0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.61M|#define T1_NUMCTXS_ZC  9
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|  1.61M|#define T1_NUMCTXS_SC  5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  ------------------
  |  |  |  |   57|  1.61M|#define T1_NUMCTXS_MAG 3
  |  |  ------------------
  ------------------
 2007|  1.61M|    opj_mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4);
  ------------------
  |  |   61|  1.61M|#define T1_CTXNO_ZC  0
  ------------------
 2008|       |
 2009|       |    /* Even if we have a single chunk, in multi-threaded decoding */
 2010|       |    /* the insertion of our synthetic marker might potentially override */
 2011|       |    /* valid codestream of other codeblocks decoded in parallel. */
 2012|  1.61M|    if (cblk->numchunks > 1 || t1->mustuse_cblkdatabuffer) {
  ------------------
  |  Branch (2012:9): [True: 35.8k, False: 1.57M]
  |  Branch (2012:32): [True: 0, False: 1.57M]
  ------------------
 2013|  35.8k|        OPJ_UINT32 i;
 2014|  35.8k|        OPJ_UINT32 cblk_len;
 2015|       |
 2016|       |        /* Compute whole codeblock length from chunk lengths */
 2017|  35.8k|        cblk_len = 0;
 2018|   244k|        for (i = 0; i < cblk->numchunks; i++) {
  ------------------
  |  Branch (2018:21): [True: 208k, False: 35.8k]
  ------------------
 2019|   208k|            cblk_len += cblk->chunks[i].len;
 2020|   208k|        }
 2021|       |
 2022|       |        /* Allocate temporary memory if needed */
 2023|  35.8k|        if (cblk_len + OPJ_COMMON_CBLK_DATA_EXTRA > t1->cblkdatabuffersize) {
  ------------------
  |  |   39|  35.8k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
  |  Branch (2023:13): [True: 4.07k, False: 31.7k]
  ------------------
 2024|  4.07k|            cblkdata = (OPJ_BYTE*)opj_realloc(t1->cblkdatabuffer,
 2025|  4.07k|                                              cblk_len + OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|  4.07k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2026|  4.07k|            if (cblkdata == NULL) {
  ------------------
  |  Branch (2026:17): [True: 0, False: 4.07k]
  ------------------
 2027|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2028|      0|            }
 2029|  4.07k|            t1->cblkdatabuffer = cblkdata;
 2030|  4.07k|            memset(t1->cblkdatabuffer + cblk_len, 0, OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|  4.07k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2031|  4.07k|            t1->cblkdatabuffersize = cblk_len + OPJ_COMMON_CBLK_DATA_EXTRA;
  ------------------
  |  |   39|  4.07k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2032|  4.07k|        }
 2033|       |
 2034|       |        /* Concatenate all chunks */
 2035|  35.8k|        cblkdata = t1->cblkdatabuffer;
 2036|  35.8k|        cblk_len = 0;
 2037|   244k|        for (i = 0; i < cblk->numchunks; i++) {
  ------------------
  |  Branch (2037:21): [True: 208k, False: 35.8k]
  ------------------
 2038|   208k|            memcpy(cblkdata + cblk_len, cblk->chunks[i].data, cblk->chunks[i].len);
 2039|   208k|            cblk_len += cblk->chunks[i].len;
 2040|   208k|        }
 2041|  1.57M|    } else if (cblk->numchunks == 1) {
  ------------------
  |  Branch (2041:16): [True: 110k, False: 1.46M]
  ------------------
 2042|   110k|        cblkdata = cblk->chunks[0].data;
 2043|  1.46M|    } else {
 2044|       |        /* Not sure if that can happen in practice, but avoid Coverity to */
 2045|       |        /* think we will dereference a null cblkdta pointer */
 2046|  1.46M|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.46M|#define OPJ_TRUE 1
  ------------------
 2047|  1.46M|    }
 2048|       |
 2049|       |    /* For subtile decoding, directly decode in the decoded_data buffer of */
 2050|       |    /* the code-block. Hack t1->data to point to it, and restore it later */
 2051|   146k|    if (cblk->decoded_data) {
  ------------------
  |  Branch (2051:9): [True: 57.2k, False: 89.2k]
  ------------------
 2052|  57.2k|        original_t1_data = t1->data;
 2053|  57.2k|        t1->data = cblk->decoded_data;
 2054|  57.2k|    }
 2055|       |
 2056|   404k|    for (segno = 0; segno < cblk->real_num_segs; ++segno) {
  ------------------
  |  Branch (2056:21): [True: 257k, False: 146k]
  ------------------
 2057|   257k|        opj_tcd_seg_t *seg = &cblk->segs[segno];
 2058|       |
 2059|       |        /* BYPASS mode */
 2060|   257k|        type = ((bpno_plus_one <= ((OPJ_INT32)(cblk->numbps)) - 4) && (passtype < 2) &&
  ------------------
  |  Branch (2060:17): [True: 96.9k, False: 160k]
  |  Branch (2060:71): [True: 86.1k, False: 10.8k]
  ------------------
 2061|   257k|                (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
  ------------------
  |  |   58|  86.1k|#define J2K_CCP_CBLKSTY_LAZY 0x01     /**< Selective arithmetic coding bypass */
  ------------------
                              (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
  ------------------
  |  |   71|  28.3k|#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|   487k|#define T1_TYPE_MQ 0    /**< Normal coding using entropy coder */
  ------------------
  |  Branch (2061:17): [True: 28.3k, False: 57.7k]
  ------------------
 2062|       |
 2063|   257k|        if (type == T1_TYPE_RAW) {
  ------------------
  |  |   71|   257k|#define T1_TYPE_RAW 1   /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
  ------------------
  |  Branch (2063:13): [True: 28.3k, False: 229k]
  ------------------
 2064|  28.3k|            opj_mqc_raw_init_dec(mqc, cblkdata + cblkdataindex, seg->len,
 2065|  28.3k|                                 OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|  28.3k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2066|   229k|        } else {
 2067|   229k|            opj_mqc_init_dec(mqc, cblkdata + cblkdataindex, seg->len,
 2068|   229k|                             OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|   229k|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2069|   229k|        }
 2070|   257k|        cblkdataindex += seg->len;
 2071|       |
 2072|  1.68M|        for (passno = 0; (passno < seg->real_num_passes) &&
  ------------------
  |  Branch (2072:26): [True: 1.52M, False: 158k]
  ------------------
 2073|  1.68M|                (bpno_plus_one >= 1); ++passno) {
  ------------------
  |  Branch (2073:17): [True: 1.42M, False: 98.8k]
  ------------------
 2074|  1.42M|            switch (passtype) {
  ------------------
  |  Branch (2074:21): [True: 0, False: 1.42M]
  ------------------
 2075|   463k|            case 0:
  ------------------
  |  Branch (2075:13): [True: 463k, False: 965k]
  ------------------
 2076|   463k|                if (type == T1_TYPE_RAW) {
  ------------------
  |  |   71|   463k|#define T1_TYPE_RAW 1   /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
  ------------------
  |  Branch (2076:21): [True: 11.2k, False: 452k]
  ------------------
 2077|  11.2k|                    opj_t1_dec_sigpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty);
 2078|   452k|                } else {
 2079|   452k|                    opj_t1_dec_sigpass_mqc(t1, bpno_plus_one, (OPJ_INT32)cblksty);
 2080|   452k|                }
 2081|   463k|                break;
 2082|   442k|            case 1:
  ------------------
  |  Branch (2082:13): [True: 442k, False: 986k]
  ------------------
 2083|   442k|                if (type == T1_TYPE_RAW) {
  ------------------
  |  |   71|   442k|#define T1_TYPE_RAW 1   /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
  ------------------
  |  Branch (2083:21): [True: 10.8k, False: 431k]
  ------------------
 2084|  10.8k|                    opj_t1_dec_refpass_raw(t1, bpno_plus_one);
 2085|   431k|                } else {
 2086|   431k|                    opj_t1_dec_refpass_mqc(t1, bpno_plus_one);
 2087|   431k|                }
 2088|   442k|                break;
 2089|   522k|            case 2:
  ------------------
  |  Branch (2089:13): [True: 522k, False: 906k]
  ------------------
 2090|   522k|                opj_t1_dec_clnpass(t1, bpno_plus_one, (OPJ_INT32)cblksty);
 2091|   522k|                break;
 2092|  1.42M|            }
 2093|       |
 2094|  1.42M|            if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) {
  ------------------
  |  |   59|  1.42M|#define J2K_CCP_CBLKSTY_RESET 0x02    /**< Reset context probabilities on coding pass boundaries */
  ------------------
                          if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) {
  ------------------
  |  |   70|  1.02M|#define T1_TYPE_MQ 0    /**< Normal coding using entropy coder */
  ------------------
  |  Branch (2094:17): [True: 1.02M, False: 405k]
  |  Branch (2094:54): [True: 1.01M, False: 12.2k]
  ------------------
 2095|  1.01M|                opj_mqc_resetstates(mqc);
 2096|  1.01M|                opj_mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46);
  ------------------
  |  |   65|  1.01M|#define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
  |  |  ------------------
  |  |  |  |   64|  1.01M|#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  |  |  ------------------
  |  |  |  |  |  |   63|  1.01M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|  1.01M|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   61|  1.01M|#define T1_CTXNO_ZC  0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   55|  1.01M|#define T1_NUMCTXS_ZC  9
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|  1.01M|#define T1_NUMCTXS_SC  5
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|  1.01M|#define T1_NUMCTXS_MAG 3
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
  |  |  ------------------
  |  |  |  |   58|  1.01M|#define T1_NUMCTXS_AGG 1
  |  |  ------------------
  ------------------
 2097|  1.01M|                opj_mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3);
  ------------------
  |  |   64|  1.01M|#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  ------------------
  |  |  |  |   63|  1.01M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  1.01M|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   61|  1.01M|#define T1_CTXNO_ZC  0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.01M|#define T1_NUMCTXS_ZC  9
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|  1.01M|#define T1_NUMCTXS_SC  5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  ------------------
  |  |  |  |   57|  1.01M|#define T1_NUMCTXS_MAG 3
  |  |  ------------------
  ------------------
 2098|  1.01M|                opj_mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4);
  ------------------
  |  |   61|  1.01M|#define T1_CTXNO_ZC  0
  ------------------
 2099|  1.01M|            }
 2100|  1.42M|            if (++passtype == 3) {
  ------------------
  |  Branch (2100:17): [True: 522k, False: 906k]
  ------------------
 2101|   522k|                passtype = 0;
 2102|   522k|                bpno_plus_one--;
 2103|   522k|            }
 2104|  1.42M|        }
 2105|       |
 2106|   257k|        opq_mqc_finish_dec(mqc);
 2107|   257k|    }
 2108|       |
 2109|   146k|    if (check_pterm) {
  ------------------
  |  Branch (2109:9): [True: 67.1k, False: 79.3k]
  ------------------
 2110|  67.1k|        if (mqc->bp + 2 < mqc->end) {
  ------------------
  |  Branch (2110:13): [True: 10.1k, False: 57.0k]
  ------------------
 2111|  10.1k|            if (p_manager_mutex) {
  ------------------
  |  Branch (2111:17): [True: 10.1k, False: 0]
  ------------------
 2112|  10.1k|                opj_mutex_lock(p_manager_mutex);
 2113|  10.1k|            }
 2114|  10.1k|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  10.1k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2115|  10.1k|                          "PTERM check failure: %d remaining bytes in code block (%d used / %d)\n",
 2116|  10.1k|                          (int)(mqc->end - mqc->bp) - 2,
 2117|  10.1k|                          (int)(mqc->bp - mqc->start),
 2118|  10.1k|                          (int)(mqc->end - mqc->start));
 2119|  10.1k|            if (p_manager_mutex) {
  ------------------
  |  Branch (2119:17): [True: 10.1k, False: 0]
  ------------------
 2120|  10.1k|                opj_mutex_unlock(p_manager_mutex);
 2121|  10.1k|            }
 2122|  57.0k|        } else if (mqc->end_of_byte_stream_counter > 2) {
  ------------------
  |  Branch (2122:20): [True: 33.1k, False: 23.9k]
  ------------------
 2123|  33.1k|            if (p_manager_mutex) {
  ------------------
  |  Branch (2123:17): [True: 33.1k, False: 0]
  ------------------
 2124|  33.1k|                opj_mutex_lock(p_manager_mutex);
 2125|  33.1k|            }
 2126|  33.1k|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  33.1k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2127|  33.1k|                          "PTERM check failure: %d synthetized 0xFF markers read\n",
 2128|  33.1k|                          mqc->end_of_byte_stream_counter);
 2129|  33.1k|            if (p_manager_mutex) {
  ------------------
  |  Branch (2129:17): [True: 33.1k, False: 0]
  ------------------
 2130|  33.1k|                opj_mutex_unlock(p_manager_mutex);
 2131|  33.1k|            }
 2132|  33.1k|        }
 2133|  67.1k|    }
 2134|       |
 2135|       |    /* Restore original t1->data is needed */
 2136|   146k|    if (cblk->decoded_data) {
  ------------------
  |  Branch (2136:9): [True: 57.2k, False: 89.2k]
  ------------------
 2137|  57.2k|        t1->data = original_t1_data;
 2138|  57.2k|    }
 2139|       |
 2140|   146k|    return OPJ_TRUE;
  ------------------
  |  |  117|   146k|#define OPJ_TRUE 1
  ------------------
 2141|   146k|}
t1.c:opj_t1_allocate_buffers:
 1452|  1.61M|{
 1453|  1.61M|    OPJ_UINT32 flagssize;
 1454|  1.61M|    OPJ_UINT32 flags_stride;
 1455|       |
 1456|       |    /* No risk of overflow. Prior checks ensure those assert are met */
 1457|       |    /* They are per the specification */
 1458|  1.61M|    assert(w <= 1024);
 1459|  1.61M|    assert(h <= 1024);
 1460|  1.61M|    assert(w * h <= 4096);
 1461|       |
 1462|       |    /* encoder uses tile buffer, so no need to allocate */
 1463|  1.61M|    {
 1464|  1.61M|        OPJ_UINT32 datasize = w * h;
 1465|       |
 1466|  1.61M|        if (datasize > t1->datasize) {
  ------------------
  |  Branch (1466:13): [True: 12.8k, False: 1.60M]
  ------------------
 1467|  12.8k|            opj_aligned_free(t1->data);
 1468|  12.8k|            t1->data = (OPJ_INT32*) opj_aligned_malloc(datasize * sizeof(OPJ_INT32));
 1469|  12.8k|            if (!t1->data) {
  ------------------
  |  Branch (1469:17): [True: 0, False: 12.8k]
  ------------------
 1470|       |                /* FIXME event manager error callback */
 1471|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1472|      0|            }
 1473|  12.8k|            t1->datasize = datasize;
 1474|  12.8k|        }
 1475|       |        /* memset first arg is declared to never be null by gcc */
 1476|  1.61M|        if (t1->data != NULL) {
  ------------------
  |  Branch (1476:13): [True: 1.61M, False: 427]
  ------------------
 1477|  1.61M|            memset(t1->data, 0, datasize * sizeof(OPJ_INT32));
 1478|  1.61M|        }
 1479|  1.61M|    }
 1480|       |
 1481|      0|    flags_stride = w + 2U; /* can't be 0U */
 1482|       |
 1483|  1.61M|    flagssize = (h + 3U) / 4U + 2U;
 1484|       |
 1485|  1.61M|    flagssize *= flags_stride;
 1486|  1.61M|    {
 1487|  1.61M|        opj_flag_t* p;
 1488|  1.61M|        OPJ_UINT32 x;
 1489|  1.61M|        OPJ_UINT32 flags_height = (h + 3U) / 4U;
 1490|       |
 1491|  1.61M|        if (flagssize > t1->flagssize) {
  ------------------
  |  Branch (1491:13): [True: 96.6k, False: 1.51M]
  ------------------
 1492|       |
 1493|  96.6k|            opj_aligned_free(t1->flags);
 1494|  96.6k|            t1->flags = (opj_flag_t*) opj_aligned_malloc(flagssize * sizeof(
 1495|  96.6k|                            opj_flag_t));
 1496|  96.6k|            if (!t1->flags) {
  ------------------
  |  Branch (1496:17): [True: 0, False: 96.6k]
  ------------------
 1497|       |                /* FIXME event manager error callback */
 1498|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1499|      0|            }
 1500|  96.6k|        }
 1501|  1.61M|        t1->flagssize = flagssize;
 1502|       |
 1503|  1.61M|        memset(t1->flags, 0, flagssize * sizeof(opj_flag_t));
 1504|       |
 1505|  1.61M|        p = &t1->flags[0];
 1506|  45.1M|        for (x = 0; x < flags_stride; ++x) {
  ------------------
  |  Branch (1506:21): [True: 43.4M, False: 1.61M]
  ------------------
 1507|       |            /* magic value to hopefully stop any passes being interested in this entry */
 1508|  43.4M|            *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  115|  43.4M|#define T1_PI_0     (1U << 21)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  119|  43.4M|#define T1_PI_1     (1U << 24)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  122|  43.4M|#define T1_PI_2     (1U << 27)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  125|  43.4M|#define T1_PI_3     (1U << 30)
  ------------------
 1509|  43.4M|        }
 1510|       |
 1511|  1.61M|        p = &t1->flags[((flags_height + 1) * flags_stride)];
 1512|  45.1M|        for (x = 0; x < flags_stride; ++x) {
  ------------------
  |  Branch (1512:21): [True: 43.4M, False: 1.61M]
  ------------------
 1513|       |            /* magic value to hopefully stop any passes being interested in this entry */
 1514|  43.4M|            *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  115|  43.4M|#define T1_PI_0     (1U << 21)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  119|  43.4M|#define T1_PI_1     (1U << 24)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  122|  43.4M|#define T1_PI_2     (1U << 27)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  125|  43.4M|#define T1_PI_3     (1U << 30)
  ------------------
 1515|  43.4M|        }
 1516|       |
 1517|  1.61M|        if (h % 4) {
  ------------------
  |  Branch (1517:13): [True: 239k, False: 1.37M]
  ------------------
 1518|   239k|            OPJ_UINT32 v = 0;
 1519|   239k|            p = &t1->flags[((flags_height) * flags_stride)];
 1520|   239k|            if (h % 4 == 1) {
  ------------------
  |  Branch (1520:17): [True: 115k, False: 124k]
  ------------------
 1521|   115k|                v |= T1_PI_1 | T1_PI_2 | T1_PI_3;
  ------------------
  |  |  119|   115k|#define T1_PI_1     (1U << 24)
  ------------------
                              v |= T1_PI_1 | T1_PI_2 | T1_PI_3;
  ------------------
  |  |  122|   115k|#define T1_PI_2     (1U << 27)
  ------------------
                              v |= T1_PI_1 | T1_PI_2 | T1_PI_3;
  ------------------
  |  |  125|   115k|#define T1_PI_3     (1U << 30)
  ------------------
 1522|   124k|            } else if (h % 4 == 2) {
  ------------------
  |  Branch (1522:24): [True: 75.6k, False: 48.4k]
  ------------------
 1523|  75.6k|                v |= T1_PI_2 | T1_PI_3;
  ------------------
  |  |  122|  75.6k|#define T1_PI_2     (1U << 27)
  ------------------
                              v |= T1_PI_2 | T1_PI_3;
  ------------------
  |  |  125|  75.6k|#define T1_PI_3     (1U << 30)
  ------------------
 1524|  75.6k|            } else if (h % 4 == 3) {
  ------------------
  |  Branch (1524:24): [True: 48.4k, False: 0]
  ------------------
 1525|  48.4k|                v |= T1_PI_3;
  ------------------
  |  |  125|  48.4k|#define T1_PI_3     (1U << 30)
  ------------------
 1526|  48.4k|            }
 1527|  4.99M|            for (x = 0; x < flags_stride; ++x) {
  ------------------
  |  Branch (1527:25): [True: 4.75M, False: 239k]
  ------------------
 1528|  4.75M|                *p++ = v;
 1529|  4.75M|            }
 1530|   239k|        }
 1531|  1.61M|    }
 1532|       |
 1533|      0|    t1->w = w;
 1534|  1.61M|    t1->h = h;
 1535|       |
 1536|  1.61M|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.61M|#define OPJ_TRUE 1
  ------------------
 1537|  1.61M|}
t1.c:opj_t1_dec_sigpass_raw:
  583|  11.2k|{
  584|  11.2k|    OPJ_INT32 one, half, oneplushalf;
  585|  11.2k|    OPJ_UINT32 i, j, k;
  586|  11.2k|    OPJ_INT32 *data = t1->data;
  587|  11.2k|    opj_flag_t *flagsp = &T1_FLAGS(0, 0);
  ------------------
  |  |   60|  11.2k|#define T1_FLAGS(x, y) (t1->flags[x + 1 + ((y / 4) + 1) * (t1->w+2)])
  ------------------
  588|  11.2k|    const OPJ_UINT32 l_w = t1->w;
  589|  11.2k|    one = 1 << bpno;
  590|  11.2k|    half = one >> 1;
  591|  11.2k|    oneplushalf = one | half;
  592|       |
  593|   122k|    for (k = 0; k < (t1->h & ~3U); k += 4, flagsp += 2, data += 3 * l_w) {
  ------------------
  |  Branch (593:17): [True: 111k, False: 11.2k]
  ------------------
  594|  7.72M|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) {
  ------------------
  |  Branch (594:21): [True: 7.61M, False: 111k]
  ------------------
  595|  7.61M|            opj_flag_t flags = *flagsp;
  596|  7.61M|            if (flags != 0) {
  ------------------
  |  Branch (596:17): [True: 7.11M, False: 493k]
  ------------------
  597|  7.11M|                opj_t1_dec_sigpass_step_raw(
  598|  7.11M|                    t1,
  599|  7.11M|                    flagsp,
  600|  7.11M|                    data,
  601|  7.11M|                    oneplushalf,
  602|  7.11M|                    cblksty & J2K_CCP_CBLKSTY_VSC, /* vsc */
  ------------------
  |  |   61|  7.11M|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  603|  7.11M|                    0U);
  604|  7.11M|                opj_t1_dec_sigpass_step_raw(
  605|  7.11M|                    t1,
  606|  7.11M|                    flagsp,
  607|  7.11M|                    data + l_w,
  608|  7.11M|                    oneplushalf,
  609|  7.11M|                    OPJ_FALSE, /* vsc */
  ------------------
  |  |  118|  7.11M|#define OPJ_FALSE 0
  ------------------
  610|  7.11M|                    1U);
  611|  7.11M|                opj_t1_dec_sigpass_step_raw(
  612|  7.11M|                    t1,
  613|  7.11M|                    flagsp,
  614|  7.11M|                    data + 2 * l_w,
  615|  7.11M|                    oneplushalf,
  616|  7.11M|                    OPJ_FALSE, /* vsc */
  ------------------
  |  |  118|  7.11M|#define OPJ_FALSE 0
  ------------------
  617|  7.11M|                    2U);
  618|  7.11M|                opj_t1_dec_sigpass_step_raw(
  619|  7.11M|                    t1,
  620|  7.11M|                    flagsp,
  621|  7.11M|                    data + 3 * l_w,
  622|  7.11M|                    oneplushalf,
  623|  7.11M|                    OPJ_FALSE, /* vsc */
  ------------------
  |  |  118|  7.11M|#define OPJ_FALSE 0
  ------------------
  624|  7.11M|                    3U);
  625|  7.11M|            }
  626|  7.61M|        }
  627|   111k|    }
  628|  11.2k|    if (k < t1->h) {
  ------------------
  |  Branch (628:9): [True: 3.34k, False: 7.94k]
  ------------------
  629|   865k|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) {
  ------------------
  |  Branch (629:21): [True: 862k, False: 3.34k]
  ------------------
  630|  2.14M|            for (j = 0; j < t1->h - k; ++j) {
  ------------------
  |  Branch (630:25): [True: 1.27M, False: 862k]
  ------------------
  631|  1.27M|                opj_t1_dec_sigpass_step_raw(
  632|  1.27M|                    t1,
  633|  1.27M|                    flagsp,
  634|  1.27M|                    data + j * l_w,
  635|  1.27M|                    oneplushalf,
  636|  1.27M|                    cblksty & J2K_CCP_CBLKSTY_VSC, /* vsc */
  ------------------
  |  |   61|  1.27M|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  637|  1.27M|                    j);
  638|  1.27M|            }
  639|   862k|        }
  640|  3.34k|    }
  641|  11.2k|}
t1.c:opj_t1_dec_sigpass_step_raw:
  416|  29.7M|{
  417|  29.7M|    OPJ_UINT32 v;
  418|  29.7M|    opj_mqc_t *mqc = &(t1->mqc);       /* RAW component */
  419|       |
  420|  29.7M|    OPJ_UINT32 const flags = *flagsp;
  421|       |
  422|  29.7M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U &&
  ------------------
  |  |  153|  29.7M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  ------------------
  |  |  |  |   95|  29.7M|#define T1_SIGMA_4  (1U << 4)
  |  |  ------------------
  ------------------
                  if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U &&
  ------------------
  |  |  163|  29.7M|#define T1_PI_THIS    T1_PI_0
  |  |  ------------------
  |  |  |  |  115|  29.7M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  ------------------
  |  Branch (422:9): [True: 1.58M, False: 28.1M]
  ------------------
  423|  29.7M|            (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) {
  ------------------
  |  |  158|  1.58M|#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.58M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.58M|#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.58M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  1.58M|#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.58M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  1.58M|#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.58M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  1.58M|#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.58M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  1.58M|#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.58M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|  1.58M|#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.58M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|  1.58M|#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.58M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|  1.58M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (423:13): [True: 1.36M, False: 229k]
  ------------------
  424|  1.36M|        if (opj_mqc_raw_decode(mqc)) {
  ------------------
  |  Branch (424:13): [True: 1.18M, False: 175k]
  ------------------
  425|  1.18M|            v = opj_mqc_raw_decode(mqc);
  426|  1.18M|            *datap = v ? -oneplushalf : oneplushalf;
  ------------------
  |  Branch (426:22): [True: 1.16M, False: 21.3k]
  ------------------
  427|  1.18M|            opj_t1_update_flags(flagsp, ci, v, t1->w + 2, vsc);
  428|  1.18M|        }
  429|  1.36M|        *flagsp |= T1_PI_THIS << (ci * 3U);
  ------------------
  |  |  163|  1.36M|#define T1_PI_THIS    T1_PI_0
  |  |  ------------------
  |  |  |  |  115|  1.36M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  ------------------
  430|  1.36M|    }
  431|  29.7M|}
t1.c:opj_t1_update_flags:
  353|  1.18M|{
  354|  1.18M|    opj_t1_update_flags_macro(*flagsp, flagsp, ci, s, stride, vsc);
  ------------------
  |  |  321|  1.18M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  322|  1.18M|{ \
  |  |  323|  1.18M|    /* east */ \
  |  |  324|  1.18M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  ------------------
  |  |  |  |   96|  1.18M|#define T1_SIGMA_5  (1U << 5)
  |  |  ------------------
  |  |  325|  1.18M| \
  |  |  326|  1.18M|    /* mark target as significant */ \
  |  |  327|  1.18M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  ------------------
  |  |  |  |  113|  1.18M|#define T1_CHI_1_I  19
  |  |  ------------------
  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  ------------------
  |  |  |  |   95|  1.18M|#define T1_SIGMA_4  (1U << 4)
  |  |  ------------------
  |  |  328|  1.18M| \
  |  |  329|  1.18M|    /* west */ \
  |  |  330|  1.18M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  ------------------
  |  |  |  |   94|  1.18M|#define T1_SIGMA_3  (1U << 3)
  |  |  ------------------
  |  |  331|  1.18M| \
  |  |  332|  1.18M|    /* north-west, north, north-east */ \
  |  |  333|  1.18M|    if (ci == 0U && !(vsc)) { \
  |  |  ------------------
  |  |  |  Branch (333:9): [True: 313k, False: 872k]
  |  |  |  Branch (333:21): [True: 139k, False: 173k]
  |  |  ------------------
  |  |  334|   139k|        opj_flag_t* north = flagsp - (stride); \
  |  |  335|   139k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  ------------------
  |  |  |  |  127|   139k|#define T1_CHI_5_I  31
  |  |  ------------------
  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  ------------------
  |  |  |  |  107|   139k|#define T1_SIGMA_16 (1U << 16)
  |  |  ------------------
  |  |  336|   139k|        north[-1] |= T1_SIGMA_17; \
  |  |  ------------------
  |  |  |  |  108|   139k|#define T1_SIGMA_17 (1U << 17)
  |  |  ------------------
  |  |  337|   139k|        north[1] |= T1_SIGMA_15; \
  |  |  ------------------
  |  |  |  |  106|   139k|#define T1_SIGMA_15 (1U << 15)
  |  |  ------------------
  |  |  338|   139k|    } \
  |  |  339|  1.18M| \
  |  |  340|  1.18M|    /* south-west, south, south-east */ \
  |  |  341|  1.18M|    if (ci == 3U) { \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 290k, False: 894k]
  |  |  ------------------
  |  |  342|   290k|        opj_flag_t* south = flagsp + (stride); \
  |  |  343|   290k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  ------------------
  |  |  |  |  111|   290k|#define T1_CHI_0_I  18
  |  |  ------------------
  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  ------------------
  |  |  |  |   92|   290k|#define T1_SIGMA_1  (1U << 1)
  |  |  ------------------
  |  |  344|   290k|        south[-1] |= T1_SIGMA_2; \
  |  |  ------------------
  |  |  |  |   93|   290k|#define T1_SIGMA_2  (1U << 2)
  |  |  ------------------
  |  |  345|   290k|        south[1] |= T1_SIGMA_0; \
  |  |  ------------------
  |  |  |  |   91|   290k|#define T1_SIGMA_0  (1U << 0)
  |  |  ------------------
  |  |  346|   290k|    } \
  |  |  347|  1.18M|}
  ------------------
  355|  1.18M|}
t1.c:opj_t1_dec_sigpass_mqc:
  721|   452k|{
  722|   452k|    if (t1->w == 64 && t1->h == 64) {
  ------------------
  |  Branch (722:9): [True: 106k, False: 346k]
  |  Branch (722:24): [True: 80.5k, False: 25.8k]
  ------------------
  723|  80.5k|        if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  ------------------
  |  |   61|  80.5k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  |  Branch (723:13): [True: 45.1k, False: 35.4k]
  ------------------
  724|  45.1k|            opj_t1_dec_sigpass_mqc_64x64_vsc(t1, bpno);
  725|  45.1k|        } else {
  726|  35.4k|            opj_t1_dec_sigpass_mqc_64x64_novsc(t1, bpno);
  727|  35.4k|        }
  728|   372k|    } else {
  729|   372k|        if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  ------------------
  |  |   61|   372k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  |  Branch (729:13): [True: 191k, False: 180k]
  ------------------
  730|   191k|            opj_t1_dec_sigpass_mqc_generic_vsc(t1, bpno);
  731|   191k|        } else {
  732|   180k|            opj_t1_dec_sigpass_mqc_generic_novsc(t1, bpno);
  733|   180k|        }
  734|   372k|    }
  735|   452k|}
t1.c:opj_t1_dec_sigpass_mqc_64x64_vsc:
  697|  45.1k|{
  698|  45.1k|    opj_t1_dec_sigpass_mqc_internal(t1, bpno, OPJ_TRUE, 64, 64, 66);
  ------------------
  |  |  643|  45.1k|#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  |  644|  45.1k|{ \
  |  |  645|  45.1k|        OPJ_INT32 one, half, oneplushalf; \
  |  |  646|  45.1k|        OPJ_UINT32 i, j, k; \
  |  |  647|  45.1k|        register OPJ_INT32 *data = t1->data; \
  |  |  648|  45.1k|        register opj_flag_t *flagsp = &t1->flags[(flags_stride) + 1]; \
  |  |  649|  45.1k|        const OPJ_UINT32 l_w = w; \
  |  |  650|  45.1k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  651|  45.1k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  45.1k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  45.1k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  45.1k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  45.1k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  652|  45.1k|        register OPJ_UINT32 v; \
  |  |  653|  45.1k|        one = 1 << bpno; \
  |  |  654|  45.1k|        half = one >> 1; \
  |  |  655|  45.1k|        oneplushalf = one | half; \
  |  |  656|   766k|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (656:21): [True: 721k, False: 45.1k]
  |  |  ------------------
  |  |  657|  46.9M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (657:29): [True: 46.1M, False: 721k]
  |  |  ------------------
  |  |  658|  46.1M|                        opj_flag_t flags = *flagsp; \
  |  |  659|  46.1M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (659:29): [True: 36.1M, False: 10.0M]
  |  |  ------------------
  |  |  660|  36.1M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  36.1M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  36.1M|{ \
  |  |  |  |  437|  36.1M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  36.1M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  36.1M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  36.1M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  36.1M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 8.76M, False: 27.4M]
  |  |  |  |  ------------------
  |  |  |  |  438|  36.1M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  8.76M|#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|  8.76M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  8.76M|#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|  8.76M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  8.76M|#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|  8.76M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  8.76M|#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|  8.76M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  8.76M|#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|  8.76M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  8.76M|#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|  8.76M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  8.76M|#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|  8.76M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  8.76M|#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|  8.76M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  8.76M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 8.47M, False: 289k]
  |  |  |  |  ------------------
  |  |  |  |  439|  8.47M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  8.47M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  8.47M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  8.47M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  8.47M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  8.47M|{ \
  |  |  |  |  |  |  140|  8.47M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  8.47M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  8.47M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  8.47M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  8.47M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  8.47M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.95M, False: 6.52M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.95M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.95M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.95M|{ \
  |  |  |  |  |  |  |  |   57|  1.95M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 418k, False: 1.53M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   418k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   418k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   418k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.53M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.53M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.53M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.53M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.53M|    } \
  |  |  |  |  |  |  |  |   66|  1.95M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.95M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.95M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.95M|{ \
  |  |  |  |  |  |  |  |  128|  3.16M|    do { \
  |  |  |  |  |  |  |  |  129|  3.16M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 397k, False: 2.76M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   397k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   397k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   397k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   397k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   397k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   397k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   397k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   397k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 386k, False: 10.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   386k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 383k, False: 3.74k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   383k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   383k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   383k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   383k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.74k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.74k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.74k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.74k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   386k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  10.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  10.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  10.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  10.6k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   397k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   397k|        } \
  |  |  |  |  |  |  |  |  132|  3.16M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.16M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.16M|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.16M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.21M, False: 1.95M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.95M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  6.52M|    } else {  \
  |  |  |  |  |  |  149|  6.52M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  6.52M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.06M, False: 4.45M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.06M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.06M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.06M|{ \
  |  |  |  |  |  |  |  |   45|  2.06M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 339k, False: 1.72M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   339k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   339k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.72M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.72M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.72M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.72M|    } \
  |  |  |  |  |  |  |  |   52|  2.06M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.06M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.06M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.06M|{ \
  |  |  |  |  |  |  |  |  128|  2.21M|    do { \
  |  |  |  |  |  |  |  |  129|  2.21M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 278k, False: 1.93M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   278k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   278k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   278k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   278k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   278k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   278k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   278k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   278k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 271k, False: 6.71k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   271k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 268k, False: 2.60k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   268k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   268k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   268k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   268k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.60k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.60k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.60k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.60k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   271k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.71k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.71k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.71k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.71k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   278k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   278k|        } \
  |  |  |  |  |  |  |  |  132|  2.21M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.21M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.21M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.21M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 153k, False: 2.06M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.06M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.45M|        } else { \
  |  |  |  |  |  |  154|  4.45M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.45M|        } \
  |  |  |  |  |  |  156|  6.52M|    } \
  |  |  |  |  |  |  157|  8.47M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  8.47M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 4.04M, False: 4.42M]
  |  |  |  |  ------------------
  |  |  |  |  443|  4.04M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  4.04M|                                flags, \
  |  |  |  |  445|  4.04M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  4.04M|                                ci); \
  |  |  |  |  447|  4.04M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  4.04M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  4.04M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  4.04M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  4.04M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.04M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.04M|{ \
  |  |  |  |  |  |  140|  4.04M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.04M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.04M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.04M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.04M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.04M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 977k, False: 3.07M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   977k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   977k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   977k|{ \
  |  |  |  |  |  |  |  |   57|   977k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 210k, False: 767k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   210k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   210k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   210k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   767k|    } else { \
  |  |  |  |  |  |  |  |   62|   767k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   767k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   767k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   767k|    } \
  |  |  |  |  |  |  |  |   66|   977k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   977k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   977k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   977k|{ \
  |  |  |  |  |  |  |  |  128|  1.58M|    do { \
  |  |  |  |  |  |  |  |  129|  1.58M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 200k, False: 1.38M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   200k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   200k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   200k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   200k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   200k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   200k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   200k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   200k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 194k, False: 5.47k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   194k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 192k, False: 2.04k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   192k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   192k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   192k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   192k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.04k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.04k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.04k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.04k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   194k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.47k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.47k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.47k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.47k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   200k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   200k|        } \
  |  |  |  |  |  |  |  |  132|  1.58M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.58M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.58M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.58M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 607k, False: 977k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   977k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.07M|    } else {  \
  |  |  |  |  |  |  149|  3.07M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.07M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.06M, False: 2.00M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.06M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.06M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.06M|{ \
  |  |  |  |  |  |  |  |   45|  1.06M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 170k, False: 894k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   170k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   170k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   894k|    } else { \
  |  |  |  |  |  |  |  |   49|   894k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   894k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   894k|    } \
  |  |  |  |  |  |  |  |   52|  1.06M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.06M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.06M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.06M|{ \
  |  |  |  |  |  |  |  |  128|  1.13M|    do { \
  |  |  |  |  |  |  |  |  129|  1.13M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 145k, False: 993k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   145k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   145k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   145k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   145k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   145k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   145k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   145k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   145k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 141k, False: 3.66k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   141k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 140k, False: 1.37k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   140k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   140k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   140k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   140k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.37k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.37k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.37k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.37k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   141k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.66k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.66k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.66k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.66k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   145k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   145k|        } \
  |  |  |  |  |  |  |  |  132|  1.13M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.13M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.13M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.13M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 73.9k, False: 1.06M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.06M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.00M|        } else { \
  |  |  |  |  |  |  154|  2.00M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.00M|        } \
  |  |  |  |  |  |  156|  3.07M|    } \
  |  |  |  |  |  |  157|  4.04M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  4.04M|            v = v ^ spb; \
  |  |  |  |  452|  4.04M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 2.01M, False: 2.03M]
  |  |  |  |  ------------------
  |  |  |  |  453|  4.04M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  4.04M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  4.04M|{ \
  |  |  |  |  |  |  323|  4.04M|    /* east */ \
  |  |  |  |  |  |  324|  4.04M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.04M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  4.04M| \
  |  |  |  |  |  |  326|  4.04M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  4.04M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.04M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.04M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.04M| \
  |  |  |  |  |  |  329|  4.04M|    /* west */ \
  |  |  |  |  |  |  330|  4.04M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.04M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.04M| \
  |  |  |  |  |  |  332|  4.04M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  4.04M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  4.04M| \
  |  |  |  |  |  |  340|  4.04M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  4.04M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  4.04M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  4.04M|        } \
  |  |  |  |  455|  8.47M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  8.47M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  8.47M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  8.47M|    } \
  |  |  |  |  457|  36.1M|}
  |  |  ------------------
  |  |  661|  36.1M|                                flags, flagsp, flags_stride, data, \
  |  |  662|  36.1M|                                l_w, 0, mqc, curctx, v, a, c, ct, oneplushalf, vsc); \
  |  |  663|  36.1M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  36.1M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  36.1M|{ \
  |  |  |  |  437|  36.1M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  36.1M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  36.1M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  36.1M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  36.1M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 8.80M, False: 27.3M]
  |  |  |  |  ------------------
  |  |  |  |  438|  36.1M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  8.80M|#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|  8.80M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  8.80M|#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|  8.80M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  8.80M|#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|  8.80M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  8.80M|#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|  8.80M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  8.80M|#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|  8.80M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  8.80M|#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|  8.80M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  8.80M|#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|  8.80M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  8.80M|#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|  8.80M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  8.80M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 8.52M, False: 285k]
  |  |  |  |  ------------------
  |  |  |  |  439|  8.52M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  8.52M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  8.52M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  8.52M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  8.52M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  8.52M|{ \
  |  |  |  |  |  |  140|  8.52M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  8.52M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  8.52M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  8.52M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  8.52M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  8.52M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.95M, False: 6.56M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.95M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.95M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.95M|{ \
  |  |  |  |  |  |  |  |   57|  1.95M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 416k, False: 1.54M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   416k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   416k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   416k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.54M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.54M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.54M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.54M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.54M|    } \
  |  |  |  |  |  |  |  |   66|  1.95M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.95M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.95M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.95M|{ \
  |  |  |  |  |  |  |  |  128|  3.18M|    do { \
  |  |  |  |  |  |  |  |  129|  3.18M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 398k, False: 2.78M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   398k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   398k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   398k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   398k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   398k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   398k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   398k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   398k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 388k, False: 10.1k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   388k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 384k, False: 3.79k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   384k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   384k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   384k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   384k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.79k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.79k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.79k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.79k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   388k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  10.1k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  10.1k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  10.1k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  10.1k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   398k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   398k|        } \
  |  |  |  |  |  |  |  |  132|  3.18M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.18M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.18M|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.18M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.22M, False: 1.95M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.95M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  6.56M|    } else {  \
  |  |  |  |  |  |  149|  6.56M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  6.56M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.05M, False: 4.50M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.05M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.05M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.05M|{ \
  |  |  |  |  |  |  |  |   45|  2.05M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 333k, False: 1.72M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   333k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   333k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.72M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.72M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.72M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.72M|    } \
  |  |  |  |  |  |  |  |   52|  2.05M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.05M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.05M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.05M|{ \
  |  |  |  |  |  |  |  |  128|  2.20M|    do { \
  |  |  |  |  |  |  |  |  129|  2.20M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 274k, False: 1.92M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   274k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   274k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   274k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   274k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   274k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   274k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   274k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   274k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 267k, False: 6.68k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   267k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 265k, False: 2.61k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   265k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   265k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   265k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   265k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.61k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.61k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.61k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.61k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   267k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.68k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.68k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.68k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.68k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   274k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   274k|        } \
  |  |  |  |  |  |  |  |  132|  2.20M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.20M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.20M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.20M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 150k, False: 2.05M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.05M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.50M|        } else { \
  |  |  |  |  |  |  154|  4.50M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.50M|        } \
  |  |  |  |  |  |  156|  6.56M|    } \
  |  |  |  |  |  |  157|  8.52M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  8.52M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 4.06M, False: 4.45M]
  |  |  |  |  ------------------
  |  |  |  |  443|  4.06M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  4.06M|                                flags, \
  |  |  |  |  445|  4.06M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  4.06M|                                ci); \
  |  |  |  |  447|  4.06M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  4.06M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  4.06M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  4.06M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  4.06M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.06M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.06M|{ \
  |  |  |  |  |  |  140|  4.06M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.06M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.06M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.06M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.06M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.06M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 993k, False: 3.07M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   993k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   993k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   993k|{ \
  |  |  |  |  |  |  |  |   57|   993k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 217k, False: 775k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   217k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   217k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   217k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   775k|    } else { \
  |  |  |  |  |  |  |  |   62|   775k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   775k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   775k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   775k|    } \
  |  |  |  |  |  |  |  |   66|   993k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   993k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   993k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   993k|{ \
  |  |  |  |  |  |  |  |  128|  1.60M|    do { \
  |  |  |  |  |  |  |  |  129|  1.60M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 200k, False: 1.40M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   200k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   200k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   200k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   200k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   200k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   200k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   200k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   200k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 194k, False: 5.35k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   194k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 192k, False: 2.07k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   192k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   192k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   192k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   192k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.07k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.07k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.07k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.07k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   194k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.35k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.35k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.35k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.35k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   200k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   200k|        } \
  |  |  |  |  |  |  |  |  132|  1.60M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.60M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.60M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.60M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 610k, False: 993k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   993k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.07M|    } else {  \
  |  |  |  |  |  |  149|  3.07M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.07M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.05M, False: 2.01M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.05M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.05M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.05M|{ \
  |  |  |  |  |  |  |  |   45|  1.05M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 172k, False: 885k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   172k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   172k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   885k|    } else { \
  |  |  |  |  |  |  |  |   49|   885k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   885k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   885k|    } \
  |  |  |  |  |  |  |  |   52|  1.05M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.05M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.05M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.05M|{ \
  |  |  |  |  |  |  |  |  128|  1.13M|    do { \
  |  |  |  |  |  |  |  |  129|  1.13M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 140k, False: 992k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   140k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   140k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   140k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   140k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   140k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   140k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   140k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   140k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 137k, False: 3.49k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   137k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 135k, False: 1.44k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   135k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   135k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   135k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   135k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.44k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.44k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.44k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.44k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   137k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.49k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.49k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.49k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.49k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   140k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   140k|        } \
  |  |  |  |  |  |  |  |  132|  1.13M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.13M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.13M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.13M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 75.3k, False: 1.05M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.05M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.01M|        } else { \
  |  |  |  |  |  |  154|  2.01M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.01M|        } \
  |  |  |  |  |  |  156|  3.07M|    } \
  |  |  |  |  |  |  157|  4.06M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  4.06M|            v = v ^ spb; \
  |  |  |  |  452|  4.06M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 2.03M, False: 2.02M]
  |  |  |  |  ------------------
  |  |  |  |  453|  4.06M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  4.06M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  4.06M|{ \
  |  |  |  |  |  |  323|  4.06M|    /* east */ \
  |  |  |  |  |  |  324|  4.06M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.06M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  4.06M| \
  |  |  |  |  |  |  326|  4.06M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  4.06M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.06M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.06M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.06M| \
  |  |  |  |  |  |  329|  4.06M|    /* west */ \
  |  |  |  |  |  |  330|  4.06M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.06M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.06M| \
  |  |  |  |  |  |  332|  4.06M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  4.06M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  4.06M| \
  |  |  |  |  |  |  340|  4.06M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  4.06M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  4.06M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  4.06M|        } \
  |  |  |  |  455|  8.52M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  8.52M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  8.52M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  8.52M|    } \
  |  |  |  |  457|  36.1M|}
  |  |  ------------------
  |  |  664|  36.1M|                                flags, flagsp, flags_stride, data, \
  |  |  665|  36.1M|                                l_w, 1, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  666|  36.1M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  36.1M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  36.1M|{ \
  |  |  |  |  437|  36.1M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  36.1M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  36.1M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  36.1M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  36.1M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 8.92M, False: 27.2M]
  |  |  |  |  ------------------
  |  |  |  |  438|  36.1M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  8.92M|#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|  8.92M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  8.92M|#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|  8.92M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  8.92M|#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|  8.92M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  8.92M|#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|  8.92M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  8.92M|#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|  8.92M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  8.92M|#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|  8.92M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  8.92M|#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|  8.92M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  8.92M|#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|  8.92M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  8.92M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 8.48M, False: 439k]
  |  |  |  |  ------------------
  |  |  |  |  439|  8.48M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  8.48M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  8.48M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  8.48M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  8.48M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  8.48M|{ \
  |  |  |  |  |  |  140|  8.48M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  8.48M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  8.48M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  8.48M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  8.48M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  8.48M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.93M, False: 6.54M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.93M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.93M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.93M|{ \
  |  |  |  |  |  |  |  |   57|  1.93M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 412k, False: 1.52M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   412k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   412k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   412k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.52M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.52M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.52M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.52M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.52M|    } \
  |  |  |  |  |  |  |  |   66|  1.93M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.93M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.93M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.93M|{ \
  |  |  |  |  |  |  |  |  128|  3.15M|    do { \
  |  |  |  |  |  |  |  |  129|  3.15M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 393k, False: 2.76M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   393k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   393k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   393k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   393k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   393k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   393k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   393k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   393k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 383k, False: 10.2k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   383k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 379k, False: 3.65k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   379k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   379k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   379k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   379k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.65k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.65k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.65k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.65k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   383k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  10.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  10.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  10.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  10.2k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   393k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   393k|        } \
  |  |  |  |  |  |  |  |  132|  3.15M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.15M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.15M|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.15M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.21M, False: 1.93M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.93M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  6.54M|    } else {  \
  |  |  |  |  |  |  149|  6.54M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  6.54M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.04M, False: 4.50M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.04M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.04M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.04M|{ \
  |  |  |  |  |  |  |  |   45|  2.04M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 331k, False: 1.71M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   331k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   331k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.71M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.71M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.71M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.71M|    } \
  |  |  |  |  |  |  |  |   52|  2.04M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.04M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.04M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.04M|{ \
  |  |  |  |  |  |  |  |  128|  2.19M|    do { \
  |  |  |  |  |  |  |  |  129|  2.19M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 273k, False: 1.91M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   273k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   273k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   273k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   273k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   273k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   273k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   273k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   273k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 266k, False: 6.29k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   266k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 264k, False: 2.46k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   264k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   264k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   264k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   264k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.46k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.46k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.46k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.46k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   266k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.29k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.29k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.29k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.29k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   273k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   273k|        } \
  |  |  |  |  |  |  |  |  132|  2.19M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.19M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.19M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.19M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 150k, False: 2.04M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.04M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.50M|        } else { \
  |  |  |  |  |  |  154|  4.50M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.50M|        } \
  |  |  |  |  |  |  156|  6.54M|    } \
  |  |  |  |  |  |  157|  8.48M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  8.48M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 4.08M, False: 4.40M]
  |  |  |  |  ------------------
  |  |  |  |  443|  4.08M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  4.08M|                                flags, \
  |  |  |  |  445|  4.08M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  4.08M|                                ci); \
  |  |  |  |  447|  4.08M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  4.08M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  4.08M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  4.08M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  4.08M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.08M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.08M|{ \
  |  |  |  |  |  |  140|  4.08M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.08M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.08M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.08M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.08M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.08M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 993k, False: 3.08M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   993k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   993k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   993k|{ \
  |  |  |  |  |  |  |  |   57|   993k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 218k, False: 775k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   218k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   218k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   218k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   775k|    } else { \
  |  |  |  |  |  |  |  |   62|   775k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   775k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   775k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   775k|    } \
  |  |  |  |  |  |  |  |   66|   993k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   993k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   993k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   993k|{ \
  |  |  |  |  |  |  |  |  128|  1.60M|    do { \
  |  |  |  |  |  |  |  |  129|  1.60M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 200k, False: 1.40M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   200k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   200k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   200k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   200k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   200k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   200k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   200k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   200k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 195k, False: 5.15k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   195k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 193k, False: 2.02k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   193k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   193k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   193k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   193k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.02k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.02k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.02k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.02k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   195k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.15k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.15k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.15k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.15k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   200k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   200k|        } \
  |  |  |  |  |  |  |  |  132|  1.60M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.60M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.60M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.60M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 611k, False: 993k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   993k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.08M|    } else {  \
  |  |  |  |  |  |  149|  3.08M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.08M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.06M, False: 2.02M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.06M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.06M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.06M|{ \
  |  |  |  |  |  |  |  |   45|  1.06M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 173k, False: 890k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   173k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   173k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   890k|    } else { \
  |  |  |  |  |  |  |  |   49|   890k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   890k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   890k|    } \
  |  |  |  |  |  |  |  |   52|  1.06M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.06M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.06M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.06M|{ \
  |  |  |  |  |  |  |  |  128|  1.14M|    do { \
  |  |  |  |  |  |  |  |  129|  1.14M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 142k, False: 998k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   142k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   142k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   142k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   142k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   142k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   142k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   142k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   142k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 138k, False: 3.42k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   138k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 137k, False: 1.40k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   137k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   137k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   137k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   137k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.40k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.40k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.40k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.40k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   138k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.42k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.42k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.42k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.42k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   142k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   142k|        } \
  |  |  |  |  |  |  |  |  132|  1.14M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.14M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.14M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.14M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 76.4k, False: 1.06M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.06M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.02M|        } else { \
  |  |  |  |  |  |  154|  2.02M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.02M|        } \
  |  |  |  |  |  |  156|  3.08M|    } \
  |  |  |  |  |  |  157|  4.08M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  4.08M|            v = v ^ spb; \
  |  |  |  |  452|  4.08M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 2.03M, False: 2.04M]
  |  |  |  |  ------------------
  |  |  |  |  453|  4.08M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  4.08M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  4.08M|{ \
  |  |  |  |  |  |  323|  4.08M|    /* east */ \
  |  |  |  |  |  |  324|  4.08M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.08M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  4.08M| \
  |  |  |  |  |  |  326|  4.08M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  4.08M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.08M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.08M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.08M| \
  |  |  |  |  |  |  329|  4.08M|    /* west */ \
  |  |  |  |  |  |  330|  4.08M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.08M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.08M| \
  |  |  |  |  |  |  332|  4.08M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  4.08M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  4.08M| \
  |  |  |  |  |  |  340|  4.08M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  4.08M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  4.08M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  4.08M|        } \
  |  |  |  |  455|  8.48M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  8.48M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  8.48M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  8.48M|    } \
  |  |  |  |  457|  36.1M|}
  |  |  ------------------
  |  |  667|  36.1M|                                flags, flagsp, flags_stride, data, \
  |  |  668|  36.1M|                                l_w, 2, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  669|  36.1M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  36.1M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  36.1M|{ \
  |  |  |  |  437|  36.1M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  36.1M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  36.1M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  36.1M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  36.1M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 9.17M, False: 26.9M]
  |  |  |  |  ------------------
  |  |  |  |  438|  36.1M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  9.17M|#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|  9.17M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  9.17M|#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|  9.17M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  9.17M|#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|  9.17M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  9.17M|#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|  9.17M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  9.17M|#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|  9.17M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  9.17M|#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|  9.17M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  9.17M|#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|  9.17M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  9.17M|#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|  9.17M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  9.17M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 8.28M, False: 891k]
  |  |  |  |  ------------------
  |  |  |  |  439|  8.28M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  8.28M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  8.28M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  8.28M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  8.28M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  8.28M|{ \
  |  |  |  |  |  |  140|  8.28M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  8.28M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  8.28M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  8.28M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  8.28M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  8.28M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.87M, False: 6.41M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.87M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.87M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.87M|{ \
  |  |  |  |  |  |  |  |   57|  1.87M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 398k, False: 1.47M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   398k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   398k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   398k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.47M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.47M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.47M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.47M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.47M|    } \
  |  |  |  |  |  |  |  |   66|  1.87M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.87M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.87M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.87M|{ \
  |  |  |  |  |  |  |  |  128|  3.05M|    do { \
  |  |  |  |  |  |  |  |  129|  3.05M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 380k, False: 2.67M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   380k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   380k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   380k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   380k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   380k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   380k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   380k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   380k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 371k, False: 8.81k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   371k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 368k, False: 3.30k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   368k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   368k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   368k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   368k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.30k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.30k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.30k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.30k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   371k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  8.81k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  8.81k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  8.81k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  8.81k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   380k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   380k|        } \
  |  |  |  |  |  |  |  |  132|  3.05M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.05M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.05M|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.05M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.18M, False: 1.87M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.87M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  6.41M|    } else {  \
  |  |  |  |  |  |  149|  6.41M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  6.41M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.98M, False: 4.42M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.98M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.98M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.98M|{ \
  |  |  |  |  |  |  |  |   45|  1.98M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 313k, False: 1.67M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   313k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   313k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.67M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.67M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.67M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.67M|    } \
  |  |  |  |  |  |  |  |   52|  1.98M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.98M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.98M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.98M|{ \
  |  |  |  |  |  |  |  |  128|  2.12M|    do { \
  |  |  |  |  |  |  |  |  129|  2.12M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 264k, False: 1.86M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   264k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   264k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   264k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   264k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   264k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   264k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   264k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   264k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 259k, False: 5.93k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   259k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 256k, False: 2.36k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   256k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   256k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   256k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   256k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.36k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.36k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.36k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.36k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   259k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.93k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.93k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.93k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.93k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   264k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   264k|        } \
  |  |  |  |  |  |  |  |  132|  2.12M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.12M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.12M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.12M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 141k, False: 1.98M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.98M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.42M|        } else { \
  |  |  |  |  |  |  154|  4.42M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.42M|        } \
  |  |  |  |  |  |  156|  6.41M|    } \
  |  |  |  |  |  |  157|  8.28M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  8.28M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 4.07M, False: 4.21M]
  |  |  |  |  ------------------
  |  |  |  |  443|  4.07M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  4.07M|                                flags, \
  |  |  |  |  445|  4.07M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  4.07M|                                ci); \
  |  |  |  |  447|  4.07M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  4.07M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  4.07M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  4.07M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  4.07M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.07M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.07M|{ \
  |  |  |  |  |  |  140|  4.07M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.07M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.07M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.07M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.07M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.07M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 985k, False: 3.08M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   985k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   985k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   985k|{ \
  |  |  |  |  |  |  |  |   57|   985k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 215k, False: 770k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   215k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   215k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   215k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   770k|    } else { \
  |  |  |  |  |  |  |  |   62|   770k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   770k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   770k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   770k|    } \
  |  |  |  |  |  |  |  |   66|   985k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   985k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   985k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   985k|{ \
  |  |  |  |  |  |  |  |  128|  1.60M|    do { \
  |  |  |  |  |  |  |  |  129|  1.60M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 203k, False: 1.39M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   203k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   203k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   203k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   203k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   203k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   203k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   203k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   203k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 198k, False: 5.05k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   198k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 196k, False: 2.00k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   196k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   196k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   196k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   196k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.00k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.00k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.00k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.00k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   198k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.05k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.05k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.05k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.05k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   203k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   203k|        } \
  |  |  |  |  |  |  |  |  132|  1.60M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.60M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.60M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.60M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 614k, False: 985k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   985k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.08M|    } else {  \
  |  |  |  |  |  |  149|  3.08M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.08M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.04M, False: 2.03M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.04M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.04M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.04M|{ \
  |  |  |  |  |  |  |  |   45|  1.04M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 172k, False: 875k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   172k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   172k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   875k|    } else { \
  |  |  |  |  |  |  |  |   49|   875k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   875k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   875k|    } \
  |  |  |  |  |  |  |  |   52|  1.04M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.04M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.04M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.04M|{ \
  |  |  |  |  |  |  |  |  128|  1.12M|    do { \
  |  |  |  |  |  |  |  |  129|  1.12M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 141k, False: 982k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   141k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   141k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   141k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   141k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   141k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   141k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   141k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   141k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 137k, False: 3.37k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   137k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 136k, False: 1.38k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   136k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   136k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   136k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   136k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.38k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.38k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.38k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.38k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   137k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.37k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.37k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.37k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.37k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   141k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   141k|        } \
  |  |  |  |  |  |  |  |  132|  1.12M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.12M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.12M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.12M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 75.9k, False: 1.04M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.04M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.03M|        } else { \
  |  |  |  |  |  |  154|  2.03M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.03M|        } \
  |  |  |  |  |  |  156|  3.08M|    } \
  |  |  |  |  |  |  157|  4.07M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  4.07M|            v = v ^ spb; \
  |  |  |  |  452|  4.07M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 2.03M, False: 2.03M]
  |  |  |  |  ------------------
  |  |  |  |  453|  4.07M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  4.07M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  4.07M|{ \
  |  |  |  |  |  |  323|  4.07M|    /* east */ \
  |  |  |  |  |  |  324|  4.07M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.07M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  4.07M| \
  |  |  |  |  |  |  326|  4.07M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  4.07M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.07M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.07M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.07M| \
  |  |  |  |  |  |  329|  4.07M|    /* west */ \
  |  |  |  |  |  |  330|  4.07M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.07M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.07M| \
  |  |  |  |  |  |  332|  4.07M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  4.07M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  4.07M| \
  |  |  |  |  |  |  340|  4.07M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  4.07M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|  4.07M|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|  4.07M|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  4.07M|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  4.07M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  4.07M|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  4.07M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  4.07M|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  4.07M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|  4.07M|    } \
  |  |  |  |  |  |  347|  4.07M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  4.07M|        } \
  |  |  |  |  455|  8.28M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  8.28M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  8.28M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  8.28M|    } \
  |  |  |  |  457|  36.1M|}
  |  |  ------------------
  |  |  670|  36.1M|                                flags, flagsp, flags_stride, data, \
  |  |  671|  36.1M|                                l_w, 3, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  672|  36.1M|                            *flagsp = flags; \
  |  |  673|  36.1M|                        } \
  |  |  674|  46.1M|                } \
  |  |  675|   721k|        } \
  |  |  676|  45.1k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  45.1k|        mqc->curctx = curctx; \
  |  |  |  |  167|  45.1k|        mqc->c = c; \
  |  |  |  |  168|  45.1k|        mqc->a = a; \
  |  |  |  |  169|  45.1k|        mqc->ct = ct;
  |  |  ------------------
  |  |  677|  45.1k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (677:13): [True: 0, False: 45.1k]
  |  |  ------------------
  |  |  678|      0|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (678:25): [True: 0, False: 0]
  |  |  ------------------
  |  |  679|      0|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (679:29): [True: 0, False: 0]
  |  |  ------------------
  |  |  680|      0|                        opj_t1_dec_sigpass_step_mqc(t1, flagsp, \
  |  |  681|      0|                            data + j * l_w, oneplushalf, j, flags_stride, vsc); \
  |  |  682|      0|                } \
  |  |  683|      0|            } \
  |  |  684|      0|        } \
  |  |  685|  45.1k|}
  ------------------
  699|  45.1k|}
t1.c:opj_t1_getctxno_zc:
  252|   261M|{
  253|   261M|    return mqc->lut_ctxno_zc_orient[(f & T1_SIGMA_NEIGHBOURS)];
  ------------------
  |  |  158|   261M|#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|   261M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|   261M|#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|   261M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|   261M|#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|   261M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|   261M|#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|   261M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|   261M|#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|   261M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|   261M|#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|   261M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|   261M|#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|   261M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|   261M|#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|   261M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|   261M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  254|   261M|}
t1.c:opj_t1_getctxtno_sc_or_spb_index:
  260|   114M|{
  261|       |    /*
  262|       |      0 pfX T1_CHI_THIS           T1_LUT_SGN_W
  263|       |      1 tfX T1_SIGMA_1            T1_LUT_SIG_N
  264|       |      2 nfX T1_CHI_THIS           T1_LUT_SGN_E
  265|       |      3 tfX T1_SIGMA_3            T1_LUT_SIG_W
  266|       |      4  fX T1_CHI_(THIS - 1)     T1_LUT_SGN_N
  267|       |      5 tfX T1_SIGMA_5            T1_LUT_SIG_E
  268|       |      6  fX T1_CHI_(THIS + 1)     T1_LUT_SGN_S
  269|       |      7 tfX T1_SIGMA_7            T1_LUT_SIG_S
  270|       |    */
  271|       |
  272|   114M|    OPJ_UINT32 lu = (fX >> (ci * 3U)) & (T1_SIGMA_1 | T1_SIGMA_3 | T1_SIGMA_5 |
  ------------------
  |  |   92|   114M|#define T1_SIGMA_1  (1U << 1)
  ------------------
                  OPJ_UINT32 lu = (fX >> (ci * 3U)) & (T1_SIGMA_1 | T1_SIGMA_3 | T1_SIGMA_5 |
  ------------------
  |  |   94|   114M|#define T1_SIGMA_3  (1U << 3)
  ------------------
                  OPJ_UINT32 lu = (fX >> (ci * 3U)) & (T1_SIGMA_1 | T1_SIGMA_3 | T1_SIGMA_5 |
  ------------------
  |  |   96|   114M|#define T1_SIGMA_5  (1U << 5)
  ------------------
  273|   114M|                                         T1_SIGMA_7);
  ------------------
  |  |   98|   114M|#define T1_SIGMA_7  (1U << 7)
  ------------------
  274|       |
  275|   114M|    lu |= (pfX >> (T1_CHI_THIS_I      + (ci * 3U))) & (1U << 0);
  ------------------
  |  |  161|   114M|#define T1_CHI_THIS_I T1_CHI_1_I
  |  |  ------------------
  |  |  |  |  113|   114M|#define T1_CHI_1_I  19
  |  |  ------------------
  ------------------
  276|   114M|    lu |= (nfX >> (T1_CHI_THIS_I - 2U + (ci * 3U))) & (1U << 2);
  ------------------
  |  |  161|   114M|#define T1_CHI_THIS_I T1_CHI_1_I
  |  |  ------------------
  |  |  |  |  113|   114M|#define T1_CHI_1_I  19
  |  |  ------------------
  ------------------
  277|   114M|    if (ci == 0U) {
  ------------------
  |  Branch (277:9): [True: 29.0M, False: 84.9M]
  ------------------
  278|  29.0M|        lu |= (fX >> (T1_CHI_0_I - 4U)) & (1U << 4);
  ------------------
  |  |  111|  29.0M|#define T1_CHI_0_I  18
  ------------------
  279|  84.9M|    } else {
  280|  84.9M|        lu |= (fX >> (T1_CHI_1_I - 4U + ((ci - 1U) * 3U))) & (1U << 4);
  ------------------
  |  |  113|  84.9M|#define T1_CHI_1_I  19
  ------------------
  281|  84.9M|    }
  282|   114M|    lu |= (fX >> (T1_CHI_2_I - 6U + (ci * 3U))) & (1U << 6);
  ------------------
  |  |  117|   114M|#define T1_CHI_2_I  22
  ------------------
  283|   114M|    return lu;
  284|   114M|}
t1.c:opj_t1_getctxno_sc:
  287|   114M|{
  288|   114M|    return lut_ctxno_sc[lu];
  289|   114M|}
t1.c:opj_t1_getspb:
  299|   114M|{
  300|   114M|    return lut_spb[lu];
  301|   114M|}
t1.c:opj_t1_dec_sigpass_step_mqc:
  467|  6.24M|{
  468|  6.24M|    OPJ_UINT32 v;
  469|       |
  470|  6.24M|    opj_mqc_t *mqc = &(t1->mqc);       /* MQC component */
  471|  6.24M|    opj_t1_dec_sigpass_step_mqc_macro(*flagsp, flagsp, flags_stride, datap,
  ------------------
  |  |  435|  6.24M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  436|  6.24M|{ \
  |  |  437|  6.24M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  ------------------
  |  |  |  |  153|  6.24M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  6.24M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  ------------------
  |  |  |  |  163|  6.24M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  6.24M|#define T1_PI_0     (1U << 21)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (437:9): [True: 2.30M, False: 3.93M]
  |  |  ------------------
  |  |  438|  6.24M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  ------------------
  |  |  |  |  158|  2.30M|#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|  2.30M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  2.30M|#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|  2.30M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  2.30M|#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|  2.30M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  2.30M|#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|  2.30M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.30M|#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|  2.30M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.30M|#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|  2.30M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   97|  2.30M|#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|  2.30M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   98|  2.30M|#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|  2.30M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   99|  2.30M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (438:9): [True: 760k, False: 1.54M]
  |  |  ------------------
  |  |  439|   760k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  440|   760k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  ------------------
  |  |  |  |   62|   760k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  |  441|   760k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   760k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   760k|{ \
  |  |  |  |  140|   760k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   760k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   760k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   760k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   760k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   760k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 181k, False: 578k]
  |  |  |  |  ------------------
  |  |  |  |  146|   181k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   181k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   181k|{ \
  |  |  |  |  |  |   57|   181k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 39.6k, False: 141k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  39.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  39.6k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  39.6k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   141k|    } else { \
  |  |  |  |  |  |   62|   141k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   141k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   141k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   141k|    } \
  |  |  |  |  |  |   66|   181k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   181k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   181k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   181k|{ \
  |  |  |  |  |  |  128|   287k|    do { \
  |  |  |  |  |  |  129|   287k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 36.0k, False: 251k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  36.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  36.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  36.0k|{ \
  |  |  |  |  |  |  |  |  104|  36.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  36.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  36.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  36.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  36.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 32.6k, False: 3.45k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  32.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 31.3k, False: 1.31k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  31.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  31.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  31.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  31.3k|            } else { \
  |  |  |  |  |  |  |  |  114|  1.31k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  1.31k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  1.31k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  1.31k|            } \
  |  |  |  |  |  |  |  |  118|  32.6k|        } else { \
  |  |  |  |  |  |  |  |  119|  3.45k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  3.45k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  3.45k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  3.45k|        } \
  |  |  |  |  |  |  |  |  123|  36.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  36.0k|        } \
  |  |  |  |  |  |  132|   287k|        a <<= 1; \
  |  |  |  |  |  |  133|   287k|        c <<= 1; \
  |  |  |  |  |  |  134|   287k|        ct--; \
  |  |  |  |  |  |  135|   287k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 106k, False: 181k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   181k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   578k|    } else {  \
  |  |  |  |  149|   578k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   578k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 190k, False: 387k]
  |  |  |  |  ------------------
  |  |  |  |  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: 31.5k, False: 159k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  31.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  31.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   159k|    } else { \
  |  |  |  |  |  |   49|   159k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   159k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   159k|    } \
  |  |  |  |  |  |   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.5k, False: 179k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  25.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  25.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  25.5k|{ \
  |  |  |  |  |  |  |  |  104|  25.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  25.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  25.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  25.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  25.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 23.2k, False: 2.32k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  23.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 22.2k, False: 928]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  22.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  22.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  22.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  22.2k|            } else { \
  |  |  |  |  |  |  |  |  114|    928|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    928|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    928|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    928|            } \
  |  |  |  |  |  |  |  |  118|  23.2k|        } else { \
  |  |  |  |  |  |  |  |  119|  2.32k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  2.32k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  2.32k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  2.32k|        } \
  |  |  |  |  |  |  |  |  123|  25.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  25.5k|        } \
  |  |  |  |  |  |  132|   204k|        a <<= 1; \
  |  |  |  |  |  |  133|   204k|        c <<= 1; \
  |  |  |  |  |  |  134|   204k|        ct--; \
  |  |  |  |  |  |  135|   204k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 13.7k, False: 190k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   190k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   387k|        } else { \
  |  |  |  |  154|   387k|            d = (*curctx)->mps; \
  |  |  |  |  155|   387k|        } \
  |  |  |  |  156|   578k|    } \
  |  |  |  |  157|   760k|}
  |  |  ------------------
  |  |  442|   760k|        if (v) { \
  |  |  ------------------
  |  |  |  Branch (442:13): [True: 353k, False: 406k]
  |  |  ------------------
  |  |  443|   353k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  444|   353k|                                flags, \
  |  |  445|   353k|                                flagsp[-1], flagsp[1], \
  |  |  446|   353k|                                ci); \
  |  |  447|   353k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  448|   353k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  449|   353k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  ------------------
  |  |  |  |   62|   353k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  |  450|   353k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   353k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   353k|{ \
  |  |  |  |  140|   353k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   353k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   353k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   353k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   353k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   353k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 94.6k, False: 258k]
  |  |  |  |  ------------------
  |  |  |  |  146|  94.6k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  94.6k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  94.6k|{ \
  |  |  |  |  |  |   57|  94.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 22.7k, False: 71.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  22.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  22.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  22.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  71.8k|    } else { \
  |  |  |  |  |  |   62|  71.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  71.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  71.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  71.8k|    } \
  |  |  |  |  |  |   66|  94.6k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  94.6k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  94.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  94.6k|{ \
  |  |  |  |  |  |  128|   145k|    do { \
  |  |  |  |  |  |  129|   145k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 18.0k, False: 127k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  18.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  18.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  18.0k|{ \
  |  |  |  |  |  |  |  |  104|  18.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  18.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  18.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  18.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  18.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 16.4k, False: 1.62k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  16.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 15.7k, False: 626]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  15.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  15.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  15.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  15.7k|            } else { \
  |  |  |  |  |  |  |  |  114|    626|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    626|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    626|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    626|            } \
  |  |  |  |  |  |  |  |  118|  16.4k|        } else { \
  |  |  |  |  |  |  |  |  119|  1.62k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  1.62k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  1.62k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  1.62k|        } \
  |  |  |  |  |  |  |  |  123|  18.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  18.0k|        } \
  |  |  |  |  |  |  132|   145k|        a <<= 1; \
  |  |  |  |  |  |  133|   145k|        c <<= 1; \
  |  |  |  |  |  |  134|   145k|        ct--; \
  |  |  |  |  |  |  135|   145k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 50.5k, False: 94.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  94.6k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   258k|    } else {  \
  |  |  |  |  149|   258k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   258k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 97.6k, False: 161k]
  |  |  |  |  ------------------
  |  |  |  |  151|  97.6k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  97.6k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  97.6k|{ \
  |  |  |  |  |  |   45|  97.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 18.1k, False: 79.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  18.1k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  18.1k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  79.5k|    } else { \
  |  |  |  |  |  |   49|  79.5k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  79.5k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  79.5k|    } \
  |  |  |  |  |  |   52|  97.6k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  97.6k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  97.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  97.6k|{ \
  |  |  |  |  |  |  128|   105k|    do { \
  |  |  |  |  |  |  129|   105k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 13.6k, False: 91.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  13.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  13.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  13.6k|{ \
  |  |  |  |  |  |  |  |  104|  13.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  13.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  13.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  13.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  13.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 12.1k, False: 1.42k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  12.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 11.6k, False: 496]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  11.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  11.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  11.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  11.6k|            } else { \
  |  |  |  |  |  |  |  |  114|    496|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    496|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    496|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    496|            } \
  |  |  |  |  |  |  |  |  118|  12.1k|        } else { \
  |  |  |  |  |  |  |  |  119|  1.42k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  1.42k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  1.42k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  1.42k|        } \
  |  |  |  |  |  |  |  |  123|  13.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  13.6k|        } \
  |  |  |  |  |  |  132|   105k|        a <<= 1; \
  |  |  |  |  |  |  133|   105k|        c <<= 1; \
  |  |  |  |  |  |  134|   105k|        ct--; \
  |  |  |  |  |  |  135|   105k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 7.75k, False: 97.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  97.6k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   161k|        } else { \
  |  |  |  |  154|   161k|            d = (*curctx)->mps; \
  |  |  |  |  155|   161k|        } \
  |  |  |  |  156|   258k|    } \
  |  |  |  |  157|   353k|}
  |  |  ------------------
  |  |  451|   353k|            v = v ^ spb; \
  |  |  452|   353k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  ------------------
  |  |  |  Branch (452:36): [True: 176k, False: 176k]
  |  |  ------------------
  |  |  453|   353k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  ------------------
  |  |  |  |  321|   353k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  322|   353k|{ \
  |  |  |  |  323|   353k|    /* east */ \
  |  |  |  |  324|   353k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|   353k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  ------------------
  |  |  |  |  325|   353k| \
  |  |  |  |  326|   353k|    /* mark target as significant */ \
  |  |  |  |  327|   353k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|   353k|#define T1_CHI_1_I  19
  |  |  |  |  ------------------
  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|   353k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  |  |  328|   353k| \
  |  |  |  |  329|   353k|    /* west */ \
  |  |  |  |  330|   353k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|   353k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  ------------------
  |  |  |  |  331|   353k| \
  |  |  |  |  332|   353k|    /* north-west, north, north-east */ \
  |  |  |  |  333|   353k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (333:9): [True: 197k, False: 156k]
  |  |  |  |  |  Branch (333:21): [True: 130k, False: 66.8k]
  |  |  |  |  ------------------
  |  |  |  |  334|   130k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  335|   130k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  127|   130k|#define T1_CHI_5_I  31
  |  |  |  |  ------------------
  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|   130k|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  ------------------
  |  |  |  |  336|   130k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|   130k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  ------------------
  |  |  |  |  337|   130k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|   130k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  ------------------
  |  |  |  |  338|   130k|    } \
  |  |  |  |  339|   353k| \
  |  |  |  |  340|   353k|    /* south-west, south, south-east */ \
  |  |  |  |  341|   353k|    if (ci == 3U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (341:9): [True: 0, False: 353k]
  |  |  |  |  ------------------
  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  343|      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)
  |  |  |  |  ------------------
  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  ------------------
  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  ------------------
  |  |  |  |  346|      0|    } \
  |  |  |  |  347|   353k|}
  |  |  ------------------
  |  |  454|   353k|        } \
  |  |  455|   760k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  ------------------
  |  |  |  |  163|   760k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|   760k|#define T1_PI_0     (1U << 21)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  456|   760k|    } \
  |  |  457|  6.24M|}
  ------------------
  472|  6.24M|                                      0, ci, mqc, mqc->curctx,
  473|  6.24M|                                      v, mqc->a, mqc->c, mqc->ct, oneplushalf, vsc);
  474|  6.24M|}
t1.c:opj_t1_dec_sigpass_mqc_64x64_novsc:
  690|  35.4k|{
  691|  35.4k|    opj_t1_dec_sigpass_mqc_internal(t1, bpno, OPJ_FALSE, 64, 64, 66);
  ------------------
  |  |  643|  35.4k|#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  |  644|  35.4k|{ \
  |  |  645|  35.4k|        OPJ_INT32 one, half, oneplushalf; \
  |  |  646|  35.4k|        OPJ_UINT32 i, j, k; \
  |  |  647|  35.4k|        register OPJ_INT32 *data = t1->data; \
  |  |  648|  35.4k|        register opj_flag_t *flagsp = &t1->flags[(flags_stride) + 1]; \
  |  |  649|  35.4k|        const OPJ_UINT32 l_w = w; \
  |  |  650|  35.4k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  651|  35.4k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  35.4k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  35.4k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  35.4k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  35.4k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  652|  35.4k|        register OPJ_UINT32 v; \
  |  |  653|  35.4k|        one = 1 << bpno; \
  |  |  654|  35.4k|        half = one >> 1; \
  |  |  655|  35.4k|        oneplushalf = one | half; \
  |  |  656|   602k|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (656:21): [True: 567k, False: 35.4k]
  |  |  ------------------
  |  |  657|  36.8M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (657:29): [True: 36.3M, False: 567k]
  |  |  ------------------
  |  |  658|  36.3M|                        opj_flag_t flags = *flagsp; \
  |  |  659|  36.3M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (659:29): [True: 29.4M, False: 6.90M]
  |  |  ------------------
  |  |  660|  29.4M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  29.4M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  29.4M|{ \
  |  |  |  |  437|  29.4M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  29.4M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  29.4M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  29.4M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  29.4M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 8.92M, False: 20.4M]
  |  |  |  |  ------------------
  |  |  |  |  438|  29.4M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  8.92M|#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|  8.92M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  8.92M|#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|  8.92M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  8.92M|#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|  8.92M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  8.92M|#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|  8.92M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  8.92M|#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|  8.92M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  8.92M|#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|  8.92M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  8.92M|#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|  8.92M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  8.92M|#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|  8.92M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  8.92M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 8.31M, False: 610k]
  |  |  |  |  ------------------
  |  |  |  |  439|  8.31M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  8.31M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  8.31M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  8.31M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  8.31M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  8.31M|{ \
  |  |  |  |  |  |  140|  8.31M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  8.31M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  8.31M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  8.31M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  8.31M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  8.31M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.79M, False: 6.52M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.79M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.79M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.79M|{ \
  |  |  |  |  |  |  |  |   57|  1.79M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 372k, False: 1.41M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   372k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   372k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   372k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.41M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.41M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.41M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.41M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.41M|    } \
  |  |  |  |  |  |  |  |   66|  1.79M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.79M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.79M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.79M|{ \
  |  |  |  |  |  |  |  |  128|  2.94M|    do { \
  |  |  |  |  |  |  |  |  129|  2.94M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 369k, False: 2.57M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   369k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   369k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   369k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   369k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   369k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   369k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   369k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   369k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 354k, False: 14.3k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   354k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 351k, False: 3.69k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   351k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   351k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   351k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   351k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.69k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.69k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.69k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.69k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   354k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  14.3k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  14.3k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  14.3k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  14.3k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   369k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   369k|        } \
  |  |  |  |  |  |  |  |  132|  2.94M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.94M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.94M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.94M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.15M, False: 1.79M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.79M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  6.52M|    } else {  \
  |  |  |  |  |  |  149|  6.52M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  6.52M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.90M, False: 4.62M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.90M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.90M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.90M|{ \
  |  |  |  |  |  |  |  |   45|  1.90M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 297k, False: 1.60M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   297k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   297k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.60M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.60M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.60M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.60M|    } \
  |  |  |  |  |  |  |  |   52|  1.90M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.90M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.90M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.90M|{ \
  |  |  |  |  |  |  |  |  128|  2.03M|    do { \
  |  |  |  |  |  |  |  |  129|  2.03M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 257k, False: 1.77M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   257k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   257k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   257k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   257k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   257k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   257k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   257k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   257k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 248k, False: 9.89k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   248k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 245k, False: 2.57k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   245k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   245k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   245k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   245k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.57k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.57k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.57k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.57k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   248k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  9.89k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  9.89k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  9.89k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  9.89k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   257k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   257k|        } \
  |  |  |  |  |  |  |  |  132|  2.03M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.03M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.03M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.03M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 134k, False: 1.90M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.90M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.62M|        } else { \
  |  |  |  |  |  |  154|  4.62M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.62M|        } \
  |  |  |  |  |  |  156|  6.52M|    } \
  |  |  |  |  |  |  157|  8.31M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  8.31M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 3.83M, False: 4.48M]
  |  |  |  |  ------------------
  |  |  |  |  443|  3.83M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  3.83M|                                flags, \
  |  |  |  |  445|  3.83M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  3.83M|                                ci); \
  |  |  |  |  447|  3.83M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  3.83M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  3.83M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  3.83M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  3.83M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  3.83M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  3.83M|{ \
  |  |  |  |  |  |  140|  3.83M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  3.83M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  3.83M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  3.83M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  3.83M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  3.83M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 918k, False: 2.91M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   918k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   918k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   918k|{ \
  |  |  |  |  |  |  |  |   57|   918k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 194k, False: 724k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   194k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   194k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   194k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   724k|    } else { \
  |  |  |  |  |  |  |  |   62|   724k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   724k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   724k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   724k|    } \
  |  |  |  |  |  |  |  |   66|   918k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   918k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   918k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   918k|{ \
  |  |  |  |  |  |  |  |  128|  1.49M|    do { \
  |  |  |  |  |  |  |  |  129|  1.49M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 186k, False: 1.30M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   186k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   186k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   186k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   186k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   186k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   186k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   186k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   186k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 179k, False: 7.68k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   179k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 177k, False: 2.00k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   177k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   177k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   177k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   177k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.00k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.00k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.00k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.00k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   179k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.68k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.68k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.68k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.68k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   186k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   186k|        } \
  |  |  |  |  |  |  |  |  132|  1.49M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.49M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.49M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.49M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 575k, False: 918k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   918k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  2.91M|    } else {  \
  |  |  |  |  |  |  149|  2.91M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  2.91M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 986k, False: 1.92M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   986k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   986k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   986k|{ \
  |  |  |  |  |  |  |  |   45|   986k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 154k, False: 831k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   154k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   154k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   831k|    } else { \
  |  |  |  |  |  |  |  |   49|   831k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   831k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   831k|    } \
  |  |  |  |  |  |  |  |   52|   986k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   986k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   986k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   986k|{ \
  |  |  |  |  |  |  |  |  128|  1.05M|    do { \
  |  |  |  |  |  |  |  |  129|  1.05M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 131k, False: 921k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   131k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   131k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   131k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   131k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   131k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   131k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   131k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   131k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 125k, False: 5.46k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   125k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 124k, False: 1.42k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   124k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   124k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   124k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   124k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.42k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.42k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.42k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.42k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   125k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.46k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.46k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.46k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.46k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   131k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   131k|        } \
  |  |  |  |  |  |  |  |  132|  1.05M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.05M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.05M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.05M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 66.6k, False: 986k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   986k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.92M|        } else { \
  |  |  |  |  |  |  154|  1.92M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.92M|        } \
  |  |  |  |  |  |  156|  2.91M|    } \
  |  |  |  |  |  |  157|  3.83M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  3.83M|            v = v ^ spb; \
  |  |  |  |  452|  3.83M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 1.90M, False: 1.93M]
  |  |  |  |  ------------------
  |  |  |  |  453|  3.83M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  3.83M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  3.83M|{ \
  |  |  |  |  |  |  323|  3.83M|    /* east */ \
  |  |  |  |  |  |  324|  3.83M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  3.83M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  3.83M| \
  |  |  |  |  |  |  326|  3.83M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  3.83M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  3.83M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.83M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  3.83M| \
  |  |  |  |  |  |  329|  3.83M|    /* west */ \
  |  |  |  |  |  |  330|  3.83M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  3.83M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  3.83M| \
  |  |  |  |  |  |  332|  3.83M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  3.83M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  3.83M|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|  3.83M|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|  3.83M|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|  3.83M|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|  3.83M|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|  3.83M|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|  3.83M|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|  3.83M|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|  3.83M|    } \
  |  |  |  |  |  |  339|  3.83M| \
  |  |  |  |  |  |  340|  3.83M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  3.83M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  3.83M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  3.83M|        } \
  |  |  |  |  455|  8.31M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  8.31M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  8.31M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  8.31M|    } \
  |  |  |  |  457|  29.4M|}
  |  |  ------------------
  |  |  661|  29.4M|                                flags, flagsp, flags_stride, data, \
  |  |  662|  29.4M|                                l_w, 0, mqc, curctx, v, a, c, ct, oneplushalf, vsc); \
  |  |  663|  29.4M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  29.4M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  29.4M|{ \
  |  |  |  |  437|  29.4M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  29.4M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  29.4M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  29.4M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  29.4M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 8.93M, False: 20.4M]
  |  |  |  |  ------------------
  |  |  |  |  438|  29.4M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  8.93M|#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|  8.93M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  8.93M|#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|  8.93M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  8.93M|#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|  8.93M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  8.93M|#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|  8.93M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  8.93M|#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|  8.93M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  8.93M|#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|  8.93M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  8.93M|#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|  8.93M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  8.93M|#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|  8.93M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  8.93M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 8.35M, False: 573k]
  |  |  |  |  ------------------
  |  |  |  |  439|  8.35M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  8.35M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  8.35M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  8.35M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  8.35M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  8.35M|{ \
  |  |  |  |  |  |  140|  8.35M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  8.35M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  8.35M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  8.35M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  8.35M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  8.35M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.78M, False: 6.56M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.78M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.78M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.78M|{ \
  |  |  |  |  |  |  |  |   57|  1.78M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 371k, False: 1.41M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   371k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   371k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   371k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.41M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.41M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.41M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.41M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.41M|    } \
  |  |  |  |  |  |  |  |   66|  1.78M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.78M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.78M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.78M|{ \
  |  |  |  |  |  |  |  |  128|  2.94M|    do { \
  |  |  |  |  |  |  |  |  129|  2.94M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 369k, False: 2.57M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   369k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   369k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   369k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   369k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   369k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   369k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   369k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   369k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 354k, False: 14.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   354k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 351k, False: 3.62k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   351k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   351k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   351k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   351k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.62k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.62k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.62k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.62k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   354k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  14.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  14.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  14.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  14.6k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   369k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   369k|        } \
  |  |  |  |  |  |  |  |  132|  2.94M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.94M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.94M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.94M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.15M, False: 1.78M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.78M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  6.56M|    } else {  \
  |  |  |  |  |  |  149|  6.56M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  6.56M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.90M, False: 4.66M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.90M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.90M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.90M|{ \
  |  |  |  |  |  |  |  |   45|  1.90M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 297k, False: 1.60M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   297k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   297k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.60M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.60M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.60M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.60M|    } \
  |  |  |  |  |  |  |  |   52|  1.90M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.90M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.90M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.90M|{ \
  |  |  |  |  |  |  |  |  128|  2.03M|    do { \
  |  |  |  |  |  |  |  |  129|  2.03M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 255k, False: 1.78M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   255k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   255k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   255k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   255k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   255k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   255k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   255k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   255k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 244k, False: 10.3k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   244k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 242k, False: 2.47k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   242k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   242k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   242k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   242k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.47k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.47k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.47k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.47k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   244k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  10.3k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  10.3k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  10.3k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  10.3k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   255k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   255k|        } \
  |  |  |  |  |  |  |  |  132|  2.03M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.03M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.03M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.03M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 134k, False: 1.90M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.90M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.66M|        } else { \
  |  |  |  |  |  |  154|  4.66M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.66M|        } \
  |  |  |  |  |  |  156|  6.56M|    } \
  |  |  |  |  |  |  157|  8.35M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  8.35M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 3.85M, False: 4.49M]
  |  |  |  |  ------------------
  |  |  |  |  443|  3.85M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  3.85M|                                flags, \
  |  |  |  |  445|  3.85M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  3.85M|                                ci); \
  |  |  |  |  447|  3.85M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  3.85M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  3.85M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  3.85M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  3.85M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  3.85M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  3.85M|{ \
  |  |  |  |  |  |  140|  3.85M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  3.85M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  3.85M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  3.85M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  3.85M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  3.85M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 920k, False: 2.93M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   920k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   920k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   920k|{ \
  |  |  |  |  |  |  |  |   57|   920k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 196k, False: 724k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   196k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   196k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   196k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   724k|    } else { \
  |  |  |  |  |  |  |  |   62|   724k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   724k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   724k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   724k|    } \
  |  |  |  |  |  |  |  |   66|   920k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   920k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   920k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   920k|{ \
  |  |  |  |  |  |  |  |  128|  1.50M|    do { \
  |  |  |  |  |  |  |  |  129|  1.50M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 186k, False: 1.31M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   186k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   186k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   186k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   186k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   186k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   186k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   186k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   186k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 178k, False: 7.86k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   178k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 176k, False: 2.02k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   176k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   176k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   176k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   176k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.02k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.02k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.02k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.02k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   178k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.86k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.86k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.86k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.86k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   186k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   186k|        } \
  |  |  |  |  |  |  |  |  132|  1.50M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.50M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.50M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.50M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 582k, False: 920k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   920k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  2.93M|    } else {  \
  |  |  |  |  |  |  149|  2.93M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  2.93M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 993k, False: 1.94M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   993k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   993k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   993k|{ \
  |  |  |  |  |  |  |  |   45|   993k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 155k, False: 838k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   155k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   155k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   838k|    } else { \
  |  |  |  |  |  |  |  |   49|   838k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   838k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   838k|    } \
  |  |  |  |  |  |  |  |   52|   993k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   993k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   993k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   993k|{ \
  |  |  |  |  |  |  |  |  128|  1.06M|    do { \
  |  |  |  |  |  |  |  |  129|  1.06M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 132k, False: 928k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   132k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   132k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   132k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   132k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   132k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   132k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   132k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   132k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 127k, False: 5.55k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   127k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 125k, False: 1.52k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   125k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   125k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   125k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   125k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.52k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.52k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.52k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.52k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   127k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.55k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.55k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.55k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.55k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   132k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   132k|        } \
  |  |  |  |  |  |  |  |  132|  1.06M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.06M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.06M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.06M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 67.5k, False: 993k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   993k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.94M|        } else { \
  |  |  |  |  |  |  154|  1.94M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.94M|        } \
  |  |  |  |  |  |  156|  2.93M|    } \
  |  |  |  |  |  |  157|  3.85M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  3.85M|            v = v ^ spb; \
  |  |  |  |  452|  3.85M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 1.92M, False: 1.92M]
  |  |  |  |  ------------------
  |  |  |  |  453|  3.85M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  3.85M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  3.85M|{ \
  |  |  |  |  |  |  323|  3.85M|    /* east */ \
  |  |  |  |  |  |  324|  3.85M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  3.85M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  3.85M| \
  |  |  |  |  |  |  326|  3.85M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  3.85M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  3.85M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.85M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  3.85M| \
  |  |  |  |  |  |  329|  3.85M|    /* west */ \
  |  |  |  |  |  |  330|  3.85M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  3.85M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  3.85M| \
  |  |  |  |  |  |  332|  3.85M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  3.85M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  3.85M| \
  |  |  |  |  |  |  340|  3.85M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  3.85M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  3.85M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  3.85M|        } \
  |  |  |  |  455|  8.35M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  8.35M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  8.35M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  8.35M|    } \
  |  |  |  |  457|  29.4M|}
  |  |  ------------------
  |  |  664|  29.4M|                                flags, flagsp, flags_stride, data, \
  |  |  665|  29.4M|                                l_w, 1, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  666|  29.4M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  29.4M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  29.4M|{ \
  |  |  |  |  437|  29.4M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  29.4M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  29.4M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  29.4M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  29.4M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 9.04M, False: 20.3M]
  |  |  |  |  ------------------
  |  |  |  |  438|  29.4M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  9.04M|#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|  9.04M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  9.04M|#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|  9.04M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  9.04M|#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|  9.04M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  9.04M|#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|  9.04M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  9.04M|#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|  9.04M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  9.04M|#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|  9.04M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  9.04M|#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|  9.04M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  9.04M|#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|  9.04M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  9.04M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 8.40M, False: 644k]
  |  |  |  |  ------------------
  |  |  |  |  439|  8.40M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  8.40M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  8.40M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  8.40M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  8.40M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  8.40M|{ \
  |  |  |  |  |  |  140|  8.40M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  8.40M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  8.40M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  8.40M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  8.40M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  8.40M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.80M, False: 6.60M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.80M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.80M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.80M|{ \
  |  |  |  |  |  |  |  |   57|  1.80M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 375k, False: 1.42M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   375k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   375k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   375k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.42M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.42M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.42M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.42M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.42M|    } \
  |  |  |  |  |  |  |  |   66|  1.80M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.80M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.80M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.80M|{ \
  |  |  |  |  |  |  |  |  128|  2.96M|    do { \
  |  |  |  |  |  |  |  |  129|  2.96M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 371k, False: 2.59M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   371k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   371k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   371k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   371k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   371k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   371k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   371k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   371k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 357k, False: 14.3k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   357k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 353k, False: 3.66k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   353k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   353k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   353k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   353k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.66k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.66k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.66k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.66k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   357k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  14.3k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  14.3k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  14.3k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  14.3k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   371k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   371k|        } \
  |  |  |  |  |  |  |  |  132|  2.96M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.96M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.96M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.96M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.16M, False: 1.80M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.80M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  6.60M|    } else {  \
  |  |  |  |  |  |  149|  6.60M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  6.60M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.90M, False: 4.69M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.90M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.90M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.90M|{ \
  |  |  |  |  |  |  |  |   45|  1.90M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 294k, False: 1.60M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   294k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   294k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.60M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.60M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.60M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.60M|    } \
  |  |  |  |  |  |  |  |   52|  1.90M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.90M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.90M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.90M|{ \
  |  |  |  |  |  |  |  |  128|  2.03M|    do { \
  |  |  |  |  |  |  |  |  129|  2.03M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 255k, False: 1.78M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   255k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   255k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   255k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   255k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   255k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   255k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   255k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   255k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 245k, False: 9.99k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   245k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 243k, False: 2.61k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   243k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   243k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   243k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   243k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.61k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.61k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.61k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.61k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   245k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  9.99k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  9.99k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  9.99k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  9.99k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   255k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   255k|        } \
  |  |  |  |  |  |  |  |  132|  2.03M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.03M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.03M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.03M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 133k, False: 1.90M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.90M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.69M|        } else { \
  |  |  |  |  |  |  154|  4.69M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.69M|        } \
  |  |  |  |  |  |  156|  6.60M|    } \
  |  |  |  |  |  |  157|  8.40M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  8.40M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 3.89M, False: 4.51M]
  |  |  |  |  ------------------
  |  |  |  |  443|  3.89M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  3.89M|                                flags, \
  |  |  |  |  445|  3.89M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  3.89M|                                ci); \
  |  |  |  |  447|  3.89M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  3.89M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  3.89M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  3.89M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  3.89M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  3.89M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  3.89M|{ \
  |  |  |  |  |  |  140|  3.89M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  3.89M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  3.89M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  3.89M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  3.89M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  3.89M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 939k, False: 2.95M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   939k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   939k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   939k|{ \
  |  |  |  |  |  |  |  |   57|   939k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 201k, False: 737k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   201k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   201k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   201k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   737k|    } else { \
  |  |  |  |  |  |  |  |   62|   737k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   737k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   737k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   737k|    } \
  |  |  |  |  |  |  |  |   66|   939k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   939k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   939k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   939k|{ \
  |  |  |  |  |  |  |  |  128|  1.52M|    do { \
  |  |  |  |  |  |  |  |  129|  1.52M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 189k, False: 1.33M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   189k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   189k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   189k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   189k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   189k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   189k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   189k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   189k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 181k, False: 7.90k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   181k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 179k, False: 2.12k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   179k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   179k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   179k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   179k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.12k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.12k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.12k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.12k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   181k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.90k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.90k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.90k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.90k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   189k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   189k|        } \
  |  |  |  |  |  |  |  |  132|  1.52M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.52M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.52M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.52M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 590k, False: 939k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   939k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  2.95M|    } else {  \
  |  |  |  |  |  |  149|  2.95M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  2.95M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 998k, False: 1.95M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   998k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   998k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   998k|{ \
  |  |  |  |  |  |  |  |   45|   998k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 158k, False: 840k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   158k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   158k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   840k|    } else { \
  |  |  |  |  |  |  |  |   49|   840k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   840k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   840k|    } \
  |  |  |  |  |  |  |  |   52|   998k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   998k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   998k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   998k|{ \
  |  |  |  |  |  |  |  |  128|  1.06M|    do { \
  |  |  |  |  |  |  |  |  129|  1.06M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 131k, False: 935k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   131k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   131k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   131k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   131k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   131k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   131k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   131k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   131k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 126k, False: 5.48k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   126k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 124k, False: 1.42k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   124k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   124k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   124k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   124k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.42k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.42k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.42k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.42k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   126k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.48k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.48k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.48k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.48k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   131k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   131k|        } \
  |  |  |  |  |  |  |  |  132|  1.06M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.06M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.06M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.06M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 69.1k, False: 998k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   998k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.95M|        } else { \
  |  |  |  |  |  |  154|  1.95M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.95M|        } \
  |  |  |  |  |  |  156|  2.95M|    } \
  |  |  |  |  |  |  157|  3.89M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  3.89M|            v = v ^ spb; \
  |  |  |  |  452|  3.89M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 1.93M, False: 1.95M]
  |  |  |  |  ------------------
  |  |  |  |  453|  3.89M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  3.89M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  3.89M|{ \
  |  |  |  |  |  |  323|  3.89M|    /* east */ \
  |  |  |  |  |  |  324|  3.89M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  3.89M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  3.89M| \
  |  |  |  |  |  |  326|  3.89M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  3.89M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  3.89M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.89M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  3.89M| \
  |  |  |  |  |  |  329|  3.89M|    /* west */ \
  |  |  |  |  |  |  330|  3.89M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  3.89M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  3.89M| \
  |  |  |  |  |  |  332|  3.89M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  3.89M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  3.89M| \
  |  |  |  |  |  |  340|  3.89M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  3.89M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  3.89M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  3.89M|        } \
  |  |  |  |  455|  8.40M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  8.40M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  8.40M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  8.40M|    } \
  |  |  |  |  457|  29.4M|}
  |  |  ------------------
  |  |  667|  29.4M|                                flags, flagsp, flags_stride, data, \
  |  |  668|  29.4M|                                l_w, 2, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  669|  29.4M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  29.4M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  29.4M|{ \
  |  |  |  |  437|  29.4M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  29.4M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  29.4M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  29.4M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  29.4M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 9.29M, False: 20.1M]
  |  |  |  |  ------------------
  |  |  |  |  438|  29.4M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  9.29M|#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|  9.29M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  9.29M|#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|  9.29M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  9.29M|#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|  9.29M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  9.29M|#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|  9.29M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  9.29M|#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|  9.29M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  9.29M|#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|  9.29M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  9.29M|#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|  9.29M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  9.29M|#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|  9.29M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  9.29M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 8.60M, False: 690k]
  |  |  |  |  ------------------
  |  |  |  |  439|  8.60M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  8.60M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  8.60M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  8.60M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  8.60M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  8.60M|{ \
  |  |  |  |  |  |  140|  8.60M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  8.60M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  8.60M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  8.60M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  8.60M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  8.60M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.84M, False: 6.75M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.84M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.84M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.84M|{ \
  |  |  |  |  |  |  |  |   57|  1.84M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 385k, False: 1.45M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   385k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   385k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   385k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.45M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.45M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.45M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.45M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.45M|    } \
  |  |  |  |  |  |  |  |   66|  1.84M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.84M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.84M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.84M|{ \
  |  |  |  |  |  |  |  |  128|  3.04M|    do { \
  |  |  |  |  |  |  |  |  129|  3.04M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 381k, False: 2.66M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   381k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   381k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   381k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   381k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   381k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   381k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   381k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   381k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 366k, False: 14.9k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   366k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 362k, False: 3.63k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   362k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   362k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   362k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   362k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.63k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.63k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.63k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.63k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   366k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  14.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  14.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  14.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  14.9k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   381k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   381k|        } \
  |  |  |  |  |  |  |  |  132|  3.04M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.04M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.04M|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.04M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.19M, False: 1.84M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.84M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  6.75M|    } else {  \
  |  |  |  |  |  |  149|  6.75M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  6.75M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.94M, False: 4.80M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.94M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.94M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.94M|{ \
  |  |  |  |  |  |  |  |   45|  1.94M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 305k, False: 1.64M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   305k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   305k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.64M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.64M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.64M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.64M|    } \
  |  |  |  |  |  |  |  |   52|  1.94M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.94M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.94M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.94M|{ \
  |  |  |  |  |  |  |  |  128|  2.08M|    do { \
  |  |  |  |  |  |  |  |  129|  2.08M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 260k, False: 1.82M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   260k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   260k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   260k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   260k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   260k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   260k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   260k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   260k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 251k, False: 9.48k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   251k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 249k, False: 2.41k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   249k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   249k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   249k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   249k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.41k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.41k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.41k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.41k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   251k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  9.48k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  9.48k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  9.48k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  9.48k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   260k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   260k|        } \
  |  |  |  |  |  |  |  |  132|  2.08M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.08M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.08M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.08M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 138k, False: 1.94M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.94M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.80M|        } else { \
  |  |  |  |  |  |  154|  4.80M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.80M|        } \
  |  |  |  |  |  |  156|  6.75M|    } \
  |  |  |  |  |  |  157|  8.60M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  8.60M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 3.98M, False: 4.61M]
  |  |  |  |  ------------------
  |  |  |  |  443|  3.98M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  3.98M|                                flags, \
  |  |  |  |  445|  3.98M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  3.98M|                                ci); \
  |  |  |  |  447|  3.98M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  3.98M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  3.98M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  3.98M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  3.98M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  3.98M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  3.98M|{ \
  |  |  |  |  |  |  140|  3.98M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  3.98M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  3.98M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  3.98M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  3.98M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  3.98M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 955k, False: 3.03M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   955k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   955k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   955k|{ \
  |  |  |  |  |  |  |  |   57|   955k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 203k, False: 752k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   203k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   203k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   203k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   752k|    } else { \
  |  |  |  |  |  |  |  |   62|   752k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   752k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   752k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   752k|    } \
  |  |  |  |  |  |  |  |   66|   955k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   955k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   955k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   955k|{ \
  |  |  |  |  |  |  |  |  128|  1.55M|    do { \
  |  |  |  |  |  |  |  |  129|  1.55M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 194k, False: 1.36M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   194k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   194k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   194k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   194k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   194k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   194k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   194k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   194k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 186k, False: 8.79k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   186k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 184k, False: 2.07k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   184k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   184k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   184k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   184k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.07k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.07k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.07k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.07k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   186k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  8.79k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  8.79k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  8.79k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  8.79k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   194k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   194k|        } \
  |  |  |  |  |  |  |  |  132|  1.55M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.55M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.55M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.55M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 602k, False: 955k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   955k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.03M|    } else {  \
  |  |  |  |  |  |  149|  3.03M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.03M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.02M, False: 2.00M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.02M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.02M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.02M|{ \
  |  |  |  |  |  |  |  |   45|  1.02M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 163k, False: 865k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   163k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   163k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   865k|    } else { \
  |  |  |  |  |  |  |  |   49|   865k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   865k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   865k|    } \
  |  |  |  |  |  |  |  |   52|  1.02M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.02M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.02M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.02M|{ \
  |  |  |  |  |  |  |  |  128|  1.10M|    do { \
  |  |  |  |  |  |  |  |  129|  1.10M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 137k, False: 963k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   137k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   137k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   137k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   137k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   137k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   137k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   137k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   137k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 131k, False: 5.96k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   131k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 130k, False: 1.46k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   130k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   130k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   130k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   130k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.46k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.46k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.46k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.46k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   131k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.96k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.96k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.96k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.96k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   137k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   137k|        } \
  |  |  |  |  |  |  |  |  132|  1.10M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.10M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.10M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.10M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 71.9k, False: 1.02M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.02M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.00M|        } else { \
  |  |  |  |  |  |  154|  2.00M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.00M|        } \
  |  |  |  |  |  |  156|  3.03M|    } \
  |  |  |  |  |  |  157|  3.98M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  3.98M|            v = v ^ spb; \
  |  |  |  |  452|  3.98M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 1.98M, False: 1.99M]
  |  |  |  |  ------------------
  |  |  |  |  453|  3.98M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  3.98M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  3.98M|{ \
  |  |  |  |  |  |  323|  3.98M|    /* east */ \
  |  |  |  |  |  |  324|  3.98M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  3.98M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  3.98M| \
  |  |  |  |  |  |  326|  3.98M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  3.98M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  3.98M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.98M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  3.98M| \
  |  |  |  |  |  |  329|  3.98M|    /* west */ \
  |  |  |  |  |  |  330|  3.98M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  3.98M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  3.98M| \
  |  |  |  |  |  |  332|  3.98M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  3.98M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  3.98M| \
  |  |  |  |  |  |  340|  3.98M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  3.98M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|  3.98M|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|  3.98M|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  3.98M|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  3.98M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  3.98M|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  3.98M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  3.98M|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  3.98M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|  3.98M|    } \
  |  |  |  |  |  |  347|  3.98M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  3.98M|        } \
  |  |  |  |  455|  8.60M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  8.60M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  8.60M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  8.60M|    } \
  |  |  |  |  457|  29.4M|}
  |  |  ------------------
  |  |  670|  29.4M|                                flags, flagsp, flags_stride, data, \
  |  |  671|  29.4M|                                l_w, 3, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  672|  29.4M|                            *flagsp = flags; \
  |  |  673|  29.4M|                        } \
  |  |  674|  36.3M|                } \
  |  |  675|   567k|        } \
  |  |  676|  35.4k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  35.4k|        mqc->curctx = curctx; \
  |  |  |  |  167|  35.4k|        mqc->c = c; \
  |  |  |  |  168|  35.4k|        mqc->a = a; \
  |  |  |  |  169|  35.4k|        mqc->ct = ct;
  |  |  ------------------
  |  |  677|  35.4k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (677:13): [True: 0, False: 35.4k]
  |  |  ------------------
  |  |  678|      0|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (678:25): [True: 0, False: 0]
  |  |  ------------------
  |  |  679|      0|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (679:29): [True: 0, False: 0]
  |  |  ------------------
  |  |  680|      0|                        opj_t1_dec_sigpass_step_mqc(t1, flagsp, \
  |  |  681|      0|                            data + j * l_w, oneplushalf, j, flags_stride, vsc); \
  |  |  682|      0|                } \
  |  |  683|      0|            } \
  |  |  684|      0|        } \
  |  |  685|  35.4k|}
  ------------------
  692|  35.4k|}
t1.c:opj_t1_dec_sigpass_mqc_generic_vsc:
  712|   191k|{
  713|   191k|    opj_t1_dec_sigpass_mqc_internal(t1, bpno, OPJ_TRUE, t1->w, t1->h,
  ------------------
  |  |  643|   191k|#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  |  644|   191k|{ \
  |  |  645|   191k|        OPJ_INT32 one, half, oneplushalf; \
  |  |  646|   191k|        OPJ_UINT32 i, j, k; \
  |  |  647|   191k|        register OPJ_INT32 *data = t1->data; \
  |  |  648|   191k|        register opj_flag_t *flagsp = &t1->flags[(flags_stride) + 1]; \
  |  |  649|   191k|        const OPJ_UINT32 l_w = w; \
  |  |  650|   191k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  651|   191k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|   191k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|   191k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|   191k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|   191k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  652|   191k|        register OPJ_UINT32 v; \
  |  |  653|   191k|        one = 1 << bpno; \
  |  |  654|   191k|        half = one >> 1; \
  |  |  655|   191k|        oneplushalf = one | half; \
  |  |  656|  5.61M|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (656:21): [True: 5.42M, False: 191k]
  |  |  ------------------
  |  |  657|  44.7M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (657:29): [True: 39.3M, False: 5.42M]
  |  |  ------------------
  |  |  658|  39.3M|                        opj_flag_t flags = *flagsp; \
  |  |  659|  39.3M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (659:29): [True: 28.2M, False: 11.0M]
  |  |  ------------------
  |  |  660|  28.2M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  28.2M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  28.2M|{ \
  |  |  |  |  437|  28.2M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  28.2M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  28.2M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  28.2M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  28.2M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 7.84M, False: 20.3M]
  |  |  |  |  ------------------
  |  |  |  |  438|  28.2M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  7.84M|#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|  7.84M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  7.84M|#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|  7.84M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  7.84M|#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|  7.84M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  7.84M|#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|  7.84M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  7.84M|#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|  7.84M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  7.84M|#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|  7.84M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  7.84M|#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|  7.84M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  7.84M|#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|  7.84M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  7.84M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 7.16M, False: 683k]
  |  |  |  |  ------------------
  |  |  |  |  439|  7.16M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  7.16M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  7.16M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  7.16M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  7.16M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  7.16M|{ \
  |  |  |  |  |  |  140|  7.16M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  7.16M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  7.16M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  7.16M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  7.16M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  7.16M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.57M, False: 5.58M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.57M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.57M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.57M|{ \
  |  |  |  |  |  |  |  |   57|  1.57M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 338k, False: 1.24M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   338k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   338k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   338k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.24M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.24M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.24M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.24M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.24M|    } \
  |  |  |  |  |  |  |  |   66|  1.57M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.57M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.57M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.57M|{ \
  |  |  |  |  |  |  |  |  128|  2.54M|    do { \
  |  |  |  |  |  |  |  |  129|  2.54M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 318k, False: 2.23M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   318k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   318k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   318k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   318k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   318k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   318k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   318k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   318k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 310k, False: 7.70k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   310k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 307k, False: 2.80k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   307k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   307k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   307k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   307k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.80k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.80k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.80k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.80k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   310k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.70k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.70k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.70k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.70k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   318k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   318k|        } \
  |  |  |  |  |  |  |  |  132|  2.54M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.54M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.54M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.54M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 968k, False: 1.57M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.57M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  5.58M|    } else {  \
  |  |  |  |  |  |  149|  5.58M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  5.58M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.66M, False: 3.91M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.66M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.66M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.66M|{ \
  |  |  |  |  |  |  |  |   45|  1.66M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 266k, False: 1.39M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   266k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   266k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.39M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.39M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.39M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.39M|    } \
  |  |  |  |  |  |  |  |   52|  1.66M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.66M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.66M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.66M|{ \
  |  |  |  |  |  |  |  |  128|  1.78M|    do { \
  |  |  |  |  |  |  |  |  129|  1.78M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 222k, False: 1.56M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   222k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   222k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   222k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   222k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   222k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   222k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   222k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   222k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 217k, False: 5.10k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   217k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 215k, False: 1.81k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   215k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   215k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   215k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   215k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.81k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.81k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.81k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.81k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   217k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.10k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.10k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.10k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.10k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   222k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   222k|        } \
  |  |  |  |  |  |  |  |  132|  1.78M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.78M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.78M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.78M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 118k, False: 1.66M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.66M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.91M|        } else { \
  |  |  |  |  |  |  154|  3.91M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  3.91M|        } \
  |  |  |  |  |  |  156|  5.58M|    } \
  |  |  |  |  |  |  157|  7.16M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  7.16M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 3.01M, False: 4.14M]
  |  |  |  |  ------------------
  |  |  |  |  443|  3.01M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  3.01M|                                flags, \
  |  |  |  |  445|  3.01M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  3.01M|                                ci); \
  |  |  |  |  447|  3.01M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  3.01M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  3.01M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  3.01M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  3.01M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  3.01M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  3.01M|{ \
  |  |  |  |  |  |  140|  3.01M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  3.01M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  3.01M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  3.01M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  3.01M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  3.01M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 770k, False: 2.24M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   770k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   770k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   770k|{ \
  |  |  |  |  |  |  |  |   57|   770k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 168k, False: 602k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   168k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   168k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   168k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   602k|    } else { \
  |  |  |  |  |  |  |  |   62|   602k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   602k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   602k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   602k|    } \
  |  |  |  |  |  |  |  |   66|   770k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   770k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   770k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   770k|{ \
  |  |  |  |  |  |  |  |  128|  1.23M|    do { \
  |  |  |  |  |  |  |  |  129|  1.23M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 154k, False: 1.08M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   154k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   154k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   154k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   154k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   154k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   154k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   154k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   154k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 150k, False: 4.19k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   150k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 148k, False: 1.31k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   148k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   148k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   148k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   148k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.31k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.31k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.31k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.31k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   150k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.19k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.19k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.19k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.19k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   154k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   154k|        } \
  |  |  |  |  |  |  |  |  132|  1.23M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.23M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.23M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.23M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 463k, False: 770k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   770k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  2.24M|    } else {  \
  |  |  |  |  |  |  149|  2.24M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  2.24M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 829k, False: 1.41M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   829k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   829k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   829k|{ \
  |  |  |  |  |  |  |  |   45|   829k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 130k, False: 699k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   130k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   130k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   699k|    } else { \
  |  |  |  |  |  |  |  |   49|   699k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   699k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   699k|    } \
  |  |  |  |  |  |  |  |   52|   829k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   829k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   829k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   829k|{ \
  |  |  |  |  |  |  |  |  128|   887k|    do { \
  |  |  |  |  |  |  |  |  129|   887k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 111k, False: 776k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 108k, False: 2.79k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   108k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 106k, False: 2.00k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   106k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   106k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   106k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   106k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.00k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.00k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.00k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.00k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   108k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.79k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.79k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.79k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.79k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   111k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   111k|        } \
  |  |  |  |  |  |  |  |  132|   887k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   887k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   887k|        ct--; \
  |  |  |  |  |  |  |  |  135|   887k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 57.1k, False: 829k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   829k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.41M|        } else { \
  |  |  |  |  |  |  154|  1.41M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.41M|        } \
  |  |  |  |  |  |  156|  2.24M|    } \
  |  |  |  |  |  |  157|  3.01M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  3.01M|            v = v ^ spb; \
  |  |  |  |  452|  3.01M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 1.50M, False: 1.51M]
  |  |  |  |  ------------------
  |  |  |  |  453|  3.01M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  3.01M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  3.01M|{ \
  |  |  |  |  |  |  323|  3.01M|    /* east */ \
  |  |  |  |  |  |  324|  3.01M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  3.01M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  3.01M| \
  |  |  |  |  |  |  326|  3.01M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  3.01M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  3.01M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.01M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  3.01M| \
  |  |  |  |  |  |  329|  3.01M|    /* west */ \
  |  |  |  |  |  |  330|  3.01M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  3.01M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  3.01M| \
  |  |  |  |  |  |  332|  3.01M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  3.01M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  3.01M| \
  |  |  |  |  |  |  340|  3.01M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  3.01M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  3.01M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  3.01M|        } \
  |  |  |  |  455|  7.16M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  7.16M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  7.16M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  7.16M|    } \
  |  |  |  |  457|  28.2M|}
  |  |  ------------------
  |  |  661|  28.2M|                                flags, flagsp, flags_stride, data, \
  |  |  662|  28.2M|                                l_w, 0, mqc, curctx, v, a, c, ct, oneplushalf, vsc); \
  |  |  663|  28.2M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  28.2M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  28.2M|{ \
  |  |  |  |  437|  28.2M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  28.2M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  28.2M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  28.2M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  28.2M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 7.88M, False: 20.3M]
  |  |  |  |  ------------------
  |  |  |  |  438|  28.2M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  7.88M|#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|  7.88M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  7.88M|#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|  7.88M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  7.88M|#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|  7.88M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  7.88M|#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|  7.88M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  7.88M|#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|  7.88M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  7.88M|#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|  7.88M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  7.88M|#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|  7.88M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  7.88M|#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|  7.88M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  7.88M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 7.27M, False: 610k]
  |  |  |  |  ------------------
  |  |  |  |  439|  7.27M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  7.27M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  7.27M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  7.27M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  7.27M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  7.27M|{ \
  |  |  |  |  |  |  140|  7.27M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  7.27M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  7.27M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  7.27M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  7.27M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  7.27M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.63M, False: 5.64M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.63M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.63M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.63M|{ \
  |  |  |  |  |  |  |  |   57|  1.63M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 348k, False: 1.28M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   348k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   348k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   348k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.28M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.28M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.28M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.28M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.28M|    } \
  |  |  |  |  |  |  |  |   66|  1.63M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.63M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.63M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.63M|{ \
  |  |  |  |  |  |  |  |  128|  2.63M|    do { \
  |  |  |  |  |  |  |  |  129|  2.63M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 325k, False: 2.31M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   325k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   325k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   325k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   325k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   325k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   325k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   325k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   325k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 317k, False: 8.47k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   317k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 313k, False: 3.32k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   313k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   313k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   313k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   313k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.32k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.32k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.32k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.32k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   317k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  8.47k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  8.47k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  8.47k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  8.47k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   325k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   325k|        } \
  |  |  |  |  |  |  |  |  132|  2.63M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.63M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.63M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.63M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.00M, False: 1.63M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.63M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  5.64M|    } else {  \
  |  |  |  |  |  |  149|  5.64M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  5.64M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.70M, False: 3.93M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.70M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.70M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.70M|{ \
  |  |  |  |  |  |  |  |   45|  1.70M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 274k, False: 1.42M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   274k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   274k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.42M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.42M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.42M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.42M|    } \
  |  |  |  |  |  |  |  |   52|  1.70M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.70M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.70M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.70M|{ \
  |  |  |  |  |  |  |  |  128|  1.82M|    do { \
  |  |  |  |  |  |  |  |  129|  1.82M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 232k, False: 1.59M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   232k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   232k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   232k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   232k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   232k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   232k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   232k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   232k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 227k, False: 4.64k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   227k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 224k, False: 2.82k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   224k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   224k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   224k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   224k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.82k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.82k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.82k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.82k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   227k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.64k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.64k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.64k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.64k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   232k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   232k|        } \
  |  |  |  |  |  |  |  |  132|  1.82M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.82M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.82M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.82M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 123k, False: 1.70M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.70M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.93M|        } else { \
  |  |  |  |  |  |  154|  3.93M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  3.93M|        } \
  |  |  |  |  |  |  156|  5.64M|    } \
  |  |  |  |  |  |  157|  7.27M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  7.27M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 3.02M, False: 4.25M]
  |  |  |  |  ------------------
  |  |  |  |  443|  3.02M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  3.02M|                                flags, \
  |  |  |  |  445|  3.02M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  3.02M|                                ci); \
  |  |  |  |  447|  3.02M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  3.02M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  3.02M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  3.02M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  3.02M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  3.02M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  3.02M|{ \
  |  |  |  |  |  |  140|  3.02M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  3.02M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  3.02M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  3.02M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  3.02M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  3.02M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 782k, False: 2.23M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   782k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   782k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   782k|{ \
  |  |  |  |  |  |  |  |   57|   782k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 168k, False: 613k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   168k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   168k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   168k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   613k|    } else { \
  |  |  |  |  |  |  |  |   62|   613k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   613k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   613k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   613k|    } \
  |  |  |  |  |  |  |  |   66|   782k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   782k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   782k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   782k|{ \
  |  |  |  |  |  |  |  |  128|  1.24M|    do { \
  |  |  |  |  |  |  |  |  129|  1.24M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 157k, False: 1.09M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   157k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   157k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   157k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   157k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   157k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   157k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   157k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   157k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 153k, False: 4.29k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   153k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 151k, False: 1.66k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   151k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   151k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   151k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   151k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.66k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.66k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.66k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.66k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   153k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.29k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.29k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.29k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.29k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   157k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   157k|        } \
  |  |  |  |  |  |  |  |  132|  1.24M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.24M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.24M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.24M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 466k, False: 782k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   782k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  2.23M|    } else {  \
  |  |  |  |  |  |  149|  2.23M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  2.23M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 832k, False: 1.40M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   832k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   832k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   832k|{ \
  |  |  |  |  |  |  |  |   45|   832k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 132k, False: 700k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   132k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   132k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   700k|    } else { \
  |  |  |  |  |  |  |  |   49|   700k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   700k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   700k|    } \
  |  |  |  |  |  |  |  |   52|   832k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   832k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   832k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   832k|{ \
  |  |  |  |  |  |  |  |  128|   890k|    do { \
  |  |  |  |  |  |  |  |  129|   890k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 111k, False: 778k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 108k, False: 3.37k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   108k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 107k, False: 1.11k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   107k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   107k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   107k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   107k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.11k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.11k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.11k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.11k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   108k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.37k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.37k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.37k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.37k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   111k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   111k|        } \
  |  |  |  |  |  |  |  |  132|   890k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   890k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   890k|        ct--; \
  |  |  |  |  |  |  |  |  135|   890k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 58.2k, False: 832k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   832k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.40M|        } else { \
  |  |  |  |  |  |  154|  1.40M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.40M|        } \
  |  |  |  |  |  |  156|  2.23M|    } \
  |  |  |  |  |  |  157|  3.02M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  3.02M|            v = v ^ spb; \
  |  |  |  |  452|  3.02M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 1.50M, False: 1.51M]
  |  |  |  |  ------------------
  |  |  |  |  453|  3.02M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  3.02M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  3.02M|{ \
  |  |  |  |  |  |  323|  3.02M|    /* east */ \
  |  |  |  |  |  |  324|  3.02M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  3.02M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  3.02M| \
  |  |  |  |  |  |  326|  3.02M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  3.02M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  3.02M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.02M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  3.02M| \
  |  |  |  |  |  |  329|  3.02M|    /* west */ \
  |  |  |  |  |  |  330|  3.02M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  3.02M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  3.02M| \
  |  |  |  |  |  |  332|  3.02M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  3.02M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  3.02M| \
  |  |  |  |  |  |  340|  3.02M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  3.02M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  3.02M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  3.02M|        } \
  |  |  |  |  455|  7.27M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  7.27M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  7.27M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  7.27M|    } \
  |  |  |  |  457|  28.2M|}
  |  |  ------------------
  |  |  664|  28.2M|                                flags, flagsp, flags_stride, data, \
  |  |  665|  28.2M|                                l_w, 1, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  666|  28.2M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  28.2M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  28.2M|{ \
  |  |  |  |  437|  28.2M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  28.2M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  28.2M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  28.2M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  28.2M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 7.90M, False: 20.3M]
  |  |  |  |  ------------------
  |  |  |  |  438|  28.2M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  7.90M|#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|  7.90M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  7.90M|#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|  7.90M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  7.90M|#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|  7.90M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  7.90M|#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|  7.90M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  7.90M|#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|  7.90M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  7.90M|#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|  7.90M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  7.90M|#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|  7.90M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  7.90M|#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|  7.90M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  7.90M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 7.08M, False: 817k]
  |  |  |  |  ------------------
  |  |  |  |  439|  7.08M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  7.08M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  7.08M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  7.08M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  7.08M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  7.08M|{ \
  |  |  |  |  |  |  140|  7.08M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  7.08M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  7.08M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  7.08M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  7.08M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  7.08M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.56M, False: 5.51M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.56M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.56M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.56M|{ \
  |  |  |  |  |  |  |  |   57|  1.56M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 335k, False: 1.23M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   335k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   335k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   335k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.23M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.23M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.23M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.23M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.23M|    } \
  |  |  |  |  |  |  |  |   66|  1.56M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.56M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.56M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.56M|{ \
  |  |  |  |  |  |  |  |  128|  2.52M|    do { \
  |  |  |  |  |  |  |  |  129|  2.52M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 310k, False: 2.21M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   310k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   310k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   310k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   310k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   310k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   310k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   310k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   310k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 303k, False: 7.23k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   303k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 300k, False: 2.65k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   300k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   300k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   300k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   300k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.65k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.65k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.65k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.65k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   303k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.23k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.23k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.23k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.23k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   310k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   310k|        } \
  |  |  |  |  |  |  |  |  132|  2.52M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.52M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.52M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.52M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 957k, False: 1.56M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.56M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  5.51M|    } else {  \
  |  |  |  |  |  |  149|  5.51M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  5.51M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.64M, False: 3.87M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.64M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.64M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.64M|{ \
  |  |  |  |  |  |  |  |   45|  1.64M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 264k, False: 1.38M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   264k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   264k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.38M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.38M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.38M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.38M|    } \
  |  |  |  |  |  |  |  |   52|  1.64M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.64M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.64M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.64M|{ \
  |  |  |  |  |  |  |  |  128|  1.76M|    do { \
  |  |  |  |  |  |  |  |  129|  1.76M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 225k, False: 1.54M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   225k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   225k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   225k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   225k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   225k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   225k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   225k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   225k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 219k, False: 6.57k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   219k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 217k, False: 1.96k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   217k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   217k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   217k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   217k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.96k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.96k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.96k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.96k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   219k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.57k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.57k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.57k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.57k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   225k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   225k|        } \
  |  |  |  |  |  |  |  |  132|  1.76M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.76M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.76M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.76M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 119k, False: 1.64M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.64M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.87M|        } else { \
  |  |  |  |  |  |  154|  3.87M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  3.87M|        } \
  |  |  |  |  |  |  156|  5.51M|    } \
  |  |  |  |  |  |  157|  7.08M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  7.08M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 2.98M, False: 4.09M]
  |  |  |  |  ------------------
  |  |  |  |  443|  2.98M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  2.98M|                                flags, \
  |  |  |  |  445|  2.98M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  2.98M|                                ci); \
  |  |  |  |  447|  2.98M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  2.98M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  2.98M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.98M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  2.98M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.98M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.98M|{ \
  |  |  |  |  |  |  140|  2.98M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.98M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.98M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.98M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.98M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.98M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 764k, False: 2.22M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   764k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   764k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   764k|{ \
  |  |  |  |  |  |  |  |   57|   764k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 167k, False: 597k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   167k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   167k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   167k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   597k|    } else { \
  |  |  |  |  |  |  |  |   62|   597k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   597k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   597k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   597k|    } \
  |  |  |  |  |  |  |  |   66|   764k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   764k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   764k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   764k|{ \
  |  |  |  |  |  |  |  |  128|  1.22M|    do { \
  |  |  |  |  |  |  |  |  129|  1.22M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 153k, False: 1.07M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   153k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   153k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   153k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   153k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   153k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   153k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   153k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   153k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 149k, False: 3.75k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   149k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 147k, False: 2.07k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   147k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   147k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   147k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   147k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.07k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.07k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.07k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.07k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   149k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.75k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.75k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.75k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.75k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   153k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   153k|        } \
  |  |  |  |  |  |  |  |  132|  1.22M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.22M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.22M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.22M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 464k, False: 764k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   764k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  2.22M|    } else {  \
  |  |  |  |  |  |  149|  2.22M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  2.22M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 819k, False: 1.40M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   819k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   819k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   819k|{ \
  |  |  |  |  |  |  |  |   45|   819k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 133k, False: 685k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   133k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   133k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   685k|    } else { \
  |  |  |  |  |  |  |  |   49|   685k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   685k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   685k|    } \
  |  |  |  |  |  |  |  |   52|   819k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   819k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   819k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   819k|{ \
  |  |  |  |  |  |  |  |  128|   876k|    do { \
  |  |  |  |  |  |  |  |  129|   876k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 112k, False: 763k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 110k, False: 2.76k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   110k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 106k, False: 3.65k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   106k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   106k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   106k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   106k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.65k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.65k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.65k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.65k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   110k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.76k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.76k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.76k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.76k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   112k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   112k|        } \
  |  |  |  |  |  |  |  |  132|   876k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   876k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   876k|        ct--; \
  |  |  |  |  |  |  |  |  135|   876k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 57.7k, False: 819k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   819k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.40M|        } else { \
  |  |  |  |  |  |  154|  1.40M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.40M|        } \
  |  |  |  |  |  |  156|  2.22M|    } \
  |  |  |  |  |  |  157|  2.98M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  2.98M|            v = v ^ spb; \
  |  |  |  |  452|  2.98M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 1.49M, False: 1.49M]
  |  |  |  |  ------------------
  |  |  |  |  453|  2.98M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.98M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.98M|{ \
  |  |  |  |  |  |  323|  2.98M|    /* east */ \
  |  |  |  |  |  |  324|  2.98M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.98M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.98M| \
  |  |  |  |  |  |  326|  2.98M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.98M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.98M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.98M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.98M| \
  |  |  |  |  |  |  329|  2.98M|    /* west */ \
  |  |  |  |  |  |  330|  2.98M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.98M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.98M| \
  |  |  |  |  |  |  332|  2.98M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.98M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  2.98M| \
  |  |  |  |  |  |  340|  2.98M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.98M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  2.98M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  2.98M|        } \
  |  |  |  |  455|  7.08M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  7.08M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  7.08M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  7.08M|    } \
  |  |  |  |  457|  28.2M|}
  |  |  ------------------
  |  |  667|  28.2M|                                flags, flagsp, flags_stride, data, \
  |  |  668|  28.2M|                                l_w, 2, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  669|  28.2M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  28.2M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  28.2M|{ \
  |  |  |  |  437|  28.2M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  28.2M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  28.2M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  28.2M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  28.2M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 8.30M, False: 19.9M]
  |  |  |  |  ------------------
  |  |  |  |  438|  28.2M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  8.30M|#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|  8.30M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  8.30M|#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|  8.30M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  8.30M|#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|  8.30M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  8.30M|#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|  8.30M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  8.30M|#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|  8.30M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  8.30M|#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|  8.30M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  8.30M|#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|  8.30M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  8.30M|#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|  8.30M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  8.30M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 6.78M, False: 1.51M]
  |  |  |  |  ------------------
  |  |  |  |  439|  6.78M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  6.78M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  6.78M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  6.78M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  6.78M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  6.78M|{ \
  |  |  |  |  |  |  140|  6.78M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  6.78M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  6.78M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  6.78M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  6.78M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  6.78M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.49M, False: 5.28M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.49M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.49M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.49M|{ \
  |  |  |  |  |  |  |  |   57|  1.49M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 317k, False: 1.17M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   317k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   317k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   317k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.17M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.17M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.17M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.17M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.17M|    } \
  |  |  |  |  |  |  |  |   66|  1.49M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.49M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.49M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.49M|{ \
  |  |  |  |  |  |  |  |  128|  2.43M|    do { \
  |  |  |  |  |  |  |  |  129|  2.43M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 303k, False: 2.13M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   303k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   303k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   303k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   303k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   303k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   303k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   303k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   303k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 296k, False: 6.87k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   296k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 294k, False: 2.60k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   294k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   294k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   294k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   294k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.60k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.60k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.60k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.60k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   296k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.87k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.87k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.87k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.87k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   303k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   303k|        } \
  |  |  |  |  |  |  |  |  132|  2.43M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.43M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.43M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.43M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 940k, False: 1.49M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.49M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  5.28M|    } else {  \
  |  |  |  |  |  |  149|  5.28M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  5.28M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.57M, False: 3.70M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.57M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.57M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.57M|{ \
  |  |  |  |  |  |  |  |   45|  1.57M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 251k, False: 1.32M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   251k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   251k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.32M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.32M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.32M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.32M|    } \
  |  |  |  |  |  |  |  |   52|  1.57M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.57M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.57M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.57M|{ \
  |  |  |  |  |  |  |  |  128|  1.69M|    do { \
  |  |  |  |  |  |  |  |  129|  1.69M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 208k, False: 1.48M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   208k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   208k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   208k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   208k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   208k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   208k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   208k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   208k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 203k, False: 4.46k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   203k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 200k, False: 3.20k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   200k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   200k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   200k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   200k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.20k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.20k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.20k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.20k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   203k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.46k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.46k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.46k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.46k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   208k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   208k|        } \
  |  |  |  |  |  |  |  |  132|  1.69M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.69M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.69M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.69M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 114k, False: 1.57M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.57M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.70M|        } else { \
  |  |  |  |  |  |  154|  3.70M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  3.70M|        } \
  |  |  |  |  |  |  156|  5.28M|    } \
  |  |  |  |  |  |  157|  6.78M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  6.78M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 2.89M, False: 3.88M]
  |  |  |  |  ------------------
  |  |  |  |  443|  2.89M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  2.89M|                                flags, \
  |  |  |  |  445|  2.89M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  2.89M|                                ci); \
  |  |  |  |  447|  2.89M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  2.89M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  2.89M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.89M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  2.89M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.89M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.89M|{ \
  |  |  |  |  |  |  140|  2.89M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.89M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.89M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.89M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.89M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.89M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 747k, False: 2.14M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   747k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   747k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   747k|{ \
  |  |  |  |  |  |  |  |   57|   747k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 166k, False: 580k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   166k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   166k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   166k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   580k|    } else { \
  |  |  |  |  |  |  |  |   62|   580k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   580k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   580k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   580k|    } \
  |  |  |  |  |  |  |  |   66|   747k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   747k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   747k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   747k|{ \
  |  |  |  |  |  |  |  |  128|  1.19M|    do { \
  |  |  |  |  |  |  |  |  129|  1.19M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 152k, False: 1.04M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   152k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   152k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   152k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   152k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   152k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   152k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   152k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   152k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 149k, False: 3.56k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   149k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 145k, False: 3.14k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   145k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   145k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   145k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   145k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.14k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.14k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.14k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.14k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   149k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.56k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.56k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.56k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.56k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   152k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   152k|        } \
  |  |  |  |  |  |  |  |  132|  1.19M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.19M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.19M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.19M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 449k, False: 747k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   747k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  2.14M|    } else {  \
  |  |  |  |  |  |  149|  2.14M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  2.14M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 779k, False: 1.36M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   779k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   779k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   779k|{ \
  |  |  |  |  |  |  |  |   45|   779k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 126k, False: 652k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   126k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   126k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   652k|    } else { \
  |  |  |  |  |  |  |  |   49|   652k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   652k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   652k|    } \
  |  |  |  |  |  |  |  |   52|   779k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   779k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   779k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   779k|{ \
  |  |  |  |  |  |  |  |  128|   833k|    do { \
  |  |  |  |  |  |  |  |  129|   833k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 104k, False: 728k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   104k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   104k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   104k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   104k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   104k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   104k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   104k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   104k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 101k, False: 2.94k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   101k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 100k, False: 1.52k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   100k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   100k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   100k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   100k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.52k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.52k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.52k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.52k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   101k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.94k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.94k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.94k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.94k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   104k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   104k|        } \
  |  |  |  |  |  |  |  |  132|   833k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   833k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   833k|        ct--; \
  |  |  |  |  |  |  |  |  135|   833k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 54.4k, False: 779k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   779k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.36M|        } else { \
  |  |  |  |  |  |  154|  1.36M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.36M|        } \
  |  |  |  |  |  |  156|  2.14M|    } \
  |  |  |  |  |  |  157|  2.89M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  2.89M|            v = v ^ spb; \
  |  |  |  |  452|  2.89M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 1.44M, False: 1.45M]
  |  |  |  |  ------------------
  |  |  |  |  453|  2.89M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.89M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.89M|{ \
  |  |  |  |  |  |  323|  2.89M|    /* east */ \
  |  |  |  |  |  |  324|  2.89M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.89M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.89M| \
  |  |  |  |  |  |  326|  2.89M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.89M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.89M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.89M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.89M| \
  |  |  |  |  |  |  329|  2.89M|    /* west */ \
  |  |  |  |  |  |  330|  2.89M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.89M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.89M| \
  |  |  |  |  |  |  332|  2.89M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.89M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  2.89M| \
  |  |  |  |  |  |  340|  2.89M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.89M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|  2.89M|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|  2.89M|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  2.89M|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  2.89M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  2.89M|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  2.89M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  2.89M|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  2.89M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|  2.89M|    } \
  |  |  |  |  |  |  347|  2.89M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  2.89M|        } \
  |  |  |  |  455|  6.78M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  6.78M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  6.78M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  6.78M|    } \
  |  |  |  |  457|  28.2M|}
  |  |  ------------------
  |  |  670|  28.2M|                                flags, flagsp, flags_stride, data, \
  |  |  671|  28.2M|                                l_w, 3, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  672|  28.2M|                            *flagsp = flags; \
  |  |  673|  28.2M|                        } \
  |  |  674|  39.3M|                } \
  |  |  675|  5.42M|        } \
  |  |  676|   191k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|   191k|        mqc->curctx = curctx; \
  |  |  |  |  167|   191k|        mqc->c = c; \
  |  |  |  |  168|   191k|        mqc->a = a; \
  |  |  |  |  169|   191k|        mqc->ct = ct;
  |  |  ------------------
  |  |  677|   191k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (677:13): [True: 19.4k, False: 172k]
  |  |  ------------------
  |  |  678|  1.01M|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (678:25): [True: 995k, False: 19.4k]
  |  |  ------------------
  |  |  679|  2.66M|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (679:29): [True: 1.66M, False: 995k]
  |  |  ------------------
  |  |  680|  1.66M|                        opj_t1_dec_sigpass_step_mqc(t1, flagsp, \
  |  |  681|  1.66M|                            data + j * l_w, oneplushalf, j, flags_stride, vsc); \
  |  |  682|  1.66M|                } \
  |  |  683|   995k|            } \
  |  |  684|  19.4k|        } \
  |  |  685|   191k|}
  ------------------
  714|   191k|                                    t1->w + 2U);
  715|   191k|}
t1.c:opj_t1_dec_sigpass_mqc_generic_novsc:
  704|   180k|{
  705|   180k|    opj_t1_dec_sigpass_mqc_internal(t1, bpno, OPJ_FALSE, t1->w, t1->h,
  ------------------
  |  |  643|   180k|#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  |  644|   180k|{ \
  |  |  645|   180k|        OPJ_INT32 one, half, oneplushalf; \
  |  |  646|   180k|        OPJ_UINT32 i, j, k; \
  |  |  647|   180k|        register OPJ_INT32 *data = t1->data; \
  |  |  648|   180k|        register opj_flag_t *flagsp = &t1->flags[(flags_stride) + 1]; \
  |  |  649|   180k|        const OPJ_UINT32 l_w = w; \
  |  |  650|   180k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  651|   180k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|   180k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|   180k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|   180k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|   180k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  652|   180k|        register OPJ_UINT32 v; \
  |  |  653|   180k|        one = 1 << bpno; \
  |  |  654|   180k|        half = one >> 1; \
  |  |  655|   180k|        oneplushalf = one | half; \
  |  |  656|  3.19M|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (656:21): [True: 3.01M, False: 180k]
  |  |  ------------------
  |  |  657|  42.8M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (657:29): [True: 39.8M, False: 3.01M]
  |  |  ------------------
  |  |  658|  39.8M|                        opj_flag_t flags = *flagsp; \
  |  |  659|  39.8M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (659:29): [True: 31.6M, False: 8.18M]
  |  |  ------------------
  |  |  660|  31.6M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  31.6M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  31.6M|{ \
  |  |  |  |  437|  31.6M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  31.6M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  31.6M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  31.6M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  31.6M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 6.04M, False: 25.6M]
  |  |  |  |  ------------------
  |  |  |  |  438|  31.6M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  6.04M|#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|  6.04M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  6.04M|#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|  6.04M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  6.04M|#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|  6.04M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  6.04M|#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|  6.04M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  6.04M|#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|  6.04M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  6.04M|#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|  6.04M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  6.04M|#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|  6.04M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  6.04M|#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|  6.04M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  6.04M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 5.45M, False: 593k]
  |  |  |  |  ------------------
  |  |  |  |  439|  5.45M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  5.45M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  5.45M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  5.45M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  5.45M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  5.45M|{ \
  |  |  |  |  |  |  140|  5.45M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  5.45M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  5.45M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  5.45M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  5.45M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  5.45M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.30M, False: 4.14M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.30M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.30M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.30M|{ \
  |  |  |  |  |  |  |  |   57|  1.30M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 280k, False: 1.02M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   280k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   280k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   280k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.02M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.02M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.02M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.02M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.02M|    } \
  |  |  |  |  |  |  |  |   66|  1.30M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.30M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.30M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.30M|{ \
  |  |  |  |  |  |  |  |  128|  2.09M|    do { \
  |  |  |  |  |  |  |  |  129|  2.09M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 264k, False: 1.83M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   264k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   264k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   264k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   264k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   264k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   264k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   264k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   264k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 257k, False: 7.48k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   257k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 254k, False: 2.79k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   254k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   254k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   254k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   254k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.79k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.79k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.79k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.79k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   257k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.48k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.48k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.48k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.48k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   264k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   264k|        } \
  |  |  |  |  |  |  |  |  132|  2.09M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.09M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.09M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.09M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 788k, False: 1.30M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.30M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  4.14M|    } else {  \
  |  |  |  |  |  |  149|  4.14M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  4.14M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.37M, False: 2.76M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.37M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.37M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.37M|{ \
  |  |  |  |  |  |  |  |   45|  1.37M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 222k, False: 1.15M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   222k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   222k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.15M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.15M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.15M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.15M|    } \
  |  |  |  |  |  |  |  |   52|  1.37M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.37M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.37M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.37M|{ \
  |  |  |  |  |  |  |  |  128|  1.47M|    do { \
  |  |  |  |  |  |  |  |  129|  1.47M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 185k, False: 1.29M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   185k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   185k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   185k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   185k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   185k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   185k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   185k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   185k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 180k, False: 5.17k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   180k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 178k, False: 1.94k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   178k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   178k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   178k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   178k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.94k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.94k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.94k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.94k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   180k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.17k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.17k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.17k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.17k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   185k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   185k|        } \
  |  |  |  |  |  |  |  |  132|  1.47M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.47M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.47M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.47M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 96.7k, False: 1.37M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.37M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.76M|        } else { \
  |  |  |  |  |  |  154|  2.76M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.76M|        } \
  |  |  |  |  |  |  156|  4.14M|    } \
  |  |  |  |  |  |  157|  5.45M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  5.45M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 2.62M, False: 2.83M]
  |  |  |  |  ------------------
  |  |  |  |  443|  2.62M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  2.62M|                                flags, \
  |  |  |  |  445|  2.62M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  2.62M|                                ci); \
  |  |  |  |  447|  2.62M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  2.62M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  2.62M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.62M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  2.62M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.62M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.62M|{ \
  |  |  |  |  |  |  140|  2.62M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.62M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.62M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.62M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.62M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.62M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 693k, False: 1.92M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   693k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   693k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   693k|{ \
  |  |  |  |  |  |  |  |   57|   693k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 160k, False: 533k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   160k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   160k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   160k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   533k|    } else { \
  |  |  |  |  |  |  |  |   62|   533k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   533k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   533k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   533k|    } \
  |  |  |  |  |  |  |  |   66|   693k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   693k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   693k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   693k|{ \
  |  |  |  |  |  |  |  |  128|  1.08M|    do { \
  |  |  |  |  |  |  |  |  129|  1.08M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 137k, False: 945k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   137k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   137k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   137k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   137k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   137k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   137k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   137k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   137k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 133k, False: 3.05k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   133k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 132k, False: 1.38k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   132k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   132k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   132k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   132k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.38k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.38k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.38k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.38k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   133k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.05k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.05k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.05k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.05k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   137k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   137k|        } \
  |  |  |  |  |  |  |  |  132|  1.08M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.08M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.08M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.08M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 388k, False: 693k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   693k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.92M|    } else {  \
  |  |  |  |  |  |  149|  1.92M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.92M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 723k, False: 1.20M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   723k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   723k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   723k|{ \
  |  |  |  |  |  |  |  |   45|   723k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 125k, False: 597k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   125k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   125k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   597k|    } else { \
  |  |  |  |  |  |  |  |   49|   597k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   597k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   597k|    } \
  |  |  |  |  |  |  |  |   52|   723k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   723k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   723k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   723k|{ \
  |  |  |  |  |  |  |  |  128|   778k|    do { \
  |  |  |  |  |  |  |  |  129|   778k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 96.3k, False: 682k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  96.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  96.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  96.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  96.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  96.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  96.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  96.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  96.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 94.0k, False: 2.37k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  94.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 92.8k, False: 1.11k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  92.8k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  92.8k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  92.8k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  92.8k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.11k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.11k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.11k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.11k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  94.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.37k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.37k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.37k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.37k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  96.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  96.3k|        } \
  |  |  |  |  |  |  |  |  132|   778k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   778k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   778k|        ct--; \
  |  |  |  |  |  |  |  |  135|   778k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 55.0k, False: 723k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   723k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.20M|        } else { \
  |  |  |  |  |  |  154|  1.20M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.20M|        } \
  |  |  |  |  |  |  156|  1.92M|    } \
  |  |  |  |  |  |  157|  2.62M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  2.62M|            v = v ^ spb; \
  |  |  |  |  452|  2.62M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 1.29M, False: 1.32M]
  |  |  |  |  ------------------
  |  |  |  |  453|  2.62M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.62M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.62M|{ \
  |  |  |  |  |  |  323|  2.62M|    /* east */ \
  |  |  |  |  |  |  324|  2.62M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.62M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.62M| \
  |  |  |  |  |  |  326|  2.62M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.62M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.62M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.62M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.62M| \
  |  |  |  |  |  |  329|  2.62M|    /* west */ \
  |  |  |  |  |  |  330|  2.62M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.62M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.62M| \
  |  |  |  |  |  |  332|  2.62M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.62M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  2.62M|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|  2.62M|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|  2.62M|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|  2.62M|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|  2.62M|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|  2.62M|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|  2.62M|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|  2.62M|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|  2.62M|    } \
  |  |  |  |  |  |  339|  2.62M| \
  |  |  |  |  |  |  340|  2.62M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.62M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  2.62M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  2.62M|        } \
  |  |  |  |  455|  5.45M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  5.45M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  5.45M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  5.45M|    } \
  |  |  |  |  457|  31.6M|}
  |  |  ------------------
  |  |  661|  31.6M|                                flags, flagsp, flags_stride, data, \
  |  |  662|  31.6M|                                l_w, 0, mqc, curctx, v, a, c, ct, oneplushalf, vsc); \
  |  |  663|  31.6M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  31.6M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  31.6M|{ \
  |  |  |  |  437|  31.6M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  31.6M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  31.6M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  31.6M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  31.6M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 6.09M, False: 25.5M]
  |  |  |  |  ------------------
  |  |  |  |  438|  31.6M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  6.09M|#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|  6.09M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  6.09M|#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|  6.09M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  6.09M|#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|  6.09M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  6.09M|#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|  6.09M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  6.09M|#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|  6.09M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  6.09M|#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|  6.09M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  6.09M|#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|  6.09M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  6.09M|#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|  6.09M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  6.09M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 5.64M, False: 451k]
  |  |  |  |  ------------------
  |  |  |  |  439|  5.64M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  5.64M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  5.64M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  5.64M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  5.64M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  5.64M|{ \
  |  |  |  |  |  |  140|  5.64M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  5.64M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  5.64M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  5.64M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  5.64M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  5.64M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.35M, False: 4.28M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.35M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.35M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.35M|{ \
  |  |  |  |  |  |  |  |   57|  1.35M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 289k, False: 1.06M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   289k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   289k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   289k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.06M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.06M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.06M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.06M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.06M|    } \
  |  |  |  |  |  |  |  |   66|  1.35M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.35M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.35M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.35M|{ \
  |  |  |  |  |  |  |  |  128|  2.17M|    do { \
  |  |  |  |  |  |  |  |  129|  2.17M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 272k, False: 1.90M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   272k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   272k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   272k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   272k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   272k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   272k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   272k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   272k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 265k, False: 6.86k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   265k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 262k, False: 3.45k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   262k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   262k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   262k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   262k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.45k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.45k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.45k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.45k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   265k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.86k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.86k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.86k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.86k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   272k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   272k|        } \
  |  |  |  |  |  |  |  |  132|  2.17M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.17M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.17M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.17M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 821k, False: 1.35M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.35M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  4.28M|    } else {  \
  |  |  |  |  |  |  149|  4.28M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  4.28M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.42M, False: 2.86M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.42M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.42M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.42M|{ \
  |  |  |  |  |  |  |  |   45|  1.42M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 229k, False: 1.19M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   229k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   229k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.19M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.19M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.19M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.19M|    } \
  |  |  |  |  |  |  |  |   52|  1.42M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.42M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.42M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.42M|{ \
  |  |  |  |  |  |  |  |  128|  1.53M|    do { \
  |  |  |  |  |  |  |  |  129|  1.53M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 189k, False: 1.34M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   189k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   189k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   189k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   189k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   189k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   189k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   189k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   189k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 185k, False: 4.29k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   185k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 183k, False: 2.13k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   183k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   183k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   183k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   183k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.13k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.13k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.13k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.13k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   185k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.29k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.29k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.29k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.29k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   189k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   189k|        } \
  |  |  |  |  |  |  |  |  132|  1.53M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.53M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.53M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.53M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 103k, False: 1.42M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.42M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.86M|        } else { \
  |  |  |  |  |  |  154|  2.86M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.86M|        } \
  |  |  |  |  |  |  156|  4.28M|    } \
  |  |  |  |  |  |  157|  5.64M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  5.64M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 2.64M, False: 2.99M]
  |  |  |  |  ------------------
  |  |  |  |  443|  2.64M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  2.64M|                                flags, \
  |  |  |  |  445|  2.64M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  2.64M|                                ci); \
  |  |  |  |  447|  2.64M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  2.64M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  2.64M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.64M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  2.64M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.64M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.64M|{ \
  |  |  |  |  |  |  140|  2.64M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.64M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.64M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.64M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.64M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.64M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 708k, False: 1.93M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   708k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   708k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   708k|{ \
  |  |  |  |  |  |  |  |   57|   708k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 163k, False: 544k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   163k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   163k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   163k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   544k|    } else { \
  |  |  |  |  |  |  |  |   62|   544k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   544k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   544k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   544k|    } \
  |  |  |  |  |  |  |  |   66|   708k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   708k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   708k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   708k|{ \
  |  |  |  |  |  |  |  |  128|  1.10M|    do { \
  |  |  |  |  |  |  |  |  129|  1.10M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 135k, False: 970k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   135k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   135k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   135k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   135k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   135k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   135k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   135k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   135k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 132k, False: 2.91k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   132k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 131k, False: 1.41k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   131k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   131k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   131k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   131k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.41k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.41k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.41k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.41k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   132k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.91k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.91k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.91k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.91k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   135k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   135k|        } \
  |  |  |  |  |  |  |  |  132|  1.10M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.10M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.10M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.10M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 397k, False: 708k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   708k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.93M|    } else {  \
  |  |  |  |  |  |  149|  1.93M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.93M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 737k, False: 1.20M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   737k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   737k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   737k|{ \
  |  |  |  |  |  |  |  |   45|   737k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 130k, False: 607k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   130k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   130k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   607k|    } else { \
  |  |  |  |  |  |  |  |   49|   607k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   607k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   607k|    } \
  |  |  |  |  |  |  |  |   52|   737k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   737k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   737k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   737k|{ \
  |  |  |  |  |  |  |  |  128|   794k|    do { \
  |  |  |  |  |  |  |  |  129|   794k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 98.6k, False: 696k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  98.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  98.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  98.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  98.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  98.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  98.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  98.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  98.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 96.4k, False: 2.25k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  96.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 94.7k, False: 1.69k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  94.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  94.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  94.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  94.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.69k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.69k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.69k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.69k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  96.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.25k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.25k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.25k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.25k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  98.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  98.6k|        } \
  |  |  |  |  |  |  |  |  132|   794k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   794k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   794k|        ct--; \
  |  |  |  |  |  |  |  |  135|   794k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 56.9k, False: 737k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   737k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.20M|        } else { \
  |  |  |  |  |  |  154|  1.20M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.20M|        } \
  |  |  |  |  |  |  156|  1.93M|    } \
  |  |  |  |  |  |  157|  2.64M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  2.64M|            v = v ^ spb; \
  |  |  |  |  452|  2.64M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 1.32M, False: 1.32M]
  |  |  |  |  ------------------
  |  |  |  |  453|  2.64M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.64M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.64M|{ \
  |  |  |  |  |  |  323|  2.64M|    /* east */ \
  |  |  |  |  |  |  324|  2.64M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.64M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.64M| \
  |  |  |  |  |  |  326|  2.64M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.64M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.64M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.64M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.64M| \
  |  |  |  |  |  |  329|  2.64M|    /* west */ \
  |  |  |  |  |  |  330|  2.64M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.64M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.64M| \
  |  |  |  |  |  |  332|  2.64M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.64M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  2.64M| \
  |  |  |  |  |  |  340|  2.64M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.64M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  2.64M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  2.64M|        } \
  |  |  |  |  455|  5.64M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  5.64M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  5.64M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  5.64M|    } \
  |  |  |  |  457|  31.6M|}
  |  |  ------------------
  |  |  664|  31.6M|                                flags, flagsp, flags_stride, data, \
  |  |  665|  31.6M|                                l_w, 1, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  666|  31.6M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  31.6M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  31.6M|{ \
  |  |  |  |  437|  31.6M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  31.6M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  31.6M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  31.6M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  31.6M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 5.99M, False: 25.6M]
  |  |  |  |  ------------------
  |  |  |  |  438|  31.6M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  5.99M|#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|  5.99M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  5.99M|#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|  5.99M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  5.99M|#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|  5.99M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  5.99M|#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|  5.99M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  5.99M|#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|  5.99M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  5.99M|#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|  5.99M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  5.99M|#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|  5.99M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  5.99M|#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|  5.99M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  5.99M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 5.51M, False: 474k]
  |  |  |  |  ------------------
  |  |  |  |  439|  5.51M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  5.51M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  5.51M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  5.51M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  5.51M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  5.51M|{ \
  |  |  |  |  |  |  140|  5.51M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  5.51M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  5.51M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  5.51M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  5.51M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  5.51M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.32M, False: 4.19M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.32M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.32M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.32M|{ \
  |  |  |  |  |  |  |  |   57|  1.32M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 285k, False: 1.03M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   285k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   285k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   285k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.03M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.03M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.03M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.03M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.03M|    } \
  |  |  |  |  |  |  |  |   66|  1.32M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.32M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.32M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.32M|{ \
  |  |  |  |  |  |  |  |  128|  2.12M|    do { \
  |  |  |  |  |  |  |  |  129|  2.12M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 265k, False: 1.85M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   265k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   265k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   265k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   265k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   265k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   265k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   265k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   265k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 258k, False: 6.79k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   258k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 256k, False: 2.54k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   256k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   256k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   256k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   256k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.54k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.54k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.54k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.54k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   258k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.79k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.79k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.79k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.79k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   265k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   265k|        } \
  |  |  |  |  |  |  |  |  132|  2.12M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.12M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.12M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.12M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 799k, False: 1.32M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.32M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  4.19M|    } else {  \
  |  |  |  |  |  |  149|  4.19M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  4.19M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.39M, False: 2.80M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.39M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.39M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.39M|{ \
  |  |  |  |  |  |  |  |   45|  1.39M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 223k, False: 1.16M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   223k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   223k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.16M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.16M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.16M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.16M|    } \
  |  |  |  |  |  |  |  |   52|  1.39M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.39M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.39M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.39M|{ \
  |  |  |  |  |  |  |  |  128|  1.49M|    do { \
  |  |  |  |  |  |  |  |  129|  1.49M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 188k, False: 1.30M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   188k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   188k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   188k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   188k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   188k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   188k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   188k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   188k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 183k, False: 5.55k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   183k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 181k, False: 1.45k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   181k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   181k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   181k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   181k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.45k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.45k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.45k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.45k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   183k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.55k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.55k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.55k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.55k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   188k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   188k|        } \
  |  |  |  |  |  |  |  |  132|  1.49M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.49M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.49M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.49M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 99.8k, False: 1.39M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.39M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.80M|        } else { \
  |  |  |  |  |  |  154|  2.80M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.80M|        } \
  |  |  |  |  |  |  156|  4.19M|    } \
  |  |  |  |  |  |  157|  5.51M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  5.51M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 2.62M, False: 2.89M]
  |  |  |  |  ------------------
  |  |  |  |  443|  2.62M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  2.62M|                                flags, \
  |  |  |  |  445|  2.62M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  2.62M|                                ci); \
  |  |  |  |  447|  2.62M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  2.62M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  2.62M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.62M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  2.62M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.62M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.62M|{ \
  |  |  |  |  |  |  140|  2.62M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.62M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.62M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.62M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.62M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.62M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 699k, False: 1.92M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   699k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   699k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   699k|{ \
  |  |  |  |  |  |  |  |   57|   699k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 163k, False: 536k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   163k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   163k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   163k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   536k|    } else { \
  |  |  |  |  |  |  |  |   62|   536k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   536k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   536k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   536k|    } \
  |  |  |  |  |  |  |  |   66|   699k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   699k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   699k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   699k|{ \
  |  |  |  |  |  |  |  |  128|  1.09M|    do { \
  |  |  |  |  |  |  |  |  129|  1.09M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 135k, False: 959k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   135k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   135k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   135k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   135k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   135k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   135k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   135k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   135k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 131k, False: 3.60k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   131k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 130k, False: 1.75k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   130k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   130k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   130k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   130k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.75k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.75k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.75k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.75k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   131k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.60k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.60k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.60k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.60k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   135k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   135k|        } \
  |  |  |  |  |  |  |  |  132|  1.09M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.09M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.09M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.09M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 395k, False: 699k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   699k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.92M|    } else {  \
  |  |  |  |  |  |  149|  1.92M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.92M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 727k, False: 1.19M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   727k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   727k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   727k|{ \
  |  |  |  |  |  |  |  |   45|   727k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 130k, False: 597k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   130k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   130k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   597k|    } else { \
  |  |  |  |  |  |  |  |   49|   597k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   597k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   597k|    } \
  |  |  |  |  |  |  |  |   52|   727k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   727k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   727k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   727k|{ \
  |  |  |  |  |  |  |  |  128|   784k|    do { \
  |  |  |  |  |  |  |  |  129|   784k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 98.6k, False: 685k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  98.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  98.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  98.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  98.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  98.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  98.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  98.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  98.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 95.9k, False: 2.63k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  95.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 93.1k, False: 2.83k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  93.1k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  93.1k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  93.1k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  93.1k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.83k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.83k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.83k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.83k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  95.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.63k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.63k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.63k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.63k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  98.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  98.6k|        } \
  |  |  |  |  |  |  |  |  132|   784k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   784k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   784k|        ct--; \
  |  |  |  |  |  |  |  |  135|   784k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 56.8k, False: 727k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   727k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.19M|        } else { \
  |  |  |  |  |  |  154|  1.19M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.19M|        } \
  |  |  |  |  |  |  156|  1.92M|    } \
  |  |  |  |  |  |  157|  2.62M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  2.62M|            v = v ^ spb; \
  |  |  |  |  452|  2.62M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 1.31M, False: 1.31M]
  |  |  |  |  ------------------
  |  |  |  |  453|  2.62M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.62M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.62M|{ \
  |  |  |  |  |  |  323|  2.62M|    /* east */ \
  |  |  |  |  |  |  324|  2.62M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.62M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.62M| \
  |  |  |  |  |  |  326|  2.62M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.62M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.62M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.62M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.62M| \
  |  |  |  |  |  |  329|  2.62M|    /* west */ \
  |  |  |  |  |  |  330|  2.62M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.62M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.62M| \
  |  |  |  |  |  |  332|  2.62M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.62M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  2.62M| \
  |  |  |  |  |  |  340|  2.62M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.62M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  2.62M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  2.62M|        } \
  |  |  |  |  455|  5.51M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  5.51M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  5.51M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  5.51M|    } \
  |  |  |  |  457|  31.6M|}
  |  |  ------------------
  |  |  667|  31.6M|                                flags, flagsp, flags_stride, data, \
  |  |  668|  31.6M|                                l_w, 2, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  669|  31.6M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  435|  31.6M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  436|  31.6M|{ \
  |  |  |  |  437|  31.6M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  31.6M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  31.6M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  31.6M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  31.6M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (437:9): [True: 6.08M, False: 25.6M]
  |  |  |  |  ------------------
  |  |  |  |  438|  31.6M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  6.08M|#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|  6.08M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  6.08M|#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|  6.08M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  6.08M|#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|  6.08M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  6.08M|#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|  6.08M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  6.08M|#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|  6.08M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  6.08M|#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|  6.08M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  6.08M|#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|  6.08M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  6.08M|#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|  6.08M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  6.08M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (438:9): [True: 5.51M, False: 578k]
  |  |  |  |  ------------------
  |  |  |  |  439|  5.51M|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  440|  5.51M|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  5.51M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  441|  5.51M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  5.51M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  5.51M|{ \
  |  |  |  |  |  |  140|  5.51M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  5.51M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  5.51M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  5.51M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  5.51M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  5.51M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.31M, False: 4.19M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.31M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.31M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.31M|{ \
  |  |  |  |  |  |  |  |   57|  1.31M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 283k, False: 1.03M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   283k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   283k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   283k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.03M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.03M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.03M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.03M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.03M|    } \
  |  |  |  |  |  |  |  |   66|  1.31M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.31M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.31M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.31M|{ \
  |  |  |  |  |  |  |  |  128|  2.12M|    do { \
  |  |  |  |  |  |  |  |  129|  2.12M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 267k, False: 1.85M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   267k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   267k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   267k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   267k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   267k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   267k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   267k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   267k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 261k, False: 6.42k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   261k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 258k, False: 2.49k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   258k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   258k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   258k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   258k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.49k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.49k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.49k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.49k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   261k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.42k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.42k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.42k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.42k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   267k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   267k|        } \
  |  |  |  |  |  |  |  |  132|  2.12M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.12M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.12M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.12M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 804k, False: 1.31M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.31M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  4.19M|    } else {  \
  |  |  |  |  |  |  149|  4.19M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  4.19M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.39M, False: 2.80M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.39M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.39M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.39M|{ \
  |  |  |  |  |  |  |  |   45|  1.39M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 221k, False: 1.16M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   221k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   221k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.16M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.16M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.16M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.16M|    } \
  |  |  |  |  |  |  |  |   52|  1.39M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.39M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.39M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.39M|{ \
  |  |  |  |  |  |  |  |  128|  1.49M|    do { \
  |  |  |  |  |  |  |  |  129|  1.49M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 185k, False: 1.30M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   185k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   185k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   185k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   185k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   185k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   185k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   185k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   185k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 179k, False: 5.29k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   179k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 177k, False: 2.17k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   177k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   177k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   177k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   177k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.17k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.17k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.17k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.17k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   179k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.29k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.29k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.29k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.29k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   185k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   185k|        } \
  |  |  |  |  |  |  |  |  132|  1.49M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.49M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.49M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.49M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 101k, False: 1.39M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.39M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.80M|        } else { \
  |  |  |  |  |  |  154|  2.80M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.80M|        } \
  |  |  |  |  |  |  156|  4.19M|    } \
  |  |  |  |  |  |  157|  5.51M|}
  |  |  |  |  ------------------
  |  |  |  |  442|  5.51M|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 2.64M, False: 2.86M]
  |  |  |  |  ------------------
  |  |  |  |  443|  2.64M|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  444|  2.64M|                                flags, \
  |  |  |  |  445|  2.64M|                                flagsp[-1], flagsp[1], \
  |  |  |  |  446|  2.64M|                                ci); \
  |  |  |  |  447|  2.64M|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  448|  2.64M|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  449|  2.64M|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.64M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  450|  2.64M|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.64M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.64M|{ \
  |  |  |  |  |  |  140|  2.64M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.64M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.64M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.64M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.64M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.64M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 698k, False: 1.94M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   698k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   698k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   698k|{ \
  |  |  |  |  |  |  |  |   57|   698k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 166k, False: 532k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   166k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   166k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   166k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   532k|    } else { \
  |  |  |  |  |  |  |  |   62|   532k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   532k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   532k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   532k|    } \
  |  |  |  |  |  |  |  |   66|   698k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   698k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   698k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   698k|{ \
  |  |  |  |  |  |  |  |  128|  1.08M|    do { \
  |  |  |  |  |  |  |  |  129|  1.08M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 138k, False: 949k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   138k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   138k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   138k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   138k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   138k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   138k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   138k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   138k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 134k, False: 3.92k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   134k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 132k, False: 2.34k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   132k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   132k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   132k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   132k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.34k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.34k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.34k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.34k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   134k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.92k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.92k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.92k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.92k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   138k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   138k|        } \
  |  |  |  |  |  |  |  |  132|  1.08M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.08M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.08M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.08M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 389k, False: 698k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   698k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.94M|    } else {  \
  |  |  |  |  |  |  149|  1.94M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.94M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 728k, False: 1.21M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   728k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   728k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   728k|{ \
  |  |  |  |  |  |  |  |   45|   728k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 127k, False: 600k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   127k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   127k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   600k|    } else { \
  |  |  |  |  |  |  |  |   49|   600k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   600k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   600k|    } \
  |  |  |  |  |  |  |  |   52|   728k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   728k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   728k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   728k|{ \
  |  |  |  |  |  |  |  |  128|   783k|    do { \
  |  |  |  |  |  |  |  |  129|   783k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 96.2k, False: 687k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  96.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  96.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  96.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  96.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  96.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  96.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  96.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  96.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 93.7k, False: 2.53k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  93.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 92.4k, False: 1.25k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  92.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  92.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  92.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  92.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.25k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.25k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.25k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.25k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  93.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.53k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.53k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.53k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.53k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  96.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  96.2k|        } \
  |  |  |  |  |  |  |  |  132|   783k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   783k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   783k|        ct--; \
  |  |  |  |  |  |  |  |  135|   783k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 55.6k, False: 728k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   728k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.21M|        } else { \
  |  |  |  |  |  |  154|  1.21M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.21M|        } \
  |  |  |  |  |  |  156|  1.94M|    } \
  |  |  |  |  |  |  157|  2.64M|}
  |  |  |  |  ------------------
  |  |  |  |  451|  2.64M|            v = v ^ spb; \
  |  |  |  |  452|  2.64M|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (452:36): [True: 1.32M, False: 1.32M]
  |  |  |  |  ------------------
  |  |  |  |  453|  2.64M|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.64M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.64M|{ \
  |  |  |  |  |  |  323|  2.64M|    /* east */ \
  |  |  |  |  |  |  324|  2.64M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.64M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.64M| \
  |  |  |  |  |  |  326|  2.64M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.64M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.64M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.64M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.64M| \
  |  |  |  |  |  |  329|  2.64M|    /* west */ \
  |  |  |  |  |  |  330|  2.64M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.64M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.64M| \
  |  |  |  |  |  |  332|  2.64M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.64M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  2.64M| \
  |  |  |  |  |  |  340|  2.64M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.64M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|  2.64M|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|  2.64M|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  2.64M|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  2.64M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  2.64M|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  2.64M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  2.64M|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  2.64M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|  2.64M|    } \
  |  |  |  |  |  |  347|  2.64M|}
  |  |  |  |  ------------------
  |  |  |  |  454|  2.64M|        } \
  |  |  |  |  455|  5.51M|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  5.51M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  5.51M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  456|  5.51M|    } \
  |  |  |  |  457|  31.6M|}
  |  |  ------------------
  |  |  670|  31.6M|                                flags, flagsp, flags_stride, data, \
  |  |  671|  31.6M|                                l_w, 3, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  672|  31.6M|                            *flagsp = flags; \
  |  |  673|  31.6M|                        } \
  |  |  674|  39.8M|                } \
  |  |  675|  3.01M|        } \
  |  |  676|   180k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|   180k|        mqc->curctx = curctx; \
  |  |  |  |  167|   180k|        mqc->c = c; \
  |  |  |  |  168|   180k|        mqc->a = a; \
  |  |  |  |  169|   180k|        mqc->ct = ct;
  |  |  ------------------
  |  |  677|   180k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (677:13): [True: 31.3k, False: 149k]
  |  |  ------------------
  |  |  678|  2.60M|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (678:25): [True: 2.57M, False: 31.3k]
  |  |  ------------------
  |  |  679|  7.14M|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (679:29): [True: 4.57M, False: 2.57M]
  |  |  ------------------
  |  |  680|  4.57M|                        opj_t1_dec_sigpass_step_mqc(t1, flagsp, \
  |  |  681|  4.57M|                            data + j * l_w, oneplushalf, j, flags_stride, vsc); \
  |  |  682|  4.57M|                } \
  |  |  683|  2.57M|            } \
  |  |  684|  31.3k|        } \
  |  |  685|   180k|}
  ------------------
  706|   180k|                                    t1->w + 2U);
  707|   180k|}
t1.c:opj_t1_dec_refpass_raw:
  925|  10.8k|{
  926|  10.8k|    OPJ_INT32 one, poshalf;
  927|  10.8k|    OPJ_UINT32 i, j, k;
  928|  10.8k|    OPJ_INT32 *data = t1->data;
  929|  10.8k|    opj_flag_t *flagsp = &T1_FLAGS(0, 0);
  ------------------
  |  |   60|  10.8k|#define T1_FLAGS(x, y) (t1->flags[x + 1 + ((y / 4) + 1) * (t1->w+2)])
  ------------------
  930|  10.8k|    const OPJ_UINT32 l_w = t1->w;
  931|  10.8k|    one = 1 << bpno;
  932|  10.8k|    poshalf = one >> 1;
  933|   118k|    for (k = 0; k < (t1->h & ~3U); k += 4, flagsp += 2, data += 3 * l_w) {
  ------------------
  |  Branch (933:17): [True: 107k, False: 10.8k]
  ------------------
  934|  7.42M|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) {
  ------------------
  |  Branch (934:21): [True: 7.31M, False: 107k]
  ------------------
  935|  7.31M|            opj_flag_t flags = *flagsp;
  936|  7.31M|            if (flags != 0) {
  ------------------
  |  Branch (936:17): [True: 6.83M, False: 479k]
  ------------------
  937|  6.83M|                opj_t1_dec_refpass_step_raw(
  938|  6.83M|                    t1,
  939|  6.83M|                    flagsp,
  940|  6.83M|                    data,
  941|  6.83M|                    poshalf,
  942|  6.83M|                    0U);
  943|  6.83M|                opj_t1_dec_refpass_step_raw(
  944|  6.83M|                    t1,
  945|  6.83M|                    flagsp,
  946|  6.83M|                    data + l_w,
  947|  6.83M|                    poshalf,
  948|  6.83M|                    1U);
  949|  6.83M|                opj_t1_dec_refpass_step_raw(
  950|  6.83M|                    t1,
  951|  6.83M|                    flagsp,
  952|  6.83M|                    data + 2 * l_w,
  953|  6.83M|                    poshalf,
  954|  6.83M|                    2U);
  955|  6.83M|                opj_t1_dec_refpass_step_raw(
  956|  6.83M|                    t1,
  957|  6.83M|                    flagsp,
  958|  6.83M|                    data + 3 * l_w,
  959|  6.83M|                    poshalf,
  960|  6.83M|                    3U);
  961|  6.83M|            }
  962|  7.31M|        }
  963|   107k|    }
  964|  10.8k|    if (k < t1->h) {
  ------------------
  |  Branch (964:9): [True: 3.24k, False: 7.64k]
  ------------------
  965|   838k|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) {
  ------------------
  |  Branch (965:21): [True: 835k, False: 3.24k]
  ------------------
  966|  2.07M|            for (j = 0; j < t1->h - k; ++j) {
  ------------------
  |  Branch (966:25): [True: 1.23M, False: 835k]
  ------------------
  967|  1.23M|                opj_t1_dec_refpass_step_raw(
  968|  1.23M|                    t1,
  969|  1.23M|                    flagsp,
  970|  1.23M|                    data + j * l_w,
  971|  1.23M|                    poshalf,
  972|  1.23M|                    j);
  973|  1.23M|            }
  974|   835k|        }
  975|  3.24k|    }
  976|  10.8k|}
t1.c:opj_t1_dec_refpass_step_raw:
  770|  28.5M|{
  771|  28.5M|    OPJ_UINT32 v;
  772|       |
  773|  28.5M|    opj_mqc_t *mqc = &(t1->mqc);       /* RAW component */
  774|       |
  775|  28.5M|    if ((*flagsp & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) ==
  ------------------
  |  |  153|  28.5M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  ------------------
  |  |  |  |   95|  28.5M|#define T1_SIGMA_4  (1U << 4)
  |  |  ------------------
  ------------------
                  if ((*flagsp & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) ==
  ------------------
  |  |  163|  28.5M|#define T1_PI_THIS    T1_PI_0
  |  |  ------------------
  |  |  |  |  115|  28.5M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  ------------------
  |  Branch (775:9): [True: 27.0M, False: 1.55M]
  ------------------
  776|  28.5M|            (T1_SIGMA_THIS << (ci * 3U))) {
  ------------------
  |  |  153|  28.5M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  ------------------
  |  |  |  |   95|  28.5M|#define T1_SIGMA_4  (1U << 4)
  |  |  ------------------
  ------------------
  777|  27.0M|        v = opj_mqc_raw_decode(mqc);
  778|  27.0M|        *datap += (v ^ (*datap < 0)) ? poshalf : -poshalf;
  ------------------
  |  Branch (778:19): [True: 11.0M, False: 15.9M]
  ------------------
  779|  27.0M|        *flagsp |= T1_MU_THIS << (ci * 3U);
  ------------------
  |  |  162|  27.0M|#define T1_MU_THIS    T1_MU_0
  |  |  ------------------
  |  |  |  |  114|  27.0M|#define T1_MU_0     (1U << 20)
  |  |  ------------------
  ------------------
  780|  27.0M|    }
  781|  28.5M|}
t1.c:opj_t1_dec_refpass_mqc:
 1037|   431k|{
 1038|   431k|    if (t1->w == 64 && t1->h == 64) {
  ------------------
  |  Branch (1038:9): [True: 96.7k, False: 335k]
  |  Branch (1038:24): [True: 72.0k, False: 24.7k]
  ------------------
 1039|  72.0k|        opj_t1_dec_refpass_mqc_64x64(t1, bpno);
 1040|   359k|    } else {
 1041|   359k|        opj_t1_dec_refpass_mqc_generic(t1, bpno);
 1042|   359k|    }
 1043|   431k|}
t1.c:opj_t1_dec_refpass_mqc_64x64:
 1023|  72.0k|{
 1024|  72.0k|    opj_t1_dec_refpass_mqc_internal(t1, bpno, 64, 64, 66);
  ------------------
  |  |  978|  72.0k|#define opj_t1_dec_refpass_mqc_internal(t1, bpno, w, h, flags_stride) \
  |  |  979|  72.0k|{ \
  |  |  980|  72.0k|        OPJ_INT32 one, poshalf; \
  |  |  981|  72.0k|        OPJ_UINT32 i, j, k; \
  |  |  982|  72.0k|        register OPJ_INT32 *data = t1->data; \
  |  |  983|  72.0k|        register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  |  984|  72.0k|        const OPJ_UINT32 l_w = w; \
  |  |  985|  72.0k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  986|  72.0k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  72.0k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  72.0k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  72.0k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  72.0k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  987|  72.0k|        register OPJ_UINT32 v; \
  |  |  988|  72.0k|        one = 1 << bpno; \
  |  |  989|  72.0k|        poshalf = one >> 1; \
  |  |  990|  1.22M|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (990:21): [True: 1.15M, False: 72.0k]
  |  |  ------------------
  |  |  991|  74.9M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (991:29): [True: 73.8M, False: 1.15M]
  |  |  ------------------
  |  |  992|  73.8M|                        opj_flag_t flags = *flagsp; \
  |  |  993|  73.8M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (993:29): [True: 59.2M, False: 14.5M]
  |  |  ------------------
  |  |  994|  59.2M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  784|  59.2M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  785|  59.2M|{ \
  |  |  |  |  786|  59.2M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  59.2M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  59.2M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  59.2M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  59.2M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (786:9): [True: 44.7M, False: 14.5M]
  |  |  |  |  ------------------
  |  |  |  |  787|  59.2M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  59.2M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  59.2M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  788|  44.7M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  789|  44.7M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  44.7M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  790|  44.7M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  44.7M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  44.7M|{ \
  |  |  |  |  |  |  140|  44.7M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  44.7M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  44.7M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  44.7M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  44.7M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  44.7M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.45M, False: 36.3M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.45M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.45M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.45M|{ \
  |  |  |  |  |  |  |  |   57|  8.45M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.62M, False: 6.82M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.62M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.62M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.62M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  6.82M|    } else { \
  |  |  |  |  |  |  |  |   62|  6.82M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  6.82M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  6.82M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  6.82M|    } \
  |  |  |  |  |  |  |  |   66|  8.45M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.45M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.45M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.45M|{ \
  |  |  |  |  |  |  |  |  128|  14.1M|    do { \
  |  |  |  |  |  |  |  |  129|  14.1M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.76M, False: 12.3M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.76M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.76M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.76M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.76M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.76M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.76M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.76M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.76M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.75M, False: 6.00k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.75M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.75M, False: 1.71k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.75M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.75M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.75M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.75M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.71k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.71k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.71k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.71k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.75M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.00k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.00k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.00k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.00k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.76M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.76M|        } \
  |  |  |  |  |  |  |  |  132|  14.1M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  14.1M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  14.1M|        ct--; \
  |  |  |  |  |  |  |  |  135|  14.1M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.67M, False: 8.45M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.45M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  36.3M|    } else {  \
  |  |  |  |  |  |  149|  36.3M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  36.3M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 9.17M, False: 27.1M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  9.17M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  9.17M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  9.17M|{ \
  |  |  |  |  |  |  |  |   45|  9.17M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.37M, False: 7.80M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.37M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.37M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  7.80M|    } else { \
  |  |  |  |  |  |  |  |   49|  7.80M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  7.80M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  7.80M|    } \
  |  |  |  |  |  |  |  |   52|  9.17M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  9.17M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  9.17M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  9.17M|{ \
  |  |  |  |  |  |  |  |  128|  9.70M|    do { \
  |  |  |  |  |  |  |  |  129|  9.70M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.21M, False: 8.48M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.21M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.21M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.21M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.21M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.21M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.21M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.21M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.21M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.21M, False: 3.80k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.21M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.21M, False: 1.17k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.21M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.21M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.21M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.21M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.17k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.17k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.17k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.17k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.21M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.80k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.80k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.80k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.80k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.21M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.21M|        } \
  |  |  |  |  |  |  |  |  132|  9.70M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  9.70M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  9.70M|        ct--; \
  |  |  |  |  |  |  |  |  135|  9.70M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 531k, False: 9.17M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  9.17M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  27.1M|        } else { \
  |  |  |  |  |  |  154|  27.1M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  27.1M|        } \
  |  |  |  |  |  |  156|  36.3M|    } \
  |  |  |  |  |  |  157|  44.7M|}
  |  |  |  |  ------------------
  |  |  |  |  791|  44.7M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (791:33): [True: 22.3M, False: 22.4M]
  |  |  |  |  ------------------
  |  |  |  |  792|  44.7M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  44.7M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  44.7M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  793|  44.7M|    } \
  |  |  |  |  794|  59.2M|}
  |  |  ------------------
  |  |  995|  59.2M|                                flags, data, l_w, 0, \
  |  |  996|  59.2M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  |  997|  59.2M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  784|  59.2M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  785|  59.2M|{ \
  |  |  |  |  786|  59.2M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  59.2M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  59.2M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  59.2M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  59.2M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (786:9): [True: 44.7M, False: 14.5M]
  |  |  |  |  ------------------
  |  |  |  |  787|  59.2M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  59.2M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  59.2M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  788|  44.7M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  789|  44.7M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  44.7M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  790|  44.7M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  44.7M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  44.7M|{ \
  |  |  |  |  |  |  140|  44.7M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  44.7M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  44.7M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  44.7M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  44.7M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  44.7M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.42M, False: 36.3M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.42M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.42M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.42M|{ \
  |  |  |  |  |  |  |  |   57|  8.42M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.62M, False: 6.79M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.62M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.62M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.62M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  6.79M|    } else { \
  |  |  |  |  |  |  |  |   62|  6.79M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  6.79M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  6.79M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  6.79M|    } \
  |  |  |  |  |  |  |  |   66|  8.42M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.42M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.42M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.42M|{ \
  |  |  |  |  |  |  |  |  128|  14.0M|    do { \
  |  |  |  |  |  |  |  |  129|  14.0M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.76M, False: 12.3M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.76M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.76M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.76M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.76M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.76M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.76M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.76M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.76M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.75M, False: 5.70k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.75M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.75M, False: 1.68k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.75M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.75M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.75M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.75M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.68k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.68k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.68k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.68k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.75M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.70k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.70k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.70k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.70k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.76M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.76M|        } \
  |  |  |  |  |  |  |  |  132|  14.0M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  14.0M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  14.0M|        ct--; \
  |  |  |  |  |  |  |  |  135|  14.0M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.64M, False: 8.42M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.42M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  36.3M|    } else {  \
  |  |  |  |  |  |  149|  36.3M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  36.3M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 9.17M, False: 27.1M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  9.17M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  9.17M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  9.17M|{ \
  |  |  |  |  |  |  |  |   45|  9.17M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.38M, False: 7.78M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.38M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.38M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  7.78M|    } else { \
  |  |  |  |  |  |  |  |   49|  7.78M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  7.78M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  7.78M|    } \
  |  |  |  |  |  |  |  |   52|  9.17M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  9.17M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  9.17M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  9.17M|{ \
  |  |  |  |  |  |  |  |  128|  9.71M|    do { \
  |  |  |  |  |  |  |  |  129|  9.71M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.21M, False: 8.50M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.21M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.21M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.21M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.21M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.21M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.21M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.21M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.21M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.20M, False: 3.87k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.20M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.20M, False: 1.19k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.20M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.20M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.20M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.20M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.19k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.19k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.19k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.19k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.20M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.87k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.87k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.87k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.87k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.21M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.21M|        } \
  |  |  |  |  |  |  |  |  132|  9.71M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  9.71M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  9.71M|        ct--; \
  |  |  |  |  |  |  |  |  135|  9.71M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 541k, False: 9.17M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  9.17M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  27.1M|        } else { \
  |  |  |  |  |  |  154|  27.1M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  27.1M|        } \
  |  |  |  |  |  |  156|  36.3M|    } \
  |  |  |  |  |  |  157|  44.7M|}
  |  |  |  |  ------------------
  |  |  |  |  791|  44.7M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (791:33): [True: 22.3M, False: 22.3M]
  |  |  |  |  ------------------
  |  |  |  |  792|  44.7M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  44.7M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  44.7M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  793|  44.7M|    } \
  |  |  |  |  794|  59.2M|}
  |  |  ------------------
  |  |  998|  59.2M|                                flags, data, l_w, 1, \
  |  |  999|  59.2M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1000|  59.2M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  784|  59.2M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  785|  59.2M|{ \
  |  |  |  |  786|  59.2M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  59.2M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  59.2M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  59.2M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  59.2M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (786:9): [True: 44.5M, False: 14.7M]
  |  |  |  |  ------------------
  |  |  |  |  787|  59.2M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  59.2M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  59.2M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  788|  44.5M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  789|  44.5M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  44.5M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  790|  44.5M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  44.5M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  44.5M|{ \
  |  |  |  |  |  |  140|  44.5M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  44.5M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  44.5M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  44.5M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  44.5M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  44.5M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.37M, False: 36.1M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.37M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.37M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.37M|{ \
  |  |  |  |  |  |  |  |   57|  8.37M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.61M, False: 6.76M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.61M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.61M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.61M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  6.76M|    } else { \
  |  |  |  |  |  |  |  |   62|  6.76M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  6.76M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  6.76M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  6.76M|    } \
  |  |  |  |  |  |  |  |   66|  8.37M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.37M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.37M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.37M|{ \
  |  |  |  |  |  |  |  |  128|  14.0M|    do { \
  |  |  |  |  |  |  |  |  129|  14.0M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.75M, False: 12.2M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.75M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.75M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.75M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.75M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.75M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.75M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.75M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.75M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.75M, False: 5.67k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.75M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.75M, False: 1.69k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.75M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.75M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.75M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.75M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.69k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.69k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.69k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.69k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.75M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.67k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.67k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.67k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.67k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.75M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.75M|        } \
  |  |  |  |  |  |  |  |  132|  14.0M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  14.0M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  14.0M|        ct--; \
  |  |  |  |  |  |  |  |  135|  14.0M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.63M, False: 8.37M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.37M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  36.1M|    } else {  \
  |  |  |  |  |  |  149|  36.1M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  36.1M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 9.13M, False: 27.0M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  9.13M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  9.13M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  9.13M|{ \
  |  |  |  |  |  |  |  |   45|  9.13M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.36M, False: 7.76M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.36M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.36M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  7.76M|    } else { \
  |  |  |  |  |  |  |  |   49|  7.76M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  7.76M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  7.76M|    } \
  |  |  |  |  |  |  |  |   52|  9.13M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  9.13M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  9.13M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  9.13M|{ \
  |  |  |  |  |  |  |  |  128|  9.67M|    do { \
  |  |  |  |  |  |  |  |  129|  9.67M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.21M, False: 8.46M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.21M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.21M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.21M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.21M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.21M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.21M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.21M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.21M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.20M, False: 3.88k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.20M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.20M, False: 1.12k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.20M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.20M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.20M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.20M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.12k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.12k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.12k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.12k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.20M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.88k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.88k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.88k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.88k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.21M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.21M|        } \
  |  |  |  |  |  |  |  |  132|  9.67M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  9.67M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  9.67M|        ct--; \
  |  |  |  |  |  |  |  |  135|  9.67M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 542k, False: 9.13M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  9.13M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  27.0M|        } else { \
  |  |  |  |  |  |  154|  27.0M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  27.0M|        } \
  |  |  |  |  |  |  156|  36.1M|    } \
  |  |  |  |  |  |  157|  44.5M|}
  |  |  |  |  ------------------
  |  |  |  |  791|  44.5M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (791:33): [True: 22.2M, False: 22.3M]
  |  |  |  |  ------------------
  |  |  |  |  792|  44.5M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  44.5M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  44.5M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  793|  44.5M|    } \
  |  |  |  |  794|  59.2M|}
  |  |  ------------------
  |  | 1001|  59.2M|                                flags, data, l_w, 2, \
  |  | 1002|  59.2M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1003|  59.2M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  784|  59.2M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  785|  59.2M|{ \
  |  |  |  |  786|  59.2M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  59.2M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  59.2M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  59.2M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  59.2M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (786:9): [True: 44.1M, False: 15.1M]
  |  |  |  |  ------------------
  |  |  |  |  787|  59.2M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  59.2M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  59.2M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  788|  44.1M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  789|  44.1M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  44.1M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  790|  44.1M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  44.1M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  44.1M|{ \
  |  |  |  |  |  |  140|  44.1M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  44.1M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  44.1M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  44.1M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  44.1M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  44.1M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.30M, False: 35.8M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.30M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.30M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.30M|{ \
  |  |  |  |  |  |  |  |   57|  8.30M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.59M, False: 6.70M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.59M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.59M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.59M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  6.70M|    } else { \
  |  |  |  |  |  |  |  |   62|  6.70M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  6.70M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  6.70M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  6.70M|    } \
  |  |  |  |  |  |  |  |   66|  8.30M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.30M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.30M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.30M|{ \
  |  |  |  |  |  |  |  |  128|  13.8M|    do { \
  |  |  |  |  |  |  |  |  129|  13.8M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.72M, False: 12.1M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.72M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.72M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.72M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.72M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.72M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.72M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.72M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.72M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.71M, False: 5.19k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.71M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.71M, False: 1.51k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.71M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.71M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.71M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.71M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.51k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.51k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.51k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.51k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.71M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.19k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.19k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.19k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.19k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.72M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.72M|        } \
  |  |  |  |  |  |  |  |  132|  13.8M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  13.8M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  13.8M|        ct--; \
  |  |  |  |  |  |  |  |  135|  13.8M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.56M, False: 8.30M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.30M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  35.8M|    } else {  \
  |  |  |  |  |  |  149|  35.8M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  35.8M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 9.00M, False: 26.8M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  9.00M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  9.00M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  9.00M|{ \
  |  |  |  |  |  |  |  |   45|  9.00M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.33M, False: 7.67M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.33M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.33M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  7.67M|    } else { \
  |  |  |  |  |  |  |  |   49|  7.67M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  7.67M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  7.67M|    } \
  |  |  |  |  |  |  |  |   52|  9.00M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  9.00M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  9.00M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  9.00M|{ \
  |  |  |  |  |  |  |  |  128|  9.52M|    do { \
  |  |  |  |  |  |  |  |  129|  9.52M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.18M, False: 8.33M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.18M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.18M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.18M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.18M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.18M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.18M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.18M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.18M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.18M, False: 3.62k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.18M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.18M, False: 1.05k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.18M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.18M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.18M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.18M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.05k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.05k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.05k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.05k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.18M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.62k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.62k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.62k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.62k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.18M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.18M|        } \
  |  |  |  |  |  |  |  |  132|  9.52M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  9.52M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  9.52M|        ct--; \
  |  |  |  |  |  |  |  |  135|  9.52M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 518k, False: 9.00M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  9.00M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  26.8M|        } else { \
  |  |  |  |  |  |  154|  26.8M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  26.8M|        } \
  |  |  |  |  |  |  156|  35.8M|    } \
  |  |  |  |  |  |  157|  44.1M|}
  |  |  |  |  ------------------
  |  |  |  |  791|  44.1M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (791:33): [True: 22.0M, False: 22.1M]
  |  |  |  |  ------------------
  |  |  |  |  792|  44.1M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  44.1M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  44.1M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  793|  44.1M|    } \
  |  |  |  |  794|  59.2M|}
  |  |  ------------------
  |  | 1004|  59.2M|                                flags, data, l_w, 3, \
  |  | 1005|  59.2M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1006|  59.2M|                            *flagsp = flags; \
  |  | 1007|  59.2M|                        } \
  |  | 1008|  73.8M|                } \
  |  | 1009|  1.15M|        } \
  |  | 1010|  72.0k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  72.0k|        mqc->curctx = curctx; \
  |  |  |  |  167|  72.0k|        mqc->c = c; \
  |  |  |  |  168|  72.0k|        mqc->a = a; \
  |  |  |  |  169|  72.0k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1011|  72.0k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1011:13): [True: 0, False: 72.0k]
  |  |  ------------------
  |  | 1012|      0|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1012:25): [True: 0, False: 0]
  |  |  ------------------
  |  | 1013|      0|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1013:29): [True: 0, False: 0]
  |  |  ------------------
  |  | 1014|      0|                        opj_t1_dec_refpass_step_mqc(t1, flagsp, data + j * l_w, poshalf, j); \
  |  | 1015|      0|                } \
  |  | 1016|      0|            } \
  |  | 1017|      0|        } \
  |  | 1018|  72.0k|}
  ------------------
 1025|  72.0k|}
t1.c:opj_t1_getctxno_mag:
  292|   357M|{
  293|   357M|    OPJ_UINT32 tmp = (f & T1_SIGMA_NEIGHBOURS) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG;
  ------------------
  |  |  158|   357M|#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|   357M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|   357M|#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|   357M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|   357M|#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|   357M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|   357M|#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|   357M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|   357M|#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|   357M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|   357M|#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|   357M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|   357M|#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|   357M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|   357M|#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|   357M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|   357M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  OPJ_UINT32 tmp = (f & T1_SIGMA_NEIGHBOURS) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG;
  ------------------
  |  |   63|   357M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   62|   357M|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|   357M|#define T1_CTXNO_ZC  0
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   357M|#define T1_NUMCTXS_ZC  9
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   56|   357M|#define T1_NUMCTXS_SC  5
  |  |  ------------------
  ------------------
                  OPJ_UINT32 tmp = (f & T1_SIGMA_NEIGHBOURS) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG;
  ------------------
  |  |   63|   357M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   62|   200k|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|   200k|#define T1_CTXNO_ZC  0
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   200k|#define T1_NUMCTXS_ZC  9
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   56|   200k|#define T1_NUMCTXS_SC  5
  |  |  ------------------
  ------------------
  |  Branch (293:22): [True: 357M, False: 200k]
  ------------------
  294|   357M|    OPJ_UINT32 tmp2 = (f & T1_MU_0) ? T1_CTXNO_MAG + 2 : tmp;
  ------------------
  |  |  114|   357M|#define T1_MU_0     (1U << 20)
  ------------------
                  OPJ_UINT32 tmp2 = (f & T1_MU_0) ? T1_CTXNO_MAG + 2 : tmp;
  ------------------
  |  |   63|   294M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   62|   294M|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|   294M|#define T1_CTXNO_ZC  0
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   294M|#define T1_NUMCTXS_ZC  9
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   56|   294M|#define T1_NUMCTXS_SC  5
  |  |  ------------------
  ------------------
  |  Branch (294:23): [True: 294M, False: 63.1M]
  ------------------
  295|   357M|    return tmp2;
  296|   357M|}
t1.c:opj_t1_dec_refpass_step_mqc:
  802|  5.88M|{
  803|  5.88M|    OPJ_UINT32 v;
  804|       |
  805|  5.88M|    opj_mqc_t *mqc = &(t1->mqc);       /* MQC component */
  806|  5.88M|    opj_t1_dec_refpass_step_mqc_macro(*flagsp, datap, 0, ci,
  ------------------
  |  |  784|  5.88M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  785|  5.88M|{ \
  |  |  786|  5.88M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  ------------------
  |  |  |  |  153|  5.88M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  5.88M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  ------------------
  |  |  |  |  163|  5.88M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  5.88M|#define T1_PI_0     (1U << 21)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (786:9): [True: 3.78M, False: 2.09M]
  |  |  ------------------
  |  |  787|  5.88M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  ------------------
  |  |  |  |  153|  5.88M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  5.88M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  788|  3.78M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  789|  3.78M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  ------------------
  |  |  |  |   62|  3.78M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  |  790|  3.78M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  3.78M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  3.78M|{ \
  |  |  |  |  140|  3.78M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  3.78M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  3.78M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  3.78M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  3.78M|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  3.78M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 845k, False: 2.93M]
  |  |  |  |  ------------------
  |  |  |  |  146|   845k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   845k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   845k|{ \
  |  |  |  |  |  |   57|   845k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 164k, False: 680k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|   164k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|   164k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|   164k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   680k|    } else { \
  |  |  |  |  |  |   62|   680k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   680k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   680k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   680k|    } \
  |  |  |  |  |  |   66|   845k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   845k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   845k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   845k|{ \
  |  |  |  |  |  |  128|  1.40M|    do { \
  |  |  |  |  |  |  129|  1.40M|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 174k, False: 1.22M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|   174k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|   174k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|   174k|{ \
  |  |  |  |  |  |  |  |  104|   174k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|   174k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|   174k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|   174k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|   174k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 170k, False: 4.64k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|   170k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 168k, False: 1.94k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|   168k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|   168k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|   168k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|   168k|            } else { \
  |  |  |  |  |  |  |  |  114|  1.94k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  1.94k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  1.94k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  1.94k|            } \
  |  |  |  |  |  |  |  |  118|   170k|        } else { \
  |  |  |  |  |  |  |  |  119|  4.64k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  4.64k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  4.64k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  4.64k|        } \
  |  |  |  |  |  |  |  |  123|   174k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|   174k|        } \
  |  |  |  |  |  |  132|  1.40M|        a <<= 1; \
  |  |  |  |  |  |  133|  1.40M|        c <<= 1; \
  |  |  |  |  |  |  134|  1.40M|        ct--; \
  |  |  |  |  |  |  135|  1.40M|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 555k, False: 845k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   845k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  2.93M|    } else {  \
  |  |  |  |  149|  2.93M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  2.93M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 916k, False: 2.02M]
  |  |  |  |  ------------------
  |  |  |  |  151|   916k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   916k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   916k|{ \
  |  |  |  |  |  |   45|   916k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 139k, False: 776k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|   139k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|   139k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   776k|    } else { \
  |  |  |  |  |  |   49|   776k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   776k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   776k|    } \
  |  |  |  |  |  |   52|   916k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   916k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   916k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   916k|{ \
  |  |  |  |  |  |  128|   969k|    do { \
  |  |  |  |  |  |  129|   969k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 121k, False: 848k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|   121k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|   121k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|   121k|{ \
  |  |  |  |  |  |  |  |  104|   121k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|   121k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|   121k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|   121k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|   121k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 118k, False: 3.24k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|   118k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 116k, False: 1.26k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|   116k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|   116k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|   116k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|   116k|            } else { \
  |  |  |  |  |  |  |  |  114|  1.26k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  1.26k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  1.26k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  1.26k|            } \
  |  |  |  |  |  |  |  |  118|   118k|        } else { \
  |  |  |  |  |  |  |  |  119|  3.24k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  3.24k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  3.24k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  3.24k|        } \
  |  |  |  |  |  |  |  |  123|   121k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|   121k|        } \
  |  |  |  |  |  |  132|   969k|        a <<= 1; \
  |  |  |  |  |  |  133|   969k|        c <<= 1; \
  |  |  |  |  |  |  134|   969k|        ct--; \
  |  |  |  |  |  |  135|   969k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 53.4k, False: 916k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   916k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  2.02M|        } else { \
  |  |  |  |  154|  2.02M|            d = (*curctx)->mps; \
  |  |  |  |  155|  2.02M|        } \
  |  |  |  |  156|  2.93M|    } \
  |  |  |  |  157|  3.78M|}
  |  |  ------------------
  |  |  791|  3.78M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  ------------------
  |  |  |  Branch (791:33): [True: 1.89M, False: 1.89M]
  |  |  ------------------
  |  |  792|  3.78M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  ------------------
  |  |  |  |  162|  3.78M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  3.78M|#define T1_MU_0     (1U << 20)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  793|  3.78M|    } \
  |  |  794|  5.88M|}
  ------------------
  807|  5.88M|                                      mqc, mqc->curctx, v, mqc->a, mqc->c,
  808|  5.88M|                                      mqc->ct, poshalf);
  809|  5.88M|}
t1.c:opj_t1_dec_refpass_mqc_generic:
 1030|   359k|{
 1031|   359k|    opj_t1_dec_refpass_mqc_internal(t1, bpno, t1->w, t1->h, t1->w + 2U);
  ------------------
  |  |  978|   359k|#define opj_t1_dec_refpass_mqc_internal(t1, bpno, w, h, flags_stride) \
  |  |  979|   359k|{ \
  |  |  980|   359k|        OPJ_INT32 one, poshalf; \
  |  |  981|   359k|        OPJ_UINT32 i, j, k; \
  |  |  982|   359k|        register OPJ_INT32 *data = t1->data; \
  |  |  983|   359k|        register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  |  984|   359k|        const OPJ_UINT32 l_w = w; \
  |  |  985|   359k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  986|   359k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|   359k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|   359k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|   359k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|   359k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  987|   359k|        register OPJ_UINT32 v; \
  |  |  988|   359k|        one = 1 << bpno; \
  |  |  989|   359k|        poshalf = one >> 1; \
  |  |  990|  7.96M|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (990:21): [True: 7.60M, False: 359k]
  |  |  ------------------
  |  |  991|  81.0M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (991:29): [True: 73.4M, False: 7.60M]
  |  |  ------------------
  |  |  992|  73.4M|                        opj_flag_t flags = *flagsp; \
  |  |  993|  73.4M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (993:29): [True: 56.3M, False: 17.1M]
  |  |  ------------------
  |  |  994|  56.3M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  784|  56.3M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  785|  56.3M|{ \
  |  |  |  |  786|  56.3M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  56.3M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  56.3M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  56.3M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  56.3M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (786:9): [True: 44.0M, False: 12.3M]
  |  |  |  |  ------------------
  |  |  |  |  787|  56.3M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  56.3M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  56.3M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  788|  44.0M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  789|  44.0M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  44.0M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  790|  44.0M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  44.0M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  44.0M|{ \
  |  |  |  |  |  |  140|  44.0M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  44.0M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  44.0M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  44.0M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  44.0M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  44.0M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 9.01M, False: 35.0M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  9.01M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  9.01M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  9.01M|{ \
  |  |  |  |  |  |  |  |   57|  9.01M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.77M, False: 7.24M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.77M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.77M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.77M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  7.24M|    } else { \
  |  |  |  |  |  |  |  |   62|  7.24M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  7.24M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  7.24M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  7.24M|    } \
  |  |  |  |  |  |  |  |   66|  9.01M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  9.01M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  9.01M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  9.01M|{ \
  |  |  |  |  |  |  |  |  128|  14.9M|    do { \
  |  |  |  |  |  |  |  |  129|  14.9M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.87M, False: 13.0M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.87M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.87M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.87M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.87M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.87M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.87M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.87M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.87M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.87M, False: 7.05k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.87M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.86M, False: 2.50k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.86M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.86M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.86M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.86M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.50k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.50k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.50k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.50k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.87M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.05k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.05k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.05k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.05k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.87M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.87M|        } \
  |  |  |  |  |  |  |  |  132|  14.9M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  14.9M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  14.9M|        ct--; \
  |  |  |  |  |  |  |  |  135|  14.9M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.89M, False: 9.01M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  9.01M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  35.0M|    } else {  \
  |  |  |  |  |  |  149|  35.0M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  35.0M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 9.74M, False: 25.2M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  9.74M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  9.74M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  9.74M|{ \
  |  |  |  |  |  |  |  |   45|  9.74M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.51M, False: 8.23M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.51M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.51M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  8.23M|    } else { \
  |  |  |  |  |  |  |  |   49|  8.23M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  8.23M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  8.23M|    } \
  |  |  |  |  |  |  |  |   52|  9.74M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  9.74M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  9.74M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  9.74M|{ \
  |  |  |  |  |  |  |  |  128|  10.3M|    do { \
  |  |  |  |  |  |  |  |  129|  10.3M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.28M, False: 9.03M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.28M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.28M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.28M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.28M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.28M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.28M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.28M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.28M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.28M, False: 5.43k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.28M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.28M, False: 1.84k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.28M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.28M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.28M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.28M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.84k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.84k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.84k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.84k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.28M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.43k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.43k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.43k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.43k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.28M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.28M|        } \
  |  |  |  |  |  |  |  |  132|  10.3M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  10.3M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  10.3M|        ct--; \
  |  |  |  |  |  |  |  |  135|  10.3M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 572k, False: 9.74M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  9.74M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  25.2M|        } else { \
  |  |  |  |  |  |  154|  25.2M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  25.2M|        } \
  |  |  |  |  |  |  156|  35.0M|    } \
  |  |  |  |  |  |  157|  44.0M|}
  |  |  |  |  ------------------
  |  |  |  |  791|  44.0M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (791:33): [True: 22.0M, False: 22.0M]
  |  |  |  |  ------------------
  |  |  |  |  792|  44.0M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  44.0M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  44.0M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  793|  44.0M|    } \
  |  |  |  |  794|  56.3M|}
  |  |  ------------------
  |  |  995|  56.3M|                                flags, data, l_w, 0, \
  |  |  996|  56.3M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  |  997|  56.3M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  784|  56.3M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  785|  56.3M|{ \
  |  |  |  |  786|  56.3M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  56.3M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  56.3M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  56.3M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  56.3M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (786:9): [True: 43.9M, False: 12.4M]
  |  |  |  |  ------------------
  |  |  |  |  787|  56.3M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  56.3M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  56.3M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  788|  43.9M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  789|  43.9M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  43.9M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  790|  43.9M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  43.9M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  43.9M|{ \
  |  |  |  |  |  |  140|  43.9M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  43.9M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  43.9M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  43.9M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  43.9M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  43.9M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.99M, False: 34.9M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.99M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.99M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.99M|{ \
  |  |  |  |  |  |  |  |   57|  8.99M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.77M, False: 7.22M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.77M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.77M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.77M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  7.22M|    } else { \
  |  |  |  |  |  |  |  |   62|  7.22M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  7.22M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  7.22M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  7.22M|    } \
  |  |  |  |  |  |  |  |   66|  8.99M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.99M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.99M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.99M|{ \
  |  |  |  |  |  |  |  |  128|  14.9M|    do { \
  |  |  |  |  |  |  |  |  129|  14.9M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.86M, False: 13.0M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.86M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.86M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.86M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.86M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.86M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.86M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.86M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.86M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.85M, False: 6.37k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.85M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.85M, False: 2.79k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.85M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.85M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.85M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.85M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.79k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.79k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.79k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.79k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.85M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.37k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.37k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.37k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.37k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.86M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.86M|        } \
  |  |  |  |  |  |  |  |  132|  14.9M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  14.9M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  14.9M|        ct--; \
  |  |  |  |  |  |  |  |  135|  14.9M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.91M, False: 8.99M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.99M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  34.9M|    } else {  \
  |  |  |  |  |  |  149|  34.9M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  34.9M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 9.76M, False: 25.1M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  9.76M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  9.76M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  9.76M|{ \
  |  |  |  |  |  |  |  |   45|  9.76M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.50M, False: 8.26M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.50M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.50M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  8.26M|    } else { \
  |  |  |  |  |  |  |  |   49|  8.26M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  8.26M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  8.26M|    } \
  |  |  |  |  |  |  |  |   52|  9.76M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  9.76M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  9.76M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  9.76M|{ \
  |  |  |  |  |  |  |  |  128|  10.3M|    do { \
  |  |  |  |  |  |  |  |  129|  10.3M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.29M, False: 9.03M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.29M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.29M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.29M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.29M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.29M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.29M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.29M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.29M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.29M, False: 4.87k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.29M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.29M, False: 1.99k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.29M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.29M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.29M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.29M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.99k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.99k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.99k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.99k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.29M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.87k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.87k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.87k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.87k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.29M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.29M|        } \
  |  |  |  |  |  |  |  |  132|  10.3M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  10.3M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  10.3M|        ct--; \
  |  |  |  |  |  |  |  |  135|  10.3M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 574k, False: 9.76M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  9.76M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  25.1M|        } else { \
  |  |  |  |  |  |  154|  25.1M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  25.1M|        } \
  |  |  |  |  |  |  156|  34.9M|    } \
  |  |  |  |  |  |  157|  43.9M|}
  |  |  |  |  ------------------
  |  |  |  |  791|  43.9M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (791:33): [True: 21.9M, False: 22.0M]
  |  |  |  |  ------------------
  |  |  |  |  792|  43.9M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  43.9M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  43.9M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  793|  43.9M|    } \
  |  |  |  |  794|  56.3M|}
  |  |  ------------------
  |  |  998|  56.3M|                                flags, data, l_w, 1, \
  |  |  999|  56.3M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1000|  56.3M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  784|  56.3M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  785|  56.3M|{ \
  |  |  |  |  786|  56.3M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  56.3M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  56.3M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  56.3M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  56.3M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (786:9): [True: 44.0M, False: 12.3M]
  |  |  |  |  ------------------
  |  |  |  |  787|  56.3M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  56.3M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  56.3M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  788|  44.0M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  789|  44.0M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  44.0M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  790|  44.0M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  44.0M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  44.0M|{ \
  |  |  |  |  |  |  140|  44.0M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  44.0M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  44.0M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  44.0M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  44.0M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  44.0M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.98M, False: 35.0M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.98M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.98M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.98M|{ \
  |  |  |  |  |  |  |  |   57|  8.98M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.77M, False: 7.21M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.77M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.77M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.77M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  7.21M|    } else { \
  |  |  |  |  |  |  |  |   62|  7.21M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  7.21M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  7.21M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  7.21M|    } \
  |  |  |  |  |  |  |  |   66|  8.98M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.98M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.98M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.98M|{ \
  |  |  |  |  |  |  |  |  128|  14.8M|    do { \
  |  |  |  |  |  |  |  |  129|  14.8M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.86M, False: 13.0M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.86M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.86M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.86M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.86M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.86M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.86M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.86M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.86M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.85M, False: 7.18k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.85M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.85M, False: 2.51k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.85M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.85M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.85M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.85M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.51k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.51k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.51k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.51k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.85M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.18k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.18k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.18k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.18k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.86M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.86M|        } \
  |  |  |  |  |  |  |  |  132|  14.8M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  14.8M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  14.8M|        ct--; \
  |  |  |  |  |  |  |  |  135|  14.8M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.90M, False: 8.98M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.98M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  35.0M|    } else {  \
  |  |  |  |  |  |  149|  35.0M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  35.0M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 9.79M, False: 25.2M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  9.79M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  9.79M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  9.79M|{ \
  |  |  |  |  |  |  |  |   45|  9.79M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.49M, False: 8.29M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.49M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.49M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  8.29M|    } else { \
  |  |  |  |  |  |  |  |   49|  8.29M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  8.29M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  8.29M|    } \
  |  |  |  |  |  |  |  |   52|  9.79M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  9.79M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  9.79M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  9.79M|{ \
  |  |  |  |  |  |  |  |  128|  10.3M|    do { \
  |  |  |  |  |  |  |  |  129|  10.3M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.28M, False: 9.08M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.28M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.28M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.28M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.28M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.28M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.28M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.28M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.28M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.28M, False: 4.50k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.28M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.27M, False: 1.87k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.27M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.27M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.27M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.27M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.87k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.87k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.87k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.87k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.28M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.50k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.50k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.50k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.50k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.28M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.28M|        } \
  |  |  |  |  |  |  |  |  132|  10.3M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  10.3M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  10.3M|        ct--; \
  |  |  |  |  |  |  |  |  135|  10.3M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 576k, False: 9.79M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  9.79M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  25.2M|        } else { \
  |  |  |  |  |  |  154|  25.2M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  25.2M|        } \
  |  |  |  |  |  |  156|  35.0M|    } \
  |  |  |  |  |  |  157|  44.0M|}
  |  |  |  |  ------------------
  |  |  |  |  791|  44.0M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (791:33): [True: 21.9M, False: 22.0M]
  |  |  |  |  ------------------
  |  |  |  |  792|  44.0M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  44.0M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  44.0M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  793|  44.0M|    } \
  |  |  |  |  794|  56.3M|}
  |  |  ------------------
  |  | 1001|  56.3M|                                flags, data, l_w, 2, \
  |  | 1002|  56.3M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1003|  56.3M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  784|  56.3M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  785|  56.3M|{ \
  |  |  |  |  786|  56.3M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  56.3M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  56.3M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  56.3M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  56.3M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (786:9): [True: 43.6M, False: 12.7M]
  |  |  |  |  ------------------
  |  |  |  |  787|  56.3M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  56.3M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  56.3M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  788|  43.6M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  789|  43.6M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  43.6M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  790|  43.6M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  43.6M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  43.6M|{ \
  |  |  |  |  |  |  140|  43.6M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  43.6M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  43.6M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  43.6M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  43.6M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  43.6M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.93M, False: 34.6M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.93M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.93M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.93M|{ \
  |  |  |  |  |  |  |  |   57|  8.93M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.75M, False: 7.17M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.75M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.75M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.75M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  7.17M|    } else { \
  |  |  |  |  |  |  |  |   62|  7.17M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  7.17M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  7.17M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  7.17M|    } \
  |  |  |  |  |  |  |  |   66|  8.93M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.93M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.93M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.93M|{ \
  |  |  |  |  |  |  |  |  128|  14.7M|    do { \
  |  |  |  |  |  |  |  |  129|  14.7M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.84M, False: 12.9M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.84M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.84M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.84M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.84M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.84M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.84M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.84M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.84M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.83M, False: 9.28k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.83M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.83M, False: 3.19k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.83M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.83M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.83M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.83M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.19k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.19k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.19k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.19k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.83M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  9.28k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  9.28k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  9.28k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  9.28k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.84M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.84M|        } \
  |  |  |  |  |  |  |  |  132|  14.7M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  14.7M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  14.7M|        ct--; \
  |  |  |  |  |  |  |  |  135|  14.7M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.86M, False: 8.93M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.93M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  34.6M|    } else {  \
  |  |  |  |  |  |  149|  34.6M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  34.6M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 9.66M, False: 25.0M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  9.66M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  9.66M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  9.66M|{ \
  |  |  |  |  |  |  |  |   45|  9.66M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.48M, False: 8.17M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.48M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.48M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  8.17M|    } else { \
  |  |  |  |  |  |  |  |   49|  8.17M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  8.17M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  8.17M|    } \
  |  |  |  |  |  |  |  |   52|  9.66M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  9.66M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  9.66M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  9.66M|{ \
  |  |  |  |  |  |  |  |  128|  10.2M|    do { \
  |  |  |  |  |  |  |  |  129|  10.2M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.27M, False: 8.96M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.27M|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.27M|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.27M|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.27M|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.27M|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.27M|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.27M|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.27M|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.26M, False: 4.51k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.26M|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.26M, False: 2.02k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.26M|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.26M|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.26M|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.26M|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.02k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.02k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.02k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.02k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.26M|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.51k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.51k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.51k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.51k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.27M|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.27M|        } \
  |  |  |  |  |  |  |  |  132|  10.2M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  10.2M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  10.2M|        ct--; \
  |  |  |  |  |  |  |  |  135|  10.2M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 576k, False: 9.66M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  9.66M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  25.0M|        } else { \
  |  |  |  |  |  |  154|  25.0M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  25.0M|        } \
  |  |  |  |  |  |  156|  34.6M|    } \
  |  |  |  |  |  |  157|  43.6M|}
  |  |  |  |  ------------------
  |  |  |  |  791|  43.6M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (791:33): [True: 21.7M, False: 21.8M]
  |  |  |  |  ------------------
  |  |  |  |  792|  43.6M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  43.6M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  43.6M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  793|  43.6M|    } \
  |  |  |  |  794|  56.3M|}
  |  |  ------------------
  |  | 1004|  56.3M|                                flags, data, l_w, 3, \
  |  | 1005|  56.3M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1006|  56.3M|                            *flagsp = flags; \
  |  | 1007|  56.3M|                        } \
  |  | 1008|  73.4M|                } \
  |  | 1009|  7.60M|        } \
  |  | 1010|   359k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|   359k|        mqc->curctx = curctx; \
  |  |  |  |  167|   359k|        mqc->c = c; \
  |  |  |  |  168|   359k|        mqc->a = a; \
  |  |  |  |  169|   359k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1011|   359k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1011:13): [True: 48.3k, False: 311k]
  |  |  ------------------
  |  | 1012|  3.40M|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1012:25): [True: 3.35M, False: 48.3k]
  |  |  ------------------
  |  | 1013|  9.24M|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1013:29): [True: 5.88M, False: 3.35M]
  |  |  ------------------
  |  | 1014|  5.88M|                        opj_t1_dec_refpass_step_mqc(t1, flagsp, data + j * l_w, poshalf, j); \
  |  | 1015|  5.88M|                } \
  |  | 1016|  3.35M|            } \
  |  | 1017|  48.3k|        } \
  |  | 1018|   359k|}
  ------------------
 1032|   359k|}
t1.c:opj_t1_dec_clnpass:
 1395|   522k|{
 1396|   522k|    if (t1->w == 64 && t1->h == 64) {
  ------------------
  |  Branch (1396:9): [True: 135k, False: 386k]
  |  Branch (1396:24): [True: 105k, False: 30.5k]
  ------------------
 1397|   105k|        if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  ------------------
  |  |   61|   105k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  |  Branch (1397:13): [True: 58.0k, False: 47.1k]
  ------------------
 1398|  58.0k|            opj_t1_dec_clnpass_64x64_vsc(t1, bpno);
 1399|  58.0k|        } else {
 1400|  47.1k|            opj_t1_dec_clnpass_64x64_novsc(t1, bpno);
 1401|  47.1k|        }
 1402|   417k|    } else {
 1403|   417k|        if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  ------------------
  |  |   61|   417k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  |  Branch (1403:13): [True: 216k, False: 201k]
  ------------------
 1404|   216k|            opj_t1_dec_clnpass_generic_vsc(t1, bpno);
 1405|   216k|        } else {
 1406|   201k|            opj_t1_dec_clnpass_generic_novsc(t1, bpno);
 1407|   201k|        }
 1408|   417k|    }
 1409|   522k|    opj_t1_dec_clnpass_check_segsym(t1, cblksty);
 1410|   522k|}
t1.c:opj_t1_dec_clnpass_64x64_vsc:
 1371|  58.0k|{
 1372|  58.0k|    opj_t1_dec_clnpass_internal(t1, bpno, OPJ_TRUE, 64, 64, 66);
  ------------------
  |  | 1251|  58.0k|#define opj_t1_dec_clnpass_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  | 1252|  58.0k|{ \
  |  | 1253|  58.0k|    OPJ_INT32 one, half, oneplushalf; \
  |  | 1254|  58.0k|    OPJ_UINT32 runlen; \
  |  | 1255|  58.0k|    OPJ_UINT32 i, j, k; \
  |  | 1256|  58.0k|    const OPJ_UINT32 l_w = w; \
  |  | 1257|  58.0k|    opj_mqc_t* mqc = &(t1->mqc); \
  |  | 1258|  58.0k|    register OPJ_INT32 *data = t1->data; \
  |  | 1259|  58.0k|    register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  | 1260|  58.0k|    DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  58.0k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  58.0k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  58.0k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  58.0k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  | 1261|  58.0k|    register OPJ_UINT32 v; \
  |  | 1262|  58.0k|    one = 1 << bpno; \
  |  | 1263|  58.0k|    half = one >> 1; \
  |  | 1264|  58.0k|    oneplushalf = one | half; \
  |  | 1265|   986k|    for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (1265:17): [True: 928k, False: 58.0k]
  |  |  ------------------
  |  | 1266|  60.3M|        for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1266:21): [True: 59.4M, False: 928k]
  |  |  ------------------
  |  | 1267|  59.4M|            opj_flag_t flags = *flagsp; \
  |  | 1268|  59.4M|            if (flags == 0) { \
  |  |  ------------------
  |  |  |  Branch (1268:17): [True: 15.7M, False: 43.6M]
  |  |  ------------------
  |  | 1269|  15.7M|                OPJ_UINT32 partial = OPJ_TRUE; \
  |  |  ------------------
  |  |  |  |  117|  15.7M|#define OPJ_TRUE 1
  |  |  ------------------
  |  | 1270|  15.7M|                opj_t1_setcurctx(curctx, T1_CTXNO_AGG); \
  |  |  ------------------
  |  |  |  |   62|  15.7M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1271|  15.7M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  15.7M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  15.7M|{ \
  |  |  |  |  140|  15.7M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  15.7M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  15.7M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  15.7M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  15.7M|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  15.7M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 838k, False: 14.9M]
  |  |  |  |  ------------------
  |  |  |  |  146|   838k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   838k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   838k|{ \
  |  |  |  |  |  |   57|   838k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 118k, False: 719k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|   118k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|   118k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|   118k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   719k|    } else { \
  |  |  |  |  |  |   62|   719k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   719k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   719k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   719k|    } \
  |  |  |  |  |  |   66|   838k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   838k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   838k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   838k|{ \
  |  |  |  |  |  |  128|  1.71M|    do { \
  |  |  |  |  |  |  129|  1.71M|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 208k, False: 1.50M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|   208k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|   208k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|   208k|{ \
  |  |  |  |  |  |  |  |  104|   208k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|   208k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|   208k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|   208k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|   208k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 148k, False: 59.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|   148k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 136k, False: 12.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|   136k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|   136k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|   136k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|   136k|            } else { \
  |  |  |  |  |  |  |  |  114|  12.3k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  12.3k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  12.3k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  12.3k|            } \
  |  |  |  |  |  |  |  |  118|   148k|        } else { \
  |  |  |  |  |  |  |  |  119|  59.7k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  59.7k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  59.7k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  59.7k|        } \
  |  |  |  |  |  |  |  |  123|   208k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|   208k|        } \
  |  |  |  |  |  |  132|  1.71M|        a <<= 1; \
  |  |  |  |  |  |  133|  1.71M|        c <<= 1; \
  |  |  |  |  |  |  134|  1.71M|        ct--; \
  |  |  |  |  |  |  135|  1.71M|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 876k, False: 838k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   838k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  14.9M|    } else {  \
  |  |  |  |  149|  14.9M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  14.9M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 939k, False: 14.0M]
  |  |  |  |  ------------------
  |  |  |  |  151|   939k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   939k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   939k|{ \
  |  |  |  |  |  |   45|   939k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 89.6k, False: 850k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  89.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  89.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   850k|    } else { \
  |  |  |  |  |  |   49|   850k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   850k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   850k|    } \
  |  |  |  |  |  |   52|   939k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   939k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   939k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   939k|{ \
  |  |  |  |  |  |  128|   977k|    do { \
  |  |  |  |  |  |  129|   977k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 130k, False: 846k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|   130k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|   130k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|   130k|{ \
  |  |  |  |  |  |  |  |  104|   130k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|   130k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|   130k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|   130k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|   130k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 94.6k, False: 36.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  94.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 86.7k, False: 7.96k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  86.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  86.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  86.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  86.7k|            } else { \
  |  |  |  |  |  |  |  |  114|  7.96k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  7.96k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  7.96k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  7.96k|            } \
  |  |  |  |  |  |  |  |  118|  94.6k|        } else { \
  |  |  |  |  |  |  |  |  119|  36.3k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  36.3k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  36.3k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  36.3k|        } \
  |  |  |  |  |  |  |  |  123|   130k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|   130k|        } \
  |  |  |  |  |  |  132|   977k|        a <<= 1; \
  |  |  |  |  |  |  133|   977k|        c <<= 1; \
  |  |  |  |  |  |  134|   977k|        ct--; \
  |  |  |  |  |  |  135|   977k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 37.9k, False: 939k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   939k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  14.0M|        } else { \
  |  |  |  |  154|  14.0M|            d = (*curctx)->mps; \
  |  |  |  |  155|  14.0M|        } \
  |  |  |  |  156|  14.9M|    } \
  |  |  |  |  157|  15.7M|}
  |  |  ------------------
  |  | 1272|  15.7M|                if (!v) { \
  |  |  ------------------
  |  |  |  Branch (1272:21): [True: 14.8M, False: 925k]
  |  |  ------------------
  |  | 1273|  14.8M|                    continue; \
  |  | 1274|  14.8M|                } \
  |  | 1275|  15.7M|                opj_t1_setcurctx(curctx, T1_CTXNO_UNI); \
  |  |  ------------------
  |  |  |  |   62|   925k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1276|   925k|                opj_mqc_decode_macro(runlen, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   925k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   925k|{ \
  |  |  |  |  140|   925k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   925k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   925k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   925k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   925k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   925k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 468k, False: 456k]
  |  |  |  |  ------------------
  |  |  |  |  146|   468k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   468k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   468k|{ \
  |  |  |  |  |  |   57|   468k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 282k, False: 185k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|   282k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|   282k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|   282k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   282k|    } else { \
  |  |  |  |  |  |   62|   185k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   185k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   185k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   185k|    } \
  |  |  |  |  |  |   66|   468k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   468k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   468k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   468k|{ \
  |  |  |  |  |  |  128|   468k|    do { \
  |  |  |  |  |  |  129|   468k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 62.3k, False: 406k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  62.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  62.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  62.3k|{ \
  |  |  |  |  |  |  |  |  104|  62.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  62.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  62.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  62.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  62.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 45.7k, False: 16.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  45.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 41.9k, False: 3.86k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  41.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  41.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  41.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  41.9k|            } else { \
  |  |  |  |  |  |  |  |  114|  3.86k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  3.86k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  3.86k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  3.86k|            } \
  |  |  |  |  |  |  |  |  118|  45.7k|        } else { \
  |  |  |  |  |  |  |  |  119|  16.5k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  16.5k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  16.5k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  16.5k|        } \
  |  |  |  |  |  |  |  |  123|  62.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  62.3k|        } \
  |  |  |  |  |  |  132|   468k|        a <<= 1; \
  |  |  |  |  |  |  133|   468k|        c <<= 1; \
  |  |  |  |  |  |  134|   468k|        ct--; \
  |  |  |  |  |  |  135|   468k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 468k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   468k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   468k|    } else {  \
  |  |  |  |  149|   456k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   456k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 364k, False: 91.8k]
  |  |  |  |  ------------------
  |  |  |  |  151|   364k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   364k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   364k|{ \
  |  |  |  |  |  |   45|   364k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 200k, False: 164k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|   200k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|   200k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   200k|    } else { \
  |  |  |  |  |  |   49|   164k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   164k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   164k|    } \
  |  |  |  |  |  |   52|   364k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   364k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   364k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   364k|{ \
  |  |  |  |  |  |  128|   447k|    do { \
  |  |  |  |  |  |  129|   447k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 52.7k, False: 394k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  52.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  52.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  52.7k|{ \
  |  |  |  |  |  |  |  |  104|  52.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  52.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  52.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  52.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  52.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 43.9k, False: 8.82k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  43.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 40.7k, False: 3.18k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  40.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  40.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  40.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  40.7k|            } else { \
  |  |  |  |  |  |  |  |  114|  3.18k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  3.18k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  3.18k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  3.18k|            } \
  |  |  |  |  |  |  |  |  118|  43.9k|        } else { \
  |  |  |  |  |  |  |  |  119|  8.82k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  8.82k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  8.82k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  8.82k|        } \
  |  |  |  |  |  |  |  |  123|  52.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  52.7k|        } \
  |  |  |  |  |  |  132|   447k|        a <<= 1; \
  |  |  |  |  |  |  133|   447k|        c <<= 1; \
  |  |  |  |  |  |  134|   447k|        ct--; \
  |  |  |  |  |  |  135|   447k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 82.3k, False: 364k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   364k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   364k|        } else { \
  |  |  |  |  154|  91.8k|            d = (*curctx)->mps; \
  |  |  |  |  155|  91.8k|        } \
  |  |  |  |  156|   456k|    } \
  |  |  |  |  157|   925k|}
  |  |  ------------------
  |  | 1277|   925k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   925k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   925k|{ \
  |  |  |  |  140|   925k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   925k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   925k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   925k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   925k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   925k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 448k, False: 476k]
  |  |  |  |  ------------------
  |  |  |  |  146|   448k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   448k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   448k|{ \
  |  |  |  |  |  |   57|   448k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 122k, False: 326k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|   122k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|   122k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|   122k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   326k|    } else { \
  |  |  |  |  |  |   62|   326k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   326k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   326k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   326k|    } \
  |  |  |  |  |  |   66|   448k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   448k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   448k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   448k|{ \
  |  |  |  |  |  |  128|   448k|    do { \
  |  |  |  |  |  |  129|   448k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 62.4k, False: 386k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  62.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  62.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  62.4k|{ \
  |  |  |  |  |  |  |  |  104|  62.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  62.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  62.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  62.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  62.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 45.1k, False: 17.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  45.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 41.5k, False: 3.55k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  41.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  41.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  41.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  41.5k|            } else { \
  |  |  |  |  |  |  |  |  114|  3.55k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  3.55k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  3.55k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  3.55k|            } \
  |  |  |  |  |  |  |  |  118|  45.1k|        } else { \
  |  |  |  |  |  |  |  |  119|  17.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  17.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  17.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  17.2k|        } \
  |  |  |  |  |  |  |  |  123|  62.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  62.4k|        } \
  |  |  |  |  |  |  132|   448k|        a <<= 1; \
  |  |  |  |  |  |  133|   448k|        c <<= 1; \
  |  |  |  |  |  |  134|   448k|        ct--; \
  |  |  |  |  |  |  135|   448k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 448k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   448k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   476k|    } else {  \
  |  |  |  |  149|   476k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   476k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 401k, False: 74.5k]
  |  |  |  |  ------------------
  |  |  |  |  151|   401k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   401k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   401k|{ \
  |  |  |  |  |  |   45|   401k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 88.2k, False: 313k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  88.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  88.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   313k|    } else { \
  |  |  |  |  |  |   49|   313k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   313k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   313k|    } \
  |  |  |  |  |  |   52|   401k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   401k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   401k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   401k|{ \
  |  |  |  |  |  |  128|   451k|    do { \
  |  |  |  |  |  |  129|   451k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 53.0k, False: 398k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  53.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  53.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  53.0k|{ \
  |  |  |  |  |  |  |  |  104|  53.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  53.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  53.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  53.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  53.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 42.6k, False: 10.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  42.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 39.2k, False: 3.42k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  39.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  39.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  39.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  39.2k|            } else { \
  |  |  |  |  |  |  |  |  114|  3.42k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  3.42k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  3.42k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  3.42k|            } \
  |  |  |  |  |  |  |  |  118|  42.6k|        } else { \
  |  |  |  |  |  |  |  |  119|  10.3k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  10.3k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  10.3k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  10.3k|        } \
  |  |  |  |  |  |  |  |  123|  53.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  53.0k|        } \
  |  |  |  |  |  |  132|   451k|        a <<= 1; \
  |  |  |  |  |  |  133|   451k|        c <<= 1; \
  |  |  |  |  |  |  134|   451k|        ct--; \
  |  |  |  |  |  |  135|   451k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 49.4k, False: 401k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   401k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   401k|        } else { \
  |  |  |  |  154|  74.5k|            d = (*curctx)->mps; \
  |  |  |  |  155|  74.5k|        } \
  |  |  |  |  156|   476k|    } \
  |  |  |  |  157|   925k|}
  |  |  ------------------
  |  | 1278|   925k|                runlen = (runlen << 1) | v; \
  |  | 1279|   925k|                switch(runlen) { \
  |  |  ------------------
  |  |  |  Branch (1279:24): [True: 0, False: 925k]
  |  |  ------------------
  |  | 1280|   304k|                    case 0: \
  |  |  ------------------
  |  |  |  Branch (1280:21): [True: 304k, False: 621k]
  |  |  ------------------
  |  | 1281|   304k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, OPJ_TRUE,\
  |  |  ------------------
  |  |  |  | 1118|   304k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   304k|{ \
  |  |  |  | 1120|   304k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   304k|        do { \
  |  |  |  | 1122|   304k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|      0|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|      0|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|      0|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|      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|}
  |  |  |  |  ------------------
  |  |  |  | 1126|      0|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1127|      0|                    break; \
  |  |  |  | 1128|      0|            } \
  |  |  |  | 1129|   304k|            { \
  |  |  |  | 1130|   304k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   304k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   304k|                                    ci); \
  |  |  |  | 1133|   304k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   304k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   304k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   304k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   304k|{ \
  |  |  |  |  |  |  140|   304k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   304k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   304k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   304k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   304k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   304k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 95.9k, False: 208k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  95.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  95.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  95.9k|{ \
  |  |  |  |  |  |  |  |   57|  95.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 5.20k, False: 90.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  5.20k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  5.20k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  5.20k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  90.7k|    } else { \
  |  |  |  |  |  |  |  |   62|  90.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  90.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  90.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  90.7k|    } \
  |  |  |  |  |  |  |  |   66|  95.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  95.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  95.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  95.9k|{ \
  |  |  |  |  |  |  |  |  128|   144k|    do { \
  |  |  |  |  |  |  |  |  129|   144k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.8k, False: 127k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 13.9k, False: 2.88k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.8k, False: 1.09k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.8k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.8k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.8k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.8k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.09k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.09k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.09k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.09k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.88k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.88k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.88k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.88k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.8k|        } \
  |  |  |  |  |  |  |  |  132|   144k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   144k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   144k|        ct--; \
  |  |  |  |  |  |  |  |  135|   144k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 48.5k, False: 95.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  95.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   208k|    } else {  \
  |  |  |  |  |  |  149|   208k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   208k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 108k, False: 99.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   108k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   108k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   108k|{ \
  |  |  |  |  |  |  |  |   45|   108k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 4.36k, False: 104k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  4.36k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  4.36k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   104k|    } else { \
  |  |  |  |  |  |  |  |   49|   104k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   104k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   104k|    } \
  |  |  |  |  |  |  |  |   52|   108k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   108k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   108k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   108k|{ \
  |  |  |  |  |  |  |  |  128|   109k|    do { \
  |  |  |  |  |  |  |  |  129|   109k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 12.8k, False: 96.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  12.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  12.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  12.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  12.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  12.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  12.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  12.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  12.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 10.8k, False: 2.01k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  10.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.26k, False: 1.55k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.26k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.26k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.26k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.26k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.55k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.55k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.55k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.55k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  10.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.01k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.01k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.01k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.01k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  12.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  12.8k|        } \
  |  |  |  |  |  |  |  |  132|   109k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   109k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   109k|        ct--; \
  |  |  |  |  |  |  |  |  135|   109k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 495, False: 108k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   108k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   108k|        } else { \
  |  |  |  |  |  |  154|  99.3k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  99.3k|        } \
  |  |  |  |  |  |  156|   208k|    } \
  |  |  |  |  |  |  157|   304k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   304k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   304k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 166k, False: 137k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   304k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   304k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   304k|{ \
  |  |  |  |  |  |  323|   304k|    /* east */ \
  |  |  |  |  |  |  324|   304k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   304k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   304k| \
  |  |  |  |  |  |  326|   304k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   304k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   304k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   304k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   304k| \
  |  |  |  |  |  |  329|   304k|    /* west */ \
  |  |  |  |  |  |  330|   304k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   304k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   304k| \
  |  |  |  |  |  |  332|   304k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   304k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   304k| \
  |  |  |  |  |  |  340|   304k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   304k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|   304k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   304k|            } \
  |  |  |  | 1139|   304k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   304k|    } \
  |  |  |  | 1141|   304k|}
  |  |  ------------------
  |  | 1282|   304k|                                            flags, flagsp, flags_stride, data, \
  |  | 1283|   304k|                                            l_w, 0, mqc, curctx, \
  |  | 1284|   304k|                                            v, a, c, ct, oneplushalf, vsc); \
  |  | 1285|   304k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   304k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1286|   304k|                        /* FALLTHRU */ \
  |  | 1287|   539k|                    case 1: \
  |  |  ------------------
  |  |  |  Branch (1287:21): [True: 235k, False: 690k]
  |  |  ------------------
  |  | 1288|   539k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1118|   539k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   539k|{ \
  |  |  |  | 1120|   539k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   539k|        do { \
  |  |  |  | 1122|   539k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [True: 304k, False: 235k]
  |  |  |  |  ------------------
  |  |  |  | 1123|   304k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|   304k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   304k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|   304k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   304k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   304k|{ \
  |  |  |  |  |  |  140|   304k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   304k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   304k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   304k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   304k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   304k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 54.4k, False: 249k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  54.4k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  54.4k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  54.4k|{ \
  |  |  |  |  |  |  |  |   57|  54.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 10.4k, False: 43.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  10.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  10.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  10.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  43.9k|    } else { \
  |  |  |  |  |  |  |  |   62|  43.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  43.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  43.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  43.9k|    } \
  |  |  |  |  |  |  |  |   66|  54.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  54.4k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  54.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  54.4k|{ \
  |  |  |  |  |  |  |  |  128|  96.3k|    do { \
  |  |  |  |  |  |  |  |  129|  96.3k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 13.4k, False: 82.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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.2k, False: 2.15k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.7k, False: 499]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  10.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  10.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  10.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  10.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    499|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    499|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    499|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    499|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.2k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.15k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.15k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.15k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.15k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  13.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  13.4k|        } \
  |  |  |  |  |  |  |  |  132|  96.3k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  96.3k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  96.3k|        ct--; \
  |  |  |  |  |  |  |  |  135|  96.3k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 41.9k, False: 54.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  54.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   249k|    } else {  \
  |  |  |  |  |  |  149|   249k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   249k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 64.5k, False: 185k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  64.5k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  64.5k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  64.5k|{ \
  |  |  |  |  |  |  |  |   45|  64.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 7.77k, False: 56.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  7.77k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  7.77k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  56.7k|    } else { \
  |  |  |  |  |  |  |  |   49|  56.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  56.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  56.7k|    } \
  |  |  |  |  |  |  |  |   52|  64.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  64.5k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  64.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  64.5k|{ \
  |  |  |  |  |  |  |  |  128|  69.0k|    do { \
  |  |  |  |  |  |  |  |  129|  69.0k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 8.58k, False: 60.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  8.58k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  8.58k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  8.58k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  8.58k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  8.58k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  8.58k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  8.58k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  8.58k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.88k, False: 1.69k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.88k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.44k, False: 443]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.44k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.44k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.44k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.44k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    443|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    443|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    443|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    443|            } \
  |  |  |  |  |  |  |  |  |  |  118|  6.88k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.69k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.69k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.69k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.69k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  8.58k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  8.58k|        } \
  |  |  |  |  |  |  |  |  132|  69.0k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  69.0k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  69.0k|        ct--; \
  |  |  |  |  |  |  |  |  135|  69.0k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.50k, False: 64.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  64.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   185k|        } else { \
  |  |  |  |  |  |  154|   185k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   185k|        } \
  |  |  |  |  |  |  156|   249k|    } \
  |  |  |  |  |  |  157|   304k|}
  |  |  |  |  ------------------
  |  |  |  | 1126|   304k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 232k, False: 71.4k]
  |  |  |  |  ------------------
  |  |  |  | 1127|   304k|                    break; \
  |  |  |  | 1128|   304k|            } \
  |  |  |  | 1129|   539k|            { \
  |  |  |  | 1130|   306k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   306k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   306k|                                    ci); \
  |  |  |  | 1133|   306k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   306k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   306k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   306k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   306k|{ \
  |  |  |  |  |  |  140|   306k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   306k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   306k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   306k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   306k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   306k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 97.8k, False: 208k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  97.8k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  97.8k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  97.8k|{ \
  |  |  |  |  |  |  |  |   57|  97.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 6.84k, False: 90.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  6.84k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  6.84k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  6.84k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  90.9k|    } else { \
  |  |  |  |  |  |  |  |   62|  90.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  90.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  90.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  90.9k|    } \
  |  |  |  |  |  |  |  |   66|  97.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  97.8k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  97.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  97.8k|{ \
  |  |  |  |  |  |  |  |  128|   149k|    do { \
  |  |  |  |  |  |  |  |  129|   149k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.9k, False: 132k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 13.9k, False: 2.99k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.7k, False: 1.19k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.19k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.19k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.19k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.19k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.99k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.99k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.99k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.99k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.9k|        } \
  |  |  |  |  |  |  |  |  132|   149k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   149k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   149k|        ct--; \
  |  |  |  |  |  |  |  |  135|   149k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 51.1k, False: 97.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  97.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   208k|    } else {  \
  |  |  |  |  |  |  149|   208k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   208k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 103k, False: 105k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 4.32k, False: 99.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  4.32k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  4.32k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  99.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  99.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  99.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  99.0k|    } \
  |  |  |  |  |  |  |  |   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|   105k|    do { \
  |  |  |  |  |  |  |  |  129|   105k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 12.5k, False: 92.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  12.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  12.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  12.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  12.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  12.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  12.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  12.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  12.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.92k, False: 2.66k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  9.92k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.06k, False: 860]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.06k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.06k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.06k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.06k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    860|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    860|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    860|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    860|            } \
  |  |  |  |  |  |  |  |  |  |  118|  9.92k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.66k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.66k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.66k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.66k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  12.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  12.5k|        } \
  |  |  |  |  |  |  |  |  132|   105k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   105k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   105k|        ct--; \
  |  |  |  |  |  |  |  |  135|   105k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.03k, False: 103k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   103k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   105k|        } else { \
  |  |  |  |  |  |  154|   105k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   105k|        } \
  |  |  |  |  |  |  156|   208k|    } \
  |  |  |  |  |  |  157|   306k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   306k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   306k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 162k, False: 144k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   306k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   306k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   306k|{ \
  |  |  |  |  |  |  323|   306k|    /* east */ \
  |  |  |  |  |  |  324|   306k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   306k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   306k| \
  |  |  |  |  |  |  326|   306k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   306k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   306k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   306k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   306k| \
  |  |  |  |  |  |  329|   306k|    /* west */ \
  |  |  |  |  |  |  330|   306k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   306k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   306k| \
  |  |  |  |  |  |  332|   306k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   306k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   306k| \
  |  |  |  |  |  |  340|   306k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   306k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|   306k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   306k|            } \
  |  |  |  | 1139|   306k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   539k|    } \
  |  |  |  | 1141|   539k|}
  |  |  ------------------
  |  | 1289|   539k|                                            flags, flagsp, flags_stride, data, \
  |  | 1290|   539k|                                            l_w, 1, mqc, curctx, \
  |  | 1291|   539k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1292|   539k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   539k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1293|   539k|                        /* FALLTHRU */ \
  |  | 1294|   745k|                    case 2: \
  |  |  ------------------
  |  |  |  Branch (1294:21): [True: 206k, False: 718k]
  |  |  ------------------
  |  | 1295|   745k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1118|   745k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   745k|{ \
  |  |  |  | 1120|   745k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   745k|        do { \
  |  |  |  | 1122|   745k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [True: 539k, False: 206k]
  |  |  |  |  ------------------
  |  |  |  | 1123|   539k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|   539k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   539k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|   539k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   539k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   539k|{ \
  |  |  |  |  |  |  140|   539k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   539k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   539k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   539k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   539k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   539k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 77.8k, False: 461k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  77.8k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  77.8k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  77.8k|{ \
  |  |  |  |  |  |  |  |   57|  77.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 16.3k, False: 61.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  16.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  16.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  16.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  61.5k|    } else { \
  |  |  |  |  |  |  |  |   62|  61.5k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  61.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  61.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  61.5k|    } \
  |  |  |  |  |  |  |  |   66|  77.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  77.8k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  77.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  77.8k|{ \
  |  |  |  |  |  |  |  |  128|   136k|    do { \
  |  |  |  |  |  |  |  |  129|   136k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 15.6k, False: 121k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 13.3k, False: 2.26k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.5k, False: 829]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    829|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    829|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    829|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    829|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.26k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.26k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.26k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.26k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  15.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  15.6k|        } \
  |  |  |  |  |  |  |  |  132|   136k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   136k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   136k|        ct--; \
  |  |  |  |  |  |  |  |  135|   136k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 58.8k, False: 77.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  77.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   461k|    } else {  \
  |  |  |  |  |  |  149|   461k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   461k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 90.0k, False: 371k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  90.0k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  90.0k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  90.0k|{ \
  |  |  |  |  |  |  |  |   45|  90.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 10.8k, False: 79.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  10.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  10.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  79.1k|    } else { \
  |  |  |  |  |  |  |  |   49|  79.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  79.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  79.1k|    } \
  |  |  |  |  |  |  |  |   52|  90.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  90.0k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  90.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  90.0k|{ \
  |  |  |  |  |  |  |  |  128|  95.4k|    do { \
  |  |  |  |  |  |  |  |  129|  95.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 12.3k, False: 83.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 10.5k, False: 1.81k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  10.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.93k, False: 576]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.93k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.93k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.93k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.93k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    576|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    576|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    576|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    576|            } \
  |  |  |  |  |  |  |  |  |  |  118|  10.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.81k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.81k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.81k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.81k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  12.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  12.3k|        } \
  |  |  |  |  |  |  |  |  132|  95.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  95.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  95.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  95.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.39k, False: 90.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  90.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   371k|        } else { \
  |  |  |  |  |  |  154|   371k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   371k|        } \
  |  |  |  |  |  |  156|   461k|    } \
  |  |  |  |  |  |  157|   539k|}
  |  |  |  |  ------------------
  |  |  |  | 1126|   539k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 433k, False: 106k]
  |  |  |  |  ------------------
  |  |  |  | 1127|   539k|                    break; \
  |  |  |  | 1128|   539k|            } \
  |  |  |  | 1129|   745k|            { \
  |  |  |  | 1130|   312k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   312k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   312k|                                    ci); \
  |  |  |  | 1133|   312k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   312k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   312k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   312k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   312k|{ \
  |  |  |  |  |  |  140|   312k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   312k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   312k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   312k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   312k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   312k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 97.0k, False: 215k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  97.0k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  97.0k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  97.0k|{ \
  |  |  |  |  |  |  |  |   57|  97.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 10.0k, False: 87.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  10.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  10.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  10.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  87.0k|    } else { \
  |  |  |  |  |  |  |  |   62|  87.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  87.0k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  87.0k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  87.0k|    } \
  |  |  |  |  |  |  |  |   66|  97.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  97.0k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  97.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  97.0k|{ \
  |  |  |  |  |  |  |  |  128|   152k|    do { \
  |  |  |  |  |  |  |  |  129|   152k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 18.8k, False: 134k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  18.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  18.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  18.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  18.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  18.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  18.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  18.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  18.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 16.0k, False: 2.78k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  16.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 14.9k, False: 1.12k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  14.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  14.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  14.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  14.9k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.12k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.12k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.12k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.12k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  16.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.78k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.78k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.78k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.78k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  18.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  18.8k|        } \
  |  |  |  |  |  |  |  |  132|   152k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   152k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   152k|        ct--; \
  |  |  |  |  |  |  |  |  135|   152k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 55.8k, False: 97.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  97.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   215k|    } else {  \
  |  |  |  |  |  |  149|   215k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   215k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 106k, False: 108k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   106k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   106k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   106k|{ \
  |  |  |  |  |  |  |  |   45|   106k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 8.30k, False: 98.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  8.30k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  8.30k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  98.4k|    } else { \
  |  |  |  |  |  |  |  |   49|  98.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  98.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  98.4k|    } \
  |  |  |  |  |  |  |  |   52|   106k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   106k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   106k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   106k|{ \
  |  |  |  |  |  |  |  |  128|   110k|    do { \
  |  |  |  |  |  |  |  |  129|   110k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 14.2k, False: 96.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  14.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  14.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  14.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  14.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  14.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  14.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  14.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  14.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 11.9k, False: 2.32k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 11.3k, False: 624]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  11.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  11.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  11.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  11.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    624|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    624|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    624|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    624|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.32k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.32k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.32k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.32k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  14.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  14.2k|        } \
  |  |  |  |  |  |  |  |  132|   110k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   110k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   110k|        ct--; \
  |  |  |  |  |  |  |  |  135|   110k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 3.65k, False: 106k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   106k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   108k|        } else { \
  |  |  |  |  |  |  154|   108k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   108k|        } \
  |  |  |  |  |  |  156|   215k|    } \
  |  |  |  |  |  |  157|   312k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   312k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   312k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 163k, False: 149k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   312k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   312k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   312k|{ \
  |  |  |  |  |  |  323|   312k|    /* east */ \
  |  |  |  |  |  |  324|   312k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   312k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   312k| \
  |  |  |  |  |  |  326|   312k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   312k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   312k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   312k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   312k| \
  |  |  |  |  |  |  329|   312k|    /* west */ \
  |  |  |  |  |  |  330|   312k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   312k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   312k| \
  |  |  |  |  |  |  332|   312k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   312k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   312k| \
  |  |  |  |  |  |  340|   312k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   312k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|   312k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   312k|            } \
  |  |  |  | 1139|   312k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   745k|    } \
  |  |  |  | 1141|   745k|}
  |  |  ------------------
  |  | 1296|   745k|                                            flags, flagsp, flags_stride, data, \
  |  | 1297|   745k|                                            l_w, 2, mqc, curctx, \
  |  | 1298|   745k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1299|   745k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   745k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1300|   745k|                        /* FALLTHRU */ \
  |  | 1301|   925k|                    case 3: \
  |  |  ------------------
  |  |  |  Branch (1301:21): [True: 179k, False: 745k]
  |  |  ------------------
  |  | 1302|   925k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1118|   925k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   925k|{ \
  |  |  |  | 1120|   925k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   925k|        do { \
  |  |  |  | 1122|   925k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [True: 745k, False: 179k]
  |  |  |  |  ------------------
  |  |  |  | 1123|   745k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|   745k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   745k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|   745k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   745k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   745k|{ \
  |  |  |  |  |  |  140|   745k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   745k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   745k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   745k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   745k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   745k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 83.0k, False: 662k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  83.0k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  83.0k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  83.0k|{ \
  |  |  |  |  |  |  |  |   57|  83.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 17.3k, False: 65.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  17.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  17.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  17.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  65.7k|    } else { \
  |  |  |  |  |  |  |  |   62|  65.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  65.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  65.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  65.7k|    } \
  |  |  |  |  |  |  |  |   66|  83.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  83.0k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  83.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  83.0k|{ \
  |  |  |  |  |  |  |  |  128|   154k|    do { \
  |  |  |  |  |  |  |  |  129|   154k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 20.1k, False: 134k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  20.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  20.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  20.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  20.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  20.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  20.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  20.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  20.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 16.2k, False: 3.95k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  16.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 15.0k, False: 1.15k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  15.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  15.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  15.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  15.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.15k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.15k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.15k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.15k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  16.2k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.95k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.95k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.95k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.95k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  20.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  20.1k|        } \
  |  |  |  |  |  |  |  |  132|   154k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   154k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   154k|        ct--; \
  |  |  |  |  |  |  |  |  135|   154k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 71.4k, False: 83.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  83.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   662k|    } else {  \
  |  |  |  |  |  |  149|   662k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   662k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 96.5k, False: 566k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  96.5k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  96.5k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  96.5k|{ \
  |  |  |  |  |  |  |  |   45|  96.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 12.6k, False: 83.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  12.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  12.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  83.8k|    } else { \
  |  |  |  |  |  |  |  |   49|  83.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  83.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  83.8k|    } \
  |  |  |  |  |  |  |  |   52|  96.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  96.5k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  96.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  96.5k|{ \
  |  |  |  |  |  |  |  |  128|   103k|    do { \
  |  |  |  |  |  |  |  |  129|   103k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 13.1k, False: 90.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 11.3k, False: 1.81k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.5k, False: 806]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  10.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  10.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  10.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  10.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    806|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    806|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    806|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    806|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.81k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.81k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.81k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.81k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  13.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  13.1k|        } \
  |  |  |  |  |  |  |  |  132|   103k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   103k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   103k|        ct--; \
  |  |  |  |  |  |  |  |  135|   103k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 6.83k, False: 96.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  96.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   566k|        } else { \
  |  |  |  |  |  |  154|   566k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   566k|        } \
  |  |  |  |  |  |  156|   662k|    } \
  |  |  |  |  |  |  157|   745k|}
  |  |  |  |  ------------------
  |  |  |  | 1126|   745k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 622k, False: 123k]
  |  |  |  |  ------------------
  |  |  |  | 1127|   745k|                    break; \
  |  |  |  | 1128|   745k|            } \
  |  |  |  | 1129|   925k|            { \
  |  |  |  | 1130|   303k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   303k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   303k|                                    ci); \
  |  |  |  | 1133|   303k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   303k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   303k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   303k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   303k|{ \
  |  |  |  |  |  |  140|   303k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   303k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   303k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   303k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   303k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   303k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 93.5k, False: 209k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  93.5k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  93.5k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  93.5k|{ \
  |  |  |  |  |  |  |  |   57|  93.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 12.0k, False: 81.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  12.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  12.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  12.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  81.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  81.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  81.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  81.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  81.4k|    } \
  |  |  |  |  |  |  |  |   66|  93.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  93.5k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  93.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  93.5k|{ \
  |  |  |  |  |  |  |  |  128|   144k|    do { \
  |  |  |  |  |  |  |  |  129|   144k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 17.0k, False: 127k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 14.5k, False: 2.54k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  14.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.6k, False: 857]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  13.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  13.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  13.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  13.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    857|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    857|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    857|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    857|            } \
  |  |  |  |  |  |  |  |  |  |  118|  14.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.54k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.54k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.54k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.54k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  17.0k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  17.0k|        } \
  |  |  |  |  |  |  |  |  132|   144k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   144k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   144k|        ct--; \
  |  |  |  |  |  |  |  |  135|   144k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 51.1k, False: 93.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  93.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   209k|    } else {  \
  |  |  |  |  |  |  149|   209k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   209k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 104k, False: 105k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   104k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   104k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   104k|{ \
  |  |  |  |  |  |  |  |   45|   104k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 9.29k, False: 94.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  9.29k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  9.29k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  94.9k|    } else { \
  |  |  |  |  |  |  |  |   49|  94.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  94.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  94.9k|    } \
  |  |  |  |  |  |  |  |   52|   104k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   104k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   104k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   104k|{ \
  |  |  |  |  |  |  |  |  128|   108k|    do { \
  |  |  |  |  |  |  |  |  129|   108k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.3k, False: 92.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 11.8k, False: 4.49k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 11.1k, False: 716]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  11.1k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  11.1k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  11.1k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  11.1k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    716|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    716|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    716|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    716|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.49k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.49k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.49k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.49k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.3k|        } \
  |  |  |  |  |  |  |  |  132|   108k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   108k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   108k|        ct--; \
  |  |  |  |  |  |  |  |  135|   108k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.44k, False: 104k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   104k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   105k|        } else { \
  |  |  |  |  |  |  154|   105k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   105k|        } \
  |  |  |  |  |  |  156|   209k|    } \
  |  |  |  |  |  |  157|   303k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   303k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   303k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 159k, False: 143k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   303k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   303k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   303k|{ \
  |  |  |  |  |  |  323|   303k|    /* east */ \
  |  |  |  |  |  |  324|   303k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   303k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   303k| \
  |  |  |  |  |  |  326|   303k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   303k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   303k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   303k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   303k| \
  |  |  |  |  |  |  329|   303k|    /* west */ \
  |  |  |  |  |  |  330|   303k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   303k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   303k| \
  |  |  |  |  |  |  332|   303k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   303k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   303k| \
  |  |  |  |  |  |  340|   303k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   303k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|   303k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|   303k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   303k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   303k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|   303k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   303k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   303k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   303k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|   303k|    } \
  |  |  |  |  |  |  347|   303k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   303k|            } \
  |  |  |  | 1139|   303k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   925k|    } \
  |  |  |  | 1141|   925k|}
  |  |  ------------------
  |  | 1303|   925k|                                            flags, flagsp, flags_stride, data, \
  |  | 1304|   925k|                                            l_w, 3, mqc, curctx, \
  |  | 1305|   925k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1306|   925k|                        break; \
  |  | 1307|   925k|                } \
  |  | 1308|  43.6M|            } else { \
  |  | 1309|  43.6M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  43.6M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  43.6M|{ \
  |  |  |  | 1120|  43.6M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  43.6M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  43.6M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  43.6M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  43.6M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 10.5M, False: 33.1M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  10.5M|        do { \
  |  |  |  | 1122|  10.5M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  10.5M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  10.5M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  10.5M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  10.5M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  10.5M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  10.5M|{ \
  |  |  |  |  |  |  140|  10.5M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  10.5M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  10.5M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  10.5M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  10.5M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  10.5M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 2.26M, False: 8.25M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.26M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  2.26M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  2.26M|{ \
  |  |  |  |  |  |  |  |   57|  2.26M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 492k, False: 1.77M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   492k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   492k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   492k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.77M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.77M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.77M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.77M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.77M|    } \
  |  |  |  |  |  |  |  |   66|  2.26M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.26M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.26M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.26M|{ \
  |  |  |  |  |  |  |  |  128|  3.76M|    do { \
  |  |  |  |  |  |  |  |  129|  3.76M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 478k, False: 3.29M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   478k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   478k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   478k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   478k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   478k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   478k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   478k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   478k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 449k, False: 28.5k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   449k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 439k, False: 10.1k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   439k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   439k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   439k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   439k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  10.1k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  10.1k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  10.1k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  10.1k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   449k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  28.5k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  28.5k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  28.5k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  28.5k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   478k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   478k|        } \
  |  |  |  |  |  |  |  |  132|  3.76M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.76M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.76M|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.76M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.50M, False: 2.26M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.26M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  8.25M|    } else {  \
  |  |  |  |  |  |  149|  8.25M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  8.25M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.40M, False: 5.85M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.40M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.40M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.40M|{ \
  |  |  |  |  |  |  |  |   45|  2.40M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 369k, False: 2.03M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   369k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   369k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  2.03M|    } else { \
  |  |  |  |  |  |  |  |   49|  2.03M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  2.03M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  2.03M|    } \
  |  |  |  |  |  |  |  |   52|  2.40M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.40M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.40M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.40M|{ \
  |  |  |  |  |  |  |  |  128|  2.56M|    do { \
  |  |  |  |  |  |  |  |  129|  2.56M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 321k, False: 2.24M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   321k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   321k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   321k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   321k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   321k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   321k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   321k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   321k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 300k, False: 21.2k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   300k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 294k, False: 5.80k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   294k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   294k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   294k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   294k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  5.80k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  5.80k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  5.80k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  5.80k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   300k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  21.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  21.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  21.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  21.2k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   321k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   321k|        } \
  |  |  |  |  |  |  |  |  132|  2.56M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.56M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.56M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.56M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 164k, False: 2.40M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.40M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  5.85M|        } else { \
  |  |  |  |  |  |  154|  5.85M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  5.85M|        } \
  |  |  |  |  |  |  156|  8.25M|    } \
  |  |  |  |  |  |  157|  10.5M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  10.5M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 5.96M, False: 4.56M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  10.5M|                    break; \
  |  |  |  | 1128|  10.5M|            } \
  |  |  |  | 1129|  10.5M|            { \
  |  |  |  | 1130|  4.56M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  4.56M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  4.56M|                                    ci); \
  |  |  |  | 1133|  4.56M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  4.56M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  4.56M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.56M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.56M|{ \
  |  |  |  |  |  |  140|  4.56M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.56M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.56M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.56M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.56M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.56M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.19M, False: 3.37M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.19M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.19M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.19M|{ \
  |  |  |  |  |  |  |  |   57|  1.19M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 258k, False: 936k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   258k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   258k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   258k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   936k|    } else { \
  |  |  |  |  |  |  |  |   62|   936k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   936k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   936k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   936k|    } \
  |  |  |  |  |  |  |  |   66|  1.19M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.19M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.19M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.19M|{ \
  |  |  |  |  |  |  |  |  128|  1.91M|    do { \
  |  |  |  |  |  |  |  |  129|  1.91M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 241k, False: 1.67M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   241k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   241k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   241k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   241k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   241k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   241k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   241k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   241k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 229k, False: 12.2k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   229k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 225k, False: 4.32k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   225k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   225k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   225k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   225k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  4.32k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  4.32k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  4.32k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  4.32k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   229k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  12.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  12.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  12.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  12.2k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   241k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   241k|        } \
  |  |  |  |  |  |  |  |  132|  1.91M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.91M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.91M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.91M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 717k, False: 1.19M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.19M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.37M|    } else {  \
  |  |  |  |  |  |  149|  3.37M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.37M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.26M, False: 2.11M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.26M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.26M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.26M|{ \
  |  |  |  |  |  |  |  |   45|  1.26M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 206k, False: 1.05M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   206k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   206k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.05M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.05M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.05M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.05M|    } \
  |  |  |  |  |  |  |  |   52|  1.26M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.26M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.26M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.26M|{ \
  |  |  |  |  |  |  |  |  128|  1.35M|    do { \
  |  |  |  |  |  |  |  |  129|  1.35M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 165k, False: 1.18M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   165k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   165k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   165k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   165k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   165k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   165k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   165k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   165k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 157k, False: 8.06k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   157k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 153k, False: 3.28k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   153k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   153k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   153k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   153k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.28k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.28k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.28k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.28k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   157k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  8.06k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  8.06k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  8.06k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  8.06k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   165k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   165k|        } \
  |  |  |  |  |  |  |  |  132|  1.35M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.35M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.35M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.35M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 89.1k, False: 1.26M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.26M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.11M|        } else { \
  |  |  |  |  |  |  154|  2.11M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.11M|        } \
  |  |  |  |  |  |  156|  3.37M|    } \
  |  |  |  |  |  |  157|  4.56M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  4.56M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  4.56M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 2.27M, False: 2.29M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  4.56M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  4.56M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  4.56M|{ \
  |  |  |  |  |  |  323|  4.56M|    /* east */ \
  |  |  |  |  |  |  324|  4.56M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.56M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  4.56M| \
  |  |  |  |  |  |  326|  4.56M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  4.56M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.56M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.56M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.56M| \
  |  |  |  |  |  |  329|  4.56M|    /* west */ \
  |  |  |  |  |  |  330|  4.56M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.56M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.56M| \
  |  |  |  |  |  |  332|  4.56M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  4.56M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  4.56M| \
  |  |  |  |  |  |  340|  4.56M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  4.56M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  4.56M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  4.56M|            } \
  |  |  |  | 1139|  4.56M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  10.5M|    } \
  |  |  |  | 1141|  43.6M|}
  |  |  ------------------
  |  | 1310|  43.6M|                                    flags, flagsp, flags_stride, data, \
  |  | 1311|  43.6M|                                    l_w, 0, mqc, curctx, \
  |  | 1312|  43.6M|                                    v, a, c, ct, oneplushalf, vsc); \
  |  | 1313|  43.6M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  43.6M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  43.6M|{ \
  |  |  |  | 1120|  43.6M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  43.6M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  43.6M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  43.6M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  43.6M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 10.5M, False: 33.1M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  10.5M|        do { \
  |  |  |  | 1122|  10.5M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  10.5M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  10.5M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  10.5M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  10.5M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  10.5M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  10.5M|{ \
  |  |  |  |  |  |  140|  10.5M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  10.5M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  10.5M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  10.5M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  10.5M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  10.5M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 2.21M, False: 8.30M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.21M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  2.21M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  2.21M|{ \
  |  |  |  |  |  |  |  |   57|  2.21M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 455k, False: 1.76M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   455k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   455k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   455k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.76M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.76M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.76M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.76M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.76M|    } \
  |  |  |  |  |  |  |  |   66|  2.21M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.21M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.21M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.21M|{ \
  |  |  |  |  |  |  |  |  128|  3.72M|    do { \
  |  |  |  |  |  |  |  |  129|  3.72M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 459k, False: 3.26M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   459k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   459k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   459k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   459k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   459k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   459k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   459k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   459k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 432k, False: 26.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   432k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 423k, False: 8.51k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   423k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   423k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   423k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   423k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  8.51k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  8.51k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  8.51k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  8.51k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   432k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  26.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  26.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  26.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  26.6k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   459k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   459k|        } \
  |  |  |  |  |  |  |  |  132|  3.72M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.72M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.72M|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.72M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.50M, False: 2.21M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.21M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  8.30M|    } else {  \
  |  |  |  |  |  |  149|  8.30M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  8.30M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.36M, False: 5.93M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.36M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.36M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.36M|{ \
  |  |  |  |  |  |  |  |   45|  2.36M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 355k, False: 2.01M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   355k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   355k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  2.01M|    } else { \
  |  |  |  |  |  |  |  |   49|  2.01M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  2.01M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  2.01M|    } \
  |  |  |  |  |  |  |  |   52|  2.36M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.36M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.36M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.36M|{ \
  |  |  |  |  |  |  |  |  128|  2.52M|    do { \
  |  |  |  |  |  |  |  |  129|  2.52M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 327k, False: 2.20M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   327k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   327k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   327k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   327k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   327k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   327k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   327k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   327k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 301k, False: 25.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   301k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 292k, False: 9.23k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   292k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   292k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   292k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   292k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  9.23k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  9.23k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  9.23k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  9.23k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   301k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  25.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  25.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  25.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  25.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   327k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   327k|        } \
  |  |  |  |  |  |  |  |  132|  2.52M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.52M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.52M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.52M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 160k, False: 2.36M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.36M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  5.93M|        } else { \
  |  |  |  |  |  |  154|  5.93M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  5.93M|        } \
  |  |  |  |  |  |  156|  8.30M|    } \
  |  |  |  |  |  |  157|  10.5M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  10.5M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 5.98M, False: 4.53M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  10.5M|                    break; \
  |  |  |  | 1128|  10.5M|            } \
  |  |  |  | 1129|  10.5M|            { \
  |  |  |  | 1130|  4.53M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  4.53M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  4.53M|                                    ci); \
  |  |  |  | 1133|  4.53M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  4.53M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  4.53M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.53M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.53M|{ \
  |  |  |  |  |  |  140|  4.53M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.53M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.53M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.53M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.53M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.53M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.20M, False: 3.33M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.20M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.20M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.20M|{ \
  |  |  |  |  |  |  |  |   57|  1.20M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 271k, False: 932k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   271k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   271k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   271k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   932k|    } else { \
  |  |  |  |  |  |  |  |   62|   932k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   932k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   932k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   932k|    } \
  |  |  |  |  |  |  |  |   66|  1.20M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.20M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.20M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.20M|{ \
  |  |  |  |  |  |  |  |  128|  1.91M|    do { \
  |  |  |  |  |  |  |  |  129|  1.91M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 243k, False: 1.67M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   243k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   243k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   243k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   243k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   243k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   243k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   243k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   243k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 228k, False: 14.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   228k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 223k, False: 4.51k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   223k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   223k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   223k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   223k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  4.51k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  4.51k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  4.51k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  4.51k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   228k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  14.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  14.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  14.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  14.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   243k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   243k|        } \
  |  |  |  |  |  |  |  |  132|  1.91M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.91M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.91M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.91M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 713k, False: 1.20M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.20M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.33M|    } else {  \
  |  |  |  |  |  |  149|  3.33M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.33M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.24M, False: 2.08M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.24M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.24M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.24M|{ \
  |  |  |  |  |  |  |  |   45|  1.24M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 206k, False: 1.03M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   206k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   206k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.03M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.03M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.03M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.03M|    } \
  |  |  |  |  |  |  |  |   52|  1.24M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.24M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.24M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.24M|{ \
  |  |  |  |  |  |  |  |  128|  1.33M|    do { \
  |  |  |  |  |  |  |  |  129|  1.33M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 164k, False: 1.17M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   164k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   164k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   164k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   164k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   164k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   164k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   164k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   164k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 156k, False: 8.10k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   156k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 152k, False: 3.84k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   152k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   152k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   152k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   152k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.84k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.84k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.84k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.84k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   156k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  8.10k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  8.10k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  8.10k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  8.10k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   164k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   164k|        } \
  |  |  |  |  |  |  |  |  132|  1.33M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.33M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.33M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.33M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 93.4k, False: 1.24M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.24M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.08M|        } else { \
  |  |  |  |  |  |  154|  2.08M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.08M|        } \
  |  |  |  |  |  |  156|  3.33M|    } \
  |  |  |  |  |  |  157|  4.53M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  4.53M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  4.53M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 2.27M, False: 2.26M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  4.53M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  4.53M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  4.53M|{ \
  |  |  |  |  |  |  323|  4.53M|    /* east */ \
  |  |  |  |  |  |  324|  4.53M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.53M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  4.53M| \
  |  |  |  |  |  |  326|  4.53M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  4.53M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.53M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.53M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.53M| \
  |  |  |  |  |  |  329|  4.53M|    /* west */ \
  |  |  |  |  |  |  330|  4.53M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.53M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.53M| \
  |  |  |  |  |  |  332|  4.53M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  4.53M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  4.53M| \
  |  |  |  |  |  |  340|  4.53M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  4.53M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  4.53M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  4.53M|            } \
  |  |  |  | 1139|  4.53M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  10.5M|    } \
  |  |  |  | 1141|  43.6M|}
  |  |  ------------------
  |  | 1314|  43.6M|                                    flags, flagsp, flags_stride, data, \
  |  | 1315|  43.6M|                                    l_w, 1, mqc, curctx, \
  |  | 1316|  43.6M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1317|  43.6M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  43.6M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  43.6M|{ \
  |  |  |  | 1120|  43.6M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  43.6M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  43.6M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  43.6M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  43.6M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 10.6M, False: 33.0M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  10.6M|        do { \
  |  |  |  | 1122|  10.6M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  10.6M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  10.6M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  10.6M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  10.6M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  10.6M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  10.6M|{ \
  |  |  |  |  |  |  140|  10.6M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  10.6M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  10.6M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  10.6M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  10.6M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  10.6M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 2.12M, False: 8.48M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.12M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  2.12M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  2.12M|{ \
  |  |  |  |  |  |  |  |   57|  2.12M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 429k, False: 1.69M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   429k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   429k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   429k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.69M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.69M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.69M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.69M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.69M|    } \
  |  |  |  |  |  |  |  |   66|  2.12M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.12M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.12M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.12M|{ \
  |  |  |  |  |  |  |  |  128|  3.60M|    do { \
  |  |  |  |  |  |  |  |  129|  3.60M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 451k, False: 3.15M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   451k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   451k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   451k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   451k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   451k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   451k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   451k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   451k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 421k, False: 29.9k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   421k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 410k, False: 10.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   410k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   410k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   410k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   410k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  10.8k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  10.8k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  10.8k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  10.8k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   421k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  29.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  29.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  29.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  29.9k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   451k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   451k|        } \
  |  |  |  |  |  |  |  |  132|  3.60M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.60M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.60M|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.60M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.47M, False: 2.12M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.12M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  8.48M|    } else {  \
  |  |  |  |  |  |  149|  8.48M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  8.48M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.28M, False: 6.20M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.28M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.28M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.28M|{ \
  |  |  |  |  |  |  |  |   45|  2.28M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 334k, False: 1.94M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   334k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   334k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.94M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.94M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.94M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.94M|    } \
  |  |  |  |  |  |  |  |   52|  2.28M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.28M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.28M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.28M|{ \
  |  |  |  |  |  |  |  |  128|  2.43M|    do { \
  |  |  |  |  |  |  |  |  129|  2.43M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 308k, False: 2.12M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   308k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   308k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   308k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   308k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   308k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   308k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   308k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   308k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 290k, False: 18.0k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   290k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 283k, False: 6.84k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   283k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   283k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   283k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   283k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  6.84k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  6.84k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  6.84k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  6.84k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   290k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  18.0k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  18.0k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  18.0k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  18.0k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   308k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   308k|        } \
  |  |  |  |  |  |  |  |  132|  2.43M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.43M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.43M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.43M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 154k, False: 2.28M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.28M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  6.20M|        } else { \
  |  |  |  |  |  |  154|  6.20M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  6.20M|        } \
  |  |  |  |  |  |  156|  8.48M|    } \
  |  |  |  |  |  |  157|  10.6M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  10.6M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 6.19M, False: 4.41M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  10.6M|                    break; \
  |  |  |  | 1128|  10.6M|            } \
  |  |  |  | 1129|  10.6M|            { \
  |  |  |  | 1130|  4.41M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  4.41M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  4.41M|                                    ci); \
  |  |  |  | 1133|  4.41M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  4.41M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  4.41M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.41M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.41M|{ \
  |  |  |  |  |  |  140|  4.41M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.41M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.41M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.41M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.41M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.41M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.17M, False: 3.23M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.17M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.17M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.17M|{ \
  |  |  |  |  |  |  |  |   57|  1.17M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 257k, False: 922k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   257k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   257k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   257k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   922k|    } else { \
  |  |  |  |  |  |  |  |   62|   922k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   922k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   922k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   922k|    } \
  |  |  |  |  |  |  |  |   66|  1.17M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.17M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.17M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.17M|{ \
  |  |  |  |  |  |  |  |  128|  1.88M|    do { \
  |  |  |  |  |  |  |  |  129|  1.88M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 244k, False: 1.63M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   244k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   244k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   244k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   244k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   244k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   244k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   244k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   244k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 223k, False: 20.4k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   223k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 219k, False: 4.11k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   219k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   219k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   219k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   219k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  4.11k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  4.11k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  4.11k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  4.11k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   223k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  20.4k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  20.4k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  20.4k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  20.4k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   244k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   244k|        } \
  |  |  |  |  |  |  |  |  132|  1.88M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.88M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.88M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.88M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 703k, False: 1.17M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.17M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.23M|    } else {  \
  |  |  |  |  |  |  149|  3.23M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.23M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.21M, False: 2.02M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.21M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.21M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.21M|{ \
  |  |  |  |  |  |  |  |   45|  1.21M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 209k, False: 1.00M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   209k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   209k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.00M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.00M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.00M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.00M|    } \
  |  |  |  |  |  |  |  |   52|  1.21M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.21M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.21M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.21M|{ \
  |  |  |  |  |  |  |  |  128|  1.31M|    do { \
  |  |  |  |  |  |  |  |  129|  1.31M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 164k, False: 1.15M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   164k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   164k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   164k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   164k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   164k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   164k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   164k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   164k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 155k, False: 8.58k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   155k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 152k, False: 3.05k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   152k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   152k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   152k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   152k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.05k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.05k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.05k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.05k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   155k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  8.58k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  8.58k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  8.58k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  8.58k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   164k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   164k|        } \
  |  |  |  |  |  |  |  |  132|  1.31M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.31M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.31M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.31M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 97.7k, False: 1.21M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.21M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.02M|        } else { \
  |  |  |  |  |  |  154|  2.02M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.02M|        } \
  |  |  |  |  |  |  156|  3.23M|    } \
  |  |  |  |  |  |  157|  4.41M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  4.41M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  4.41M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 2.22M, False: 2.19M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  4.41M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  4.41M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  4.41M|{ \
  |  |  |  |  |  |  323|  4.41M|    /* east */ \
  |  |  |  |  |  |  324|  4.41M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.41M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  4.41M| \
  |  |  |  |  |  |  326|  4.41M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  4.41M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.41M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.41M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.41M| \
  |  |  |  |  |  |  329|  4.41M|    /* west */ \
  |  |  |  |  |  |  330|  4.41M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.41M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.41M| \
  |  |  |  |  |  |  332|  4.41M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  4.41M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  4.41M| \
  |  |  |  |  |  |  340|  4.41M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  4.41M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  4.41M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  4.41M|            } \
  |  |  |  | 1139|  4.41M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  10.6M|    } \
  |  |  |  | 1141|  43.6M|}
  |  |  ------------------
  |  | 1318|  43.6M|                                    flags, flagsp, flags_stride, data, \
  |  | 1319|  43.6M|                                    l_w, 2, mqc, curctx, \
  |  | 1320|  43.6M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1321|  43.6M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  43.6M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  43.6M|{ \
  |  |  |  | 1120|  43.6M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  43.6M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  43.6M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  43.6M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  43.6M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 10.8M, False: 32.7M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  10.8M|        do { \
  |  |  |  | 1122|  10.8M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  10.8M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  10.8M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  10.8M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  10.8M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  10.8M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  10.8M|{ \
  |  |  |  |  |  |  140|  10.8M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  10.8M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  10.8M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  10.8M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  10.8M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  10.8M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.95M, False: 8.93M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.95M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.95M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.95M|{ \
  |  |  |  |  |  |  |  |   57|  1.95M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 367k, False: 1.58M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   367k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   367k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   367k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.58M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.58M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.58M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.58M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.58M|    } \
  |  |  |  |  |  |  |  |   66|  1.95M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.95M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.95M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.95M|{ \
  |  |  |  |  |  |  |  |  128|  3.39M|    do { \
  |  |  |  |  |  |  |  |  129|  3.39M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 417k, False: 2.97M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   417k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   417k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   417k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   417k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   417k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   417k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   417k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   417k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 397k, False: 19.9k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   397k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 390k, False: 7.46k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   390k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   390k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   390k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   390k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  7.46k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  7.46k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  7.46k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  7.46k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   397k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  19.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  19.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  19.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  19.9k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   417k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   417k|        } \
  |  |  |  |  |  |  |  |  132|  3.39M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.39M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.39M|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.39M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.43M, False: 1.95M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.95M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  8.93M|    } else {  \
  |  |  |  |  |  |  149|  8.93M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  8.93M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.12M, False: 6.80M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.12M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.12M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.12M|{ \
  |  |  |  |  |  |  |  |   45|  2.12M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 296k, False: 1.83M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   296k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   296k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.83M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.83M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.83M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.83M|    } \
  |  |  |  |  |  |  |  |   52|  2.12M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.12M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.12M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.12M|{ \
  |  |  |  |  |  |  |  |  128|  2.26M|    do { \
  |  |  |  |  |  |  |  |  129|  2.26M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 281k, False: 1.98M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   281k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   281k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   281k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   281k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   281k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   281k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   281k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   281k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 267k, False: 13.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   267k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 263k, False: 4.50k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   263k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   263k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   263k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   263k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  4.50k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  4.50k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  4.50k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  4.50k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   267k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  13.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  13.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  13.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  13.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   281k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   281k|        } \
  |  |  |  |  |  |  |  |  132|  2.26M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.26M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.26M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.26M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 135k, False: 2.12M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.12M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  6.80M|        } else { \
  |  |  |  |  |  |  154|  6.80M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  6.80M|        } \
  |  |  |  |  |  |  156|  8.93M|    } \
  |  |  |  |  |  |  157|  10.8M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  10.8M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 6.68M, False: 4.20M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  10.8M|                    break; \
  |  |  |  | 1128|  10.8M|            } \
  |  |  |  | 1129|  10.8M|            { \
  |  |  |  | 1130|  4.20M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  4.20M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  4.20M|                                    ci); \
  |  |  |  | 1133|  4.20M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  4.20M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  4.20M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.20M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.20M|{ \
  |  |  |  |  |  |  140|  4.20M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.20M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.20M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.20M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.20M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.20M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.10M, False: 3.09M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.10M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.10M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.10M|{ \
  |  |  |  |  |  |  |  |   57|  1.10M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 254k, False: 848k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   254k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   254k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   254k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   848k|    } else { \
  |  |  |  |  |  |  |  |   62|   848k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   848k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   848k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   848k|    } \
  |  |  |  |  |  |  |  |   66|  1.10M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.10M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.10M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.10M|{ \
  |  |  |  |  |  |  |  |  128|  1.75M|    do { \
  |  |  |  |  |  |  |  |  129|  1.75M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 221k, False: 1.53M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   221k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   221k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   221k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   221k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   221k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   221k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   221k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   221k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 209k, False: 11.2k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   209k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 206k, False: 3.72k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   206k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   206k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   206k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   206k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.72k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.72k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.72k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.72k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   209k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  11.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  11.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  11.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  11.2k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   221k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   221k|        } \
  |  |  |  |  |  |  |  |  132|  1.75M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.75M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.75M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.75M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 648k, False: 1.10M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.10M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.09M|    } else {  \
  |  |  |  |  |  |  149|  3.09M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.09M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.15M, False: 1.94M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.15M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.15M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.15M|{ \
  |  |  |  |  |  |  |  |   45|  1.15M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 203k, False: 949k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   203k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   203k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   949k|    } else { \
  |  |  |  |  |  |  |  |   49|   949k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   949k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   949k|    } \
  |  |  |  |  |  |  |  |   52|  1.15M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.15M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.15M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.15M|{ \
  |  |  |  |  |  |  |  |  128|  1.24M|    do { \
  |  |  |  |  |  |  |  |  129|  1.24M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 152k, False: 1.08M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   152k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   152k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   152k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   152k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   152k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   152k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   152k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   152k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 145k, False: 7.25k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   145k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 142k, False: 2.56k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   142k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   142k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   142k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   142k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.56k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.56k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.56k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.56k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   145k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.25k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.25k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.25k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.25k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   152k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   152k|        } \
  |  |  |  |  |  |  |  |  132|  1.24M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.24M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.24M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.24M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 89.6k, False: 1.15M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.15M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.94M|        } else { \
  |  |  |  |  |  |  154|  1.94M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.94M|        } \
  |  |  |  |  |  |  156|  3.09M|    } \
  |  |  |  |  |  |  157|  4.20M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  4.20M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  4.20M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 2.09M, False: 2.10M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  4.20M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  4.20M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  4.20M|{ \
  |  |  |  |  |  |  323|  4.20M|    /* east */ \
  |  |  |  |  |  |  324|  4.20M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.20M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  4.20M| \
  |  |  |  |  |  |  326|  4.20M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  4.20M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.20M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.20M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.20M| \
  |  |  |  |  |  |  329|  4.20M|    /* west */ \
  |  |  |  |  |  |  330|  4.20M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.20M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.20M| \
  |  |  |  |  |  |  332|  4.20M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  4.20M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  4.20M| \
  |  |  |  |  |  |  340|  4.20M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  4.20M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|  4.20M|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|  4.20M|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  4.20M|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  4.20M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  4.20M|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  4.20M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  4.20M|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  4.20M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|  4.20M|    } \
  |  |  |  |  |  |  347|  4.20M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  4.20M|            } \
  |  |  |  | 1139|  4.20M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  10.8M|    } \
  |  |  |  | 1141|  43.6M|}
  |  |  ------------------
  |  | 1322|  43.6M|                                    flags, flagsp, flags_stride, data, \
  |  | 1323|  43.6M|                                    l_w, 3, mqc, curctx, \
  |  | 1324|  43.6M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1325|  43.6M|            } \
  |  | 1326|  59.4M|            *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  44.5M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  44.5M|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  44.5M|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  44.5M|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1327|  44.5M|        } \
  |  | 1328|   928k|    } \
  |  | 1329|  58.0k|    UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  58.0k|        mqc->curctx = curctx; \
  |  |  |  |  167|  58.0k|        mqc->c = c; \
  |  |  |  |  168|  58.0k|        mqc->a = a; \
  |  |  |  |  169|  58.0k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1330|  58.0k|    if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1330:9): [True: 0, False: 58.0k]
  |  |  ------------------
  |  | 1331|      0|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) { \
  |  |  ------------------
  |  |  |  Branch (1331:21): [True: 0, False: 0]
  |  |  ------------------
  |  | 1332|      0|            for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1332:25): [True: 0, False: 0]
  |  |  ------------------
  |  | 1333|      0|                opj_t1_dec_clnpass_step(t1, flagsp, data + j * l_w, oneplushalf, j, vsc); \
  |  | 1334|      0|            } \
  |  | 1335|      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)
  |  |  ------------------
  |  | 1336|      0|        } \
  |  | 1337|      0|    } \
  |  | 1338|  58.0k|}
  ------------------
 1373|  58.0k|}
t1.c:opj_t1_dec_clnpass_step:
 1150|  8.19M|{
 1151|  8.19M|    OPJ_UINT32 v;
 1152|       |
 1153|  8.19M|    opj_mqc_t *mqc = &(t1->mqc);   /* MQC component */
 1154|  8.19M|    opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE,
  ------------------
  |  | 1118|  8.19M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  | 1119|  8.19M|{ \
  |  | 1120|  8.19M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  ------------------
  |  |  |  |  153|  8.19M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  8.19M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  ------------------
  |  |  |  |  163|  8.19M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  8.19M|#define T1_PI_0     (1U << 21)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  Branch (1120:26): [True: 2.90M, False: 5.28M]
  |  |  ------------------
  |  | 1121|  2.90M|        do { \
  |  | 1122|  2.90M|            if( !partial ) { \
  |  |  ------------------
  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  ------------------
  |  | 1123|  2.90M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  | 1124|  2.90M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  ------------------
  |  |  |  |   62|  2.90M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1125|  2.90M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  2.90M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  2.90M|{ \
  |  |  |  |  140|  2.90M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  2.90M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  2.90M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  2.90M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  2.90M|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  2.90M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 214k, False: 2.69M]
  |  |  |  |  ------------------
  |  |  |  |  146|   214k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   214k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   214k|{ \
  |  |  |  |  |  |   57|   214k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 40.9k, False: 174k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  40.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  40.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  40.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   174k|    } else { \
  |  |  |  |  |  |   62|   174k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   174k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   174k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   174k|    } \
  |  |  |  |  |  |   66|   214k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   214k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   214k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   214k|{ \
  |  |  |  |  |  |  128|   400k|    do { \
  |  |  |  |  |  |  129|   400k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 50.7k, False: 349k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  50.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  50.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  50.7k|{ \
  |  |  |  |  |  |  |  |  104|  50.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  50.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  50.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  50.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  50.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 39.7k, False: 10.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  39.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 36.5k, False: 3.18k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  36.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  36.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  36.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  36.5k|            } else { \
  |  |  |  |  |  |  |  |  114|  3.18k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  3.18k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  3.18k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  3.18k|            } \
  |  |  |  |  |  |  |  |  118|  39.7k|        } else { \
  |  |  |  |  |  |  |  |  119|  10.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  10.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  10.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  10.9k|        } \
  |  |  |  |  |  |  |  |  123|  50.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  50.7k|        } \
  |  |  |  |  |  |  132|   400k|        a <<= 1; \
  |  |  |  |  |  |  133|   400k|        c <<= 1; \
  |  |  |  |  |  |  134|   400k|        ct--; \
  |  |  |  |  |  |  135|   400k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 185k, False: 214k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   214k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  2.69M|    } else {  \
  |  |  |  |  149|  2.69M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  2.69M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 238k, False: 2.45M]
  |  |  |  |  ------------------
  |  |  |  |  151|   238k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   238k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   238k|{ \
  |  |  |  |  |  |   45|   238k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 31.7k, False: 206k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  31.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  31.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   206k|    } else { \
  |  |  |  |  |  |   49|   206k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   206k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   206k|    } \
  |  |  |  |  |  |   52|   238k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   238k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   238k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   238k|{ \
  |  |  |  |  |  |  128|   252k|    do { \
  |  |  |  |  |  |  129|   252k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 33.5k, False: 218k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  33.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  33.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  33.5k|{ \
  |  |  |  |  |  |  |  |  104|  33.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  33.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  33.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  33.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  33.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 26.4k, False: 7.08k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  26.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 24.7k, False: 1.71k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  24.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  24.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  24.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  24.7k|            } else { \
  |  |  |  |  |  |  |  |  114|  1.71k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  1.71k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  1.71k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  1.71k|            } \
  |  |  |  |  |  |  |  |  118|  26.4k|        } else { \
  |  |  |  |  |  |  |  |  119|  7.08k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  7.08k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  7.08k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  7.08k|        } \
  |  |  |  |  |  |  |  |  123|  33.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  33.5k|        } \
  |  |  |  |  |  |  132|   252k|        a <<= 1; \
  |  |  |  |  |  |  133|   252k|        c <<= 1; \
  |  |  |  |  |  |  134|   252k|        ct--; \
  |  |  |  |  |  |  135|   252k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 14.0k, False: 238k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   238k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  2.45M|        } else { \
  |  |  |  |  154|  2.45M|            d = (*curctx)->mps; \
  |  |  |  |  155|  2.45M|        } \
  |  |  |  |  156|  2.69M|    } \
  |  |  |  |  157|  2.90M|}
  |  |  ------------------
  |  | 1126|  2.90M|                if( !v ) \
  |  |  ------------------
  |  |  |  Branch (1126:21): [True: 2.53M, False: 374k]
  |  |  ------------------
  |  | 1127|  2.90M|                    break; \
  |  | 1128|  2.90M|            } \
  |  | 1129|  2.90M|            { \
  |  | 1130|   374k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  | 1131|   374k|                                    flags, flagsp[-1], flagsp[1], \
  |  | 1132|   374k|                                    ci); \
  |  | 1133|   374k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  ------------------
  |  |  |  |   62|   374k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1134|   374k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   374k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   374k|{ \
  |  |  |  |  140|   374k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   374k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   374k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   374k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   374k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   374k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 100k, False: 273k]
  |  |  |  |  ------------------
  |  |  |  |  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: 24.9k, False: 75.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  24.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  24.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  24.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  75.5k|    } else { \
  |  |  |  |  |  |   62|  75.5k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  75.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  75.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  75.5k|    } \
  |  |  |  |  |  |   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|   157k|    do { \
  |  |  |  |  |  |  129|   157k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 19.4k, False: 138k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 15.8k, False: 3.50k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  15.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 14.9k, False: 934]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  14.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  14.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  14.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  14.9k|            } else { \
  |  |  |  |  |  |  |  |  114|    934|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    934|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    934|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    934|            } \
  |  |  |  |  |  |  |  |  118|  15.8k|        } else { \
  |  |  |  |  |  |  |  |  119|  3.50k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  3.50k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  3.50k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  3.50k|        } \
  |  |  |  |  |  |  |  |  123|  19.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  19.4k|        } \
  |  |  |  |  |  |  132|   157k|        a <<= 1; \
  |  |  |  |  |  |  133|   157k|        c <<= 1; \
  |  |  |  |  |  |  134|   157k|        ct--; \
  |  |  |  |  |  |  135|   157k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 57.2k, False: 100k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   100k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   273k|    } else {  \
  |  |  |  |  149|   273k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   273k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 101k, False: 171k]
  |  |  |  |  ------------------
  |  |  |  |  151|   101k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   101k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   101k|{ \
  |  |  |  |  |  |   45|   101k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 18.6k, False: 83.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  18.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  18.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  83.2k|    } else { \
  |  |  |  |  |  |   49|  83.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  83.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  83.2k|    } \
  |  |  |  |  |  |   52|   101k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   101k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   101k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   101k|{ \
  |  |  |  |  |  |  128|   110k|    do { \
  |  |  |  |  |  |  129|   110k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 13.7k, False: 97.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 11.2k, False: 2.54k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  11.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.6k, False: 635]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  10.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  10.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  10.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  10.6k|            } else { \
  |  |  |  |  |  |  |  |  114|    635|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    635|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    635|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    635|            } \
  |  |  |  |  |  |  |  |  118|  11.2k|        } else { \
  |  |  |  |  |  |  |  |  119|  2.54k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  2.54k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  2.54k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  2.54k|        } \
  |  |  |  |  |  |  |  |  123|  13.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  13.7k|        } \
  |  |  |  |  |  |  132|   110k|        a <<= 1; \
  |  |  |  |  |  |  133|   110k|        c <<= 1; \
  |  |  |  |  |  |  134|   110k|        ct--; \
  |  |  |  |  |  |  135|   110k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 8.86k, False: 101k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   101k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   171k|        } else { \
  |  |  |  |  154|   171k|            d = (*curctx)->mps; \
  |  |  |  |  155|   171k|        } \
  |  |  |  |  156|   273k|    } \
  |  |  |  |  157|   374k|}
  |  |  ------------------
  |  | 1135|   374k|                v = v ^ opj_t1_getspb(lu); \
  |  | 1136|   374k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  ------------------
  |  |  |  Branch (1136:40): [True: 180k, False: 193k]
  |  |  ------------------
  |  | 1137|   374k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  ------------------
  |  |  |  |  321|   374k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  322|   374k|{ \
  |  |  |  |  323|   374k|    /* east */ \
  |  |  |  |  324|   374k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|   374k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  ------------------
  |  |  |  |  325|   374k| \
  |  |  |  |  326|   374k|    /* mark target as significant */ \
  |  |  |  |  327|   374k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|   374k|#define T1_CHI_1_I  19
  |  |  |  |  ------------------
  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|   374k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  |  |  328|   374k| \
  |  |  |  |  329|   374k|    /* west */ \
  |  |  |  |  330|   374k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|   374k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  ------------------
  |  |  |  |  331|   374k| \
  |  |  |  |  332|   374k|    /* north-west, north, north-east */ \
  |  |  |  |  333|   374k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (333:9): [True: 216k, False: 157k]
  |  |  |  |  |  Branch (333:21): [True: 124k, False: 91.9k]
  |  |  |  |  ------------------
  |  |  |  |  334|   124k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  335|   124k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  127|   124k|#define T1_CHI_5_I  31
  |  |  |  |  ------------------
  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|   124k|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  ------------------
  |  |  |  |  336|   124k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|   124k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  ------------------
  |  |  |  |  337|   124k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|   124k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  ------------------
  |  |  |  |  338|   124k|    } \
  |  |  |  |  339|   374k| \
  |  |  |  |  340|   374k|    /* south-west, south, south-east */ \
  |  |  |  |  341|   374k|    if (ci == 3U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (341:9): [True: 0, False: 374k]
  |  |  |  |  ------------------
  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  343|      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)
  |  |  |  |  ------------------
  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  ------------------
  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  ------------------
  |  |  |  |  346|      0|    } \
  |  |  |  |  347|   374k|}
  |  |  ------------------
  |  | 1138|   374k|            } \
  |  | 1139|   374k|        } while(0); \
  |  |  ------------------
  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  ------------------
  |  | 1140|  2.90M|    } \
  |  | 1141|  8.19M|}
  ------------------
 1155|  8.19M|                                  *flagsp, flagsp, t1->w + 2U, datap,
 1156|  8.19M|                                  0, ci, mqc, mqc->curctx,
 1157|  8.19M|                                  v, mqc->a, mqc->c, mqc->ct, oneplushalf, vsc);
 1158|  8.19M|}
t1.c:opj_t1_dec_clnpass_64x64_novsc:
 1364|  47.1k|{
 1365|  47.1k|    opj_t1_dec_clnpass_internal(t1, bpno, OPJ_FALSE, 64, 64, 66);
  ------------------
  |  | 1251|  47.1k|#define opj_t1_dec_clnpass_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  | 1252|  47.1k|{ \
  |  | 1253|  47.1k|    OPJ_INT32 one, half, oneplushalf; \
  |  | 1254|  47.1k|    OPJ_UINT32 runlen; \
  |  | 1255|  47.1k|    OPJ_UINT32 i, j, k; \
  |  | 1256|  47.1k|    const OPJ_UINT32 l_w = w; \
  |  | 1257|  47.1k|    opj_mqc_t* mqc = &(t1->mqc); \
  |  | 1258|  47.1k|    register OPJ_INT32 *data = t1->data; \
  |  | 1259|  47.1k|    register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  | 1260|  47.1k|    DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  47.1k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  47.1k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  47.1k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  47.1k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  | 1261|  47.1k|    register OPJ_UINT32 v; \
  |  | 1262|  47.1k|    one = 1 << bpno; \
  |  | 1263|  47.1k|    half = one >> 1; \
  |  | 1264|  47.1k|    oneplushalf = one | half; \
  |  | 1265|   801k|    for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (1265:17): [True: 754k, False: 47.1k]
  |  |  ------------------
  |  | 1266|  49.0M|        for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1266:21): [True: 48.2M, False: 754k]
  |  |  ------------------
  |  | 1267|  48.2M|            opj_flag_t flags = *flagsp; \
  |  | 1268|  48.2M|            if (flags == 0) { \
  |  |  ------------------
  |  |  |  Branch (1268:17): [True: 12.8M, False: 35.4M]
  |  |  ------------------
  |  | 1269|  12.8M|                OPJ_UINT32 partial = OPJ_TRUE; \
  |  |  ------------------
  |  |  |  |  117|  12.8M|#define OPJ_TRUE 1
  |  |  ------------------
  |  | 1270|  12.8M|                opj_t1_setcurctx(curctx, T1_CTXNO_AGG); \
  |  |  ------------------
  |  |  |  |   62|  12.8M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1271|  12.8M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  12.8M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  12.8M|{ \
  |  |  |  |  140|  12.8M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  12.8M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  12.8M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  12.8M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  12.8M|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  12.8M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 915k, False: 11.9M]
  |  |  |  |  ------------------
  |  |  |  |  146|   915k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   915k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   915k|{ \
  |  |  |  |  |  |   57|   915k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 135k, False: 780k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|   135k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|   135k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|   135k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   780k|    } else { \
  |  |  |  |  |  |   62|   780k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   780k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   780k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   780k|    } \
  |  |  |  |  |  |   66|   915k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   915k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   915k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   915k|{ \
  |  |  |  |  |  |  128|  1.81M|    do { \
  |  |  |  |  |  |  129|  1.81M|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 219k, False: 1.59M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|   219k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|   219k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|   219k|{ \
  |  |  |  |  |  |  |  |  104|   219k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|   219k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|   219k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|   219k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|   219k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 145k, False: 74.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|   145k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 133k, False: 12.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|   133k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|   133k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|   133k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|   133k|            } else { \
  |  |  |  |  |  |  |  |  114|  12.1k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  12.1k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  12.1k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  12.1k|            } \
  |  |  |  |  |  |  |  |  118|   145k|        } else { \
  |  |  |  |  |  |  |  |  119|  74.1k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  74.1k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  74.1k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  74.1k|        } \
  |  |  |  |  |  |  |  |  123|   219k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|   219k|        } \
  |  |  |  |  |  |  132|  1.81M|        a <<= 1; \
  |  |  |  |  |  |  133|  1.81M|        c <<= 1; \
  |  |  |  |  |  |  134|  1.81M|        ct--; \
  |  |  |  |  |  |  135|  1.81M|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 903k, False: 915k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   915k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  11.9M|    } else {  \
  |  |  |  |  149|  11.9M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  11.9M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 978k, False: 10.9M]
  |  |  |  |  ------------------
  |  |  |  |  151|   978k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   978k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   978k|{ \
  |  |  |  |  |  |   45|   978k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 98.6k, False: 880k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  98.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  98.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   880k|    } else { \
  |  |  |  |  |  |   49|   880k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   880k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   880k|    } \
  |  |  |  |  |  |   52|   978k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   978k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   978k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   978k|{ \
  |  |  |  |  |  |  128|  1.02M|    do { \
  |  |  |  |  |  |  129|  1.02M|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 137k, False: 883k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|   137k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|   137k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|   137k|{ \
  |  |  |  |  |  |  |  |  104|   137k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|   137k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|   137k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|   137k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|   137k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 91.9k, False: 45.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  91.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 84.3k, False: 7.60k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  84.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  84.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  84.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  84.3k|            } else { \
  |  |  |  |  |  |  |  |  114|  7.60k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  7.60k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  7.60k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  7.60k|            } \
  |  |  |  |  |  |  |  |  118|  91.9k|        } else { \
  |  |  |  |  |  |  |  |  119|  45.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  45.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  45.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  45.6k|        } \
  |  |  |  |  |  |  |  |  123|   137k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|   137k|        } \
  |  |  |  |  |  |  132|  1.02M|        a <<= 1; \
  |  |  |  |  |  |  133|  1.02M|        c <<= 1; \
  |  |  |  |  |  |  134|  1.02M|        ct--; \
  |  |  |  |  |  |  135|  1.02M|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 42.3k, False: 978k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   978k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  10.9M|        } else { \
  |  |  |  |  154|  10.9M|            d = (*curctx)->mps; \
  |  |  |  |  155|  10.9M|        } \
  |  |  |  |  156|  11.9M|    } \
  |  |  |  |  157|  12.8M|}
  |  |  ------------------
  |  | 1272|  12.8M|                if (!v) { \
  |  |  ------------------
  |  |  |  Branch (1272:21): [True: 11.7M, False: 1.02M]
  |  |  ------------------
  |  | 1273|  11.7M|                    continue; \
  |  | 1274|  11.7M|                } \
  |  | 1275|  12.8M|                opj_t1_setcurctx(curctx, T1_CTXNO_UNI); \
  |  |  ------------------
  |  |  |  |   62|  1.02M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1276|  1.02M|                opj_mqc_decode_macro(runlen, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  1.02M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  1.02M|{ \
  |  |  |  |  140|  1.02M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  1.02M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  1.02M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  1.02M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  1.02M|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  1.02M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 519k, False: 504k]
  |  |  |  |  ------------------
  |  |  |  |  146|   519k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   519k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   519k|{ \
  |  |  |  |  |  |   57|   519k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 309k, False: 209k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|   309k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|   309k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|   309k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   309k|    } else { \
  |  |  |  |  |  |   62|   209k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   209k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   209k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   209k|    } \
  |  |  |  |  |  |   66|   519k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   519k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   519k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   519k|{ \
  |  |  |  |  |  |  128|   519k|    do { \
  |  |  |  |  |  |  129|   519k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 70.7k, False: 448k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 47.6k, False: 23.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  47.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 44.0k, False: 3.62k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  44.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  44.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  44.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  44.0k|            } else { \
  |  |  |  |  |  |  |  |  114|  3.62k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  3.62k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  3.62k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  3.62k|            } \
  |  |  |  |  |  |  |  |  118|  47.6k|        } else { \
  |  |  |  |  |  |  |  |  119|  23.1k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  23.1k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  23.1k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  23.1k|        } \
  |  |  |  |  |  |  |  |  123|  70.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  70.7k|        } \
  |  |  |  |  |  |  132|   519k|        a <<= 1; \
  |  |  |  |  |  |  133|   519k|        c <<= 1; \
  |  |  |  |  |  |  134|   519k|        ct--; \
  |  |  |  |  |  |  135|   519k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 519k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   519k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   519k|    } else {  \
  |  |  |  |  149|   504k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   504k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 400k, False: 103k]
  |  |  |  |  ------------------
  |  |  |  |  151|   400k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   400k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   400k|{ \
  |  |  |  |  |  |   45|   400k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 219k, False: 180k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|   219k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|   219k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   219k|    } else { \
  |  |  |  |  |  |   49|   180k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   180k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   180k|    } \
  |  |  |  |  |  |   52|   400k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   400k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   400k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   400k|{ \
  |  |  |  |  |  |  128|   490k|    do { \
  |  |  |  |  |  |  129|   490k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 57.4k, False: 432k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  57.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  57.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  57.4k|{ \
  |  |  |  |  |  |  |  |  104|  57.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  57.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  57.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  57.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  57.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 45.5k, False: 11.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  45.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 42.1k, False: 3.32k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  42.1k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  42.1k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  42.1k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  42.1k|            } else { \
  |  |  |  |  |  |  |  |  114|  3.32k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  3.32k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  3.32k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  3.32k|            } \
  |  |  |  |  |  |  |  |  118|  45.5k|        } else { \
  |  |  |  |  |  |  |  |  119|  11.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  11.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  11.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  11.9k|        } \
  |  |  |  |  |  |  |  |  123|  57.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  57.4k|        } \
  |  |  |  |  |  |  132|   490k|        a <<= 1; \
  |  |  |  |  |  |  133|   490k|        c <<= 1; \
  |  |  |  |  |  |  134|   490k|        ct--; \
  |  |  |  |  |  |  135|   490k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 89.3k, False: 400k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   400k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   400k|        } else { \
  |  |  |  |  154|   103k|            d = (*curctx)->mps; \
  |  |  |  |  155|   103k|        } \
  |  |  |  |  156|   504k|    } \
  |  |  |  |  157|  1.02M|}
  |  |  ------------------
  |  | 1277|  1.02M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  1.02M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  1.02M|{ \
  |  |  |  |  140|  1.02M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  1.02M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  1.02M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  1.02M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  1.02M|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  1.02M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 499k, False: 523k]
  |  |  |  |  ------------------
  |  |  |  |  146|   499k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   499k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   499k|{ \
  |  |  |  |  |  |   57|   499k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 136k, False: 362k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|   136k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|   136k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|   136k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   362k|    } else { \
  |  |  |  |  |  |   62|   362k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   362k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   362k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   362k|    } \
  |  |  |  |  |  |   66|   499k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   499k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   499k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   499k|{ \
  |  |  |  |  |  |  128|   499k|    do { \
  |  |  |  |  |  |  129|   499k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 68.0k, False: 431k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 47.0k, False: 21.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  47.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 43.2k, False: 3.81k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  43.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  43.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  43.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  43.2k|            } else { \
  |  |  |  |  |  |  |  |  114|  3.81k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  3.81k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  3.81k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  3.81k|            } \
  |  |  |  |  |  |  |  |  118|  47.0k|        } else { \
  |  |  |  |  |  |  |  |  119|  21.0k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  21.0k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  21.0k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  21.0k|        } \
  |  |  |  |  |  |  |  |  123|  68.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  68.0k|        } \
  |  |  |  |  |  |  132|   499k|        a <<= 1; \
  |  |  |  |  |  |  133|   499k|        c <<= 1; \
  |  |  |  |  |  |  134|   499k|        ct--; \
  |  |  |  |  |  |  135|   499k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 499k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   499k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   523k|    } else {  \
  |  |  |  |  149|   523k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   523k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 442k, False: 81.1k]
  |  |  |  |  ------------------
  |  |  |  |  151|   442k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   442k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   442k|{ \
  |  |  |  |  |  |   45|   442k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 98.1k, False: 344k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  98.1k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  98.1k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   344k|    } else { \
  |  |  |  |  |  |   49|   344k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   344k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   344k|    } \
  |  |  |  |  |  |   52|   442k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   442k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   442k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   442k|{ \
  |  |  |  |  |  |  128|   496k|    do { \
  |  |  |  |  |  |  129|   496k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 58.4k, False: 437k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  58.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  58.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  58.4k|{ \
  |  |  |  |  |  |  |  |  104|  58.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  58.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  58.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  58.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  58.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 44.9k, False: 13.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  44.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 41.5k, False: 3.39k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  41.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  41.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  41.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  41.5k|            } else { \
  |  |  |  |  |  |  |  |  114|  3.39k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  3.39k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  3.39k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  3.39k|            } \
  |  |  |  |  |  |  |  |  118|  44.9k|        } else { \
  |  |  |  |  |  |  |  |  119|  13.4k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  13.4k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  13.4k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  13.4k|        } \
  |  |  |  |  |  |  |  |  123|  58.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  58.4k|        } \
  |  |  |  |  |  |  132|   496k|        a <<= 1; \
  |  |  |  |  |  |  133|   496k|        c <<= 1; \
  |  |  |  |  |  |  134|   496k|        ct--; \
  |  |  |  |  |  |  135|   496k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 53.5k, False: 442k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   442k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   442k|        } else { \
  |  |  |  |  154|  81.1k|            d = (*curctx)->mps; \
  |  |  |  |  155|  81.1k|        } \
  |  |  |  |  156|   523k|    } \
  |  |  |  |  157|  1.02M|}
  |  |  ------------------
  |  | 1278|  1.02M|                runlen = (runlen << 1) | v; \
  |  | 1279|  1.02M|                switch(runlen) { \
  |  |  ------------------
  |  |  |  Branch (1279:24): [True: 0, False: 1.02M]
  |  |  ------------------
  |  | 1280|   334k|                    case 0: \
  |  |  ------------------
  |  |  |  Branch (1280:21): [True: 334k, False: 689k]
  |  |  ------------------
  |  | 1281|   334k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, OPJ_TRUE,\
  |  |  ------------------
  |  |  |  | 1118|   334k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   334k|{ \
  |  |  |  | 1120|   334k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   334k|        do { \
  |  |  |  | 1122|   334k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|      0|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|      0|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|      0|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|      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|}
  |  |  |  |  ------------------
  |  |  |  | 1126|      0|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1127|      0|                    break; \
  |  |  |  | 1128|      0|            } \
  |  |  |  | 1129|   334k|            { \
  |  |  |  | 1130|   334k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   334k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   334k|                                    ci); \
  |  |  |  | 1133|   334k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   334k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   334k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   334k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   334k|{ \
  |  |  |  |  |  |  140|   334k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   334k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   334k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   334k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   334k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   334k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 106k, False: 228k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 5.56k, False: 100k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  5.56k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  5.56k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  5.56k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   100k|    } else { \
  |  |  |  |  |  |  |  |   62|   100k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   100k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   100k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   100k|    } \
  |  |  |  |  |  |  |  |   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|   157k|    do { \
  |  |  |  |  |  |  |  |  129|   157k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 19.0k, False: 138k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  19.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  19.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  19.0k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  19.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  19.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  19.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  19.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  19.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 13.9k, False: 5.10k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.7k, False: 1.15k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.15k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.15k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.15k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.15k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.10k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.10k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.10k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.10k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  19.0k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  19.0k|        } \
  |  |  |  |  |  |  |  |  132|   157k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   157k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   157k|        ct--; \
  |  |  |  |  |  |  |  |  135|   157k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 51.7k, False: 106k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   106k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   228k|    } else {  \
  |  |  |  |  |  |  149|   228k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   228k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 119k, False: 108k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 5.11k, False: 114k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  5.11k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  5.11k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   114k|    } else { \
  |  |  |  |  |  |  |  |   49|   114k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   114k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   114k|    } \
  |  |  |  |  |  |  |  |   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|   120k|    do { \
  |  |  |  |  |  |  |  |  129|   120k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 13.4k, False: 106k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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.4k, False: 2.04k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.0k, False: 1.35k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  10.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  10.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  10.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  10.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.35k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.35k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.35k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.35k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.04k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.04k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.04k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.04k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  13.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  13.4k|        } \
  |  |  |  |  |  |  |  |  132|   120k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   120k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   120k|        ct--; \
  |  |  |  |  |  |  |  |  135|   120k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 479, False: 119k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   119k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   119k|        } else { \
  |  |  |  |  |  |  154|   108k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   108k|        } \
  |  |  |  |  |  |  156|   228k|    } \
  |  |  |  |  |  |  157|   334k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   334k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   334k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 181k, False: 152k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   334k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   334k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   334k|{ \
  |  |  |  |  |  |  323|   334k|    /* east */ \
  |  |  |  |  |  |  324|   334k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   334k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   334k| \
  |  |  |  |  |  |  326|   334k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   334k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   334k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   334k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   334k| \
  |  |  |  |  |  |  329|   334k|    /* west */ \
  |  |  |  |  |  |  330|   334k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   334k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   334k| \
  |  |  |  |  |  |  332|   334k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   334k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   334k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|   334k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|   334k|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|   334k|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|   334k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|   334k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|   334k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|   334k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|   334k|    } \
  |  |  |  |  |  |  339|   334k| \
  |  |  |  |  |  |  340|   334k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   334k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|   334k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   334k|            } \
  |  |  |  | 1139|   334k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   334k|    } \
  |  |  |  | 1141|   334k|}
  |  |  ------------------
  |  | 1282|   334k|                                            flags, flagsp, flags_stride, data, \
  |  | 1283|   334k|                                            l_w, 0, mqc, curctx, \
  |  | 1284|   334k|                                            v, a, c, ct, oneplushalf, vsc); \
  |  | 1285|   334k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   334k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1286|   334k|                        /* FALLTHRU */ \
  |  | 1287|   594k|                    case 1: \
  |  |  ------------------
  |  |  |  Branch (1287:21): [True: 259k, False: 764k]
  |  |  ------------------
  |  | 1288|   594k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1118|   594k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   594k|{ \
  |  |  |  | 1120|   594k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   594k|        do { \
  |  |  |  | 1122|   594k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [True: 334k, False: 259k]
  |  |  |  |  ------------------
  |  |  |  | 1123|   334k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|   334k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   334k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|   334k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   334k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   334k|{ \
  |  |  |  |  |  |  140|   334k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   334k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   334k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   334k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   334k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   334k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 57.4k, False: 277k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  57.4k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  57.4k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  57.4k|{ \
  |  |  |  |  |  |  |  |   57|  57.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 11.2k, False: 46.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  11.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  11.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  11.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  46.2k|    } else { \
  |  |  |  |  |  |  |  |   62|  46.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  46.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  46.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  46.2k|    } \
  |  |  |  |  |  |  |  |   66|  57.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  57.4k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  57.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  57.4k|{ \
  |  |  |  |  |  |  |  |  128|   106k|    do { \
  |  |  |  |  |  |  |  |  129|   106k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 14.4k, False: 91.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 11.1k, False: 3.34k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.5k, False: 589]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  10.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  10.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  10.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  10.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    589|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    589|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    589|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    589|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.34k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.34k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.34k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.34k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  14.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  14.4k|        } \
  |  |  |  |  |  |  |  |  132|   106k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   106k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   106k|        ct--; \
  |  |  |  |  |  |  |  |  135|   106k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 48.6k, False: 57.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  57.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   277k|    } else {  \
  |  |  |  |  |  |  149|   277k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   277k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 67.0k, False: 210k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  67.0k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  67.0k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  67.0k|{ \
  |  |  |  |  |  |  |  |   45|  67.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 8.01k, False: 59.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  8.01k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  8.01k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  59.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  59.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  59.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  59.0k|    } \
  |  |  |  |  |  |  |  |   52|  67.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  67.0k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  67.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  67.0k|{ \
  |  |  |  |  |  |  |  |  128|  71.5k|    do { \
  |  |  |  |  |  |  |  |  129|  71.5k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 9.23k, False: 62.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  9.23k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  9.23k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  9.23k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  9.23k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  9.23k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  9.23k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  9.23k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  9.23k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.99k, False: 2.23k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.99k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.56k, False: 428]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.56k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.56k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.56k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.56k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    428|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    428|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    428|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    428|            } \
  |  |  |  |  |  |  |  |  |  |  118|  6.99k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.23k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.23k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.23k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.23k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  9.23k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  9.23k|        } \
  |  |  |  |  |  |  |  |  132|  71.5k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  71.5k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  71.5k|        ct--; \
  |  |  |  |  |  |  |  |  135|  71.5k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.54k, False: 67.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  67.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   210k|        } else { \
  |  |  |  |  |  |  154|   210k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   210k|        } \
  |  |  |  |  |  |  156|   277k|    } \
  |  |  |  |  |  |  157|   334k|}
  |  |  |  |  ------------------
  |  |  |  | 1126|   334k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 261k, False: 73.3k]
  |  |  |  |  ------------------
  |  |  |  | 1127|   334k|                    break; \
  |  |  |  | 1128|   334k|            } \
  |  |  |  | 1129|   594k|            { \
  |  |  |  | 1130|   332k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   332k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   332k|                                    ci); \
  |  |  |  | 1133|   332k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   332k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   332k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   332k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   332k|{ \
  |  |  |  |  |  |  140|   332k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   332k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   332k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   332k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   332k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   332k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 108k, False: 224k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   108k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   108k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   108k|{ \
  |  |  |  |  |  |  |  |   57|   108k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 6.65k, False: 101k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  6.65k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  6.65k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  6.65k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   101k|    } else { \
  |  |  |  |  |  |  |  |   62|   101k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   101k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   101k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   101k|    } \
  |  |  |  |  |  |  |  |   66|   108k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   108k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   108k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   108k|{ \
  |  |  |  |  |  |  |  |  128|   163k|    do { \
  |  |  |  |  |  |  |  |  129|   163k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 18.1k, False: 145k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 14.7k, False: 3.37k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  14.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.4k, False: 1.31k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  13.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  13.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  13.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  13.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.31k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.31k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.31k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.31k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  14.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.37k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.37k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.37k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.37k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  18.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  18.1k|        } \
  |  |  |  |  |  |  |  |  132|   163k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   163k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   163k|        ct--; \
  |  |  |  |  |  |  |  |  135|   163k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 55.1k, False: 108k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   108k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   224k|    } else {  \
  |  |  |  |  |  |  149|   224k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   224k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 112k, False: 112k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   112k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   112k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   112k|{ \
  |  |  |  |  |  |  |  |   45|   112k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 4.24k, False: 108k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  4.24k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  4.24k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   108k|    } else { \
  |  |  |  |  |  |  |  |   49|   108k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   108k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   108k|    } \
  |  |  |  |  |  |  |  |   52|   112k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   112k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   112k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   112k|{ \
  |  |  |  |  |  |  |  |  128|   114k|    do { \
  |  |  |  |  |  |  |  |  129|   114k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 15.2k, False: 99.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  15.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  15.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  15.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  15.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  15.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  15.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  15.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  15.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 11.4k, False: 3.78k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.5k, False: 923]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  10.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  10.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  10.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  10.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    923|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    923|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    923|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    923|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.78k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.78k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.78k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.78k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  15.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  15.2k|        } \
  |  |  |  |  |  |  |  |  132|   114k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   114k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   114k|        ct--; \
  |  |  |  |  |  |  |  |  135|   114k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.92k, False: 112k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   112k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   112k|        } else { \
  |  |  |  |  |  |  154|   112k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   112k|        } \
  |  |  |  |  |  |  156|   224k|    } \
  |  |  |  |  |  |  157|   332k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   332k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   332k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 176k, False: 156k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   332k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   332k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   332k|{ \
  |  |  |  |  |  |  323|   332k|    /* east */ \
  |  |  |  |  |  |  324|   332k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   332k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   332k| \
  |  |  |  |  |  |  326|   332k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   332k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   332k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   332k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   332k| \
  |  |  |  |  |  |  329|   332k|    /* west */ \
  |  |  |  |  |  |  330|   332k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   332k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   332k| \
  |  |  |  |  |  |  332|   332k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   332k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   332k| \
  |  |  |  |  |  |  340|   332k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   332k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|   332k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   332k|            } \
  |  |  |  | 1139|   332k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   594k|    } \
  |  |  |  | 1141|   594k|}
  |  |  ------------------
  |  | 1289|   594k|                                            flags, flagsp, flags_stride, data, \
  |  | 1290|   594k|                                            l_w, 1, mqc, curctx, \
  |  | 1291|   594k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1292|   594k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   594k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1293|   594k|                        /* FALLTHRU */ \
  |  | 1294|   822k|                    case 2: \
  |  |  ------------------
  |  |  |  Branch (1294:21): [True: 228k, False: 795k]
  |  |  ------------------
  |  | 1295|   822k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1118|   822k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   822k|{ \
  |  |  |  | 1120|   822k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   822k|        do { \
  |  |  |  | 1122|   822k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [True: 594k, False: 228k]
  |  |  |  |  ------------------
  |  |  |  | 1123|   594k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|   594k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   594k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|   594k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   594k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   594k|{ \
  |  |  |  |  |  |  140|   594k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   594k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   594k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   594k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   594k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   594k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 79.3k, False: 514k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  79.3k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  79.3k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  79.3k|{ \
  |  |  |  |  |  |  |  |   57|  79.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 16.6k, False: 62.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  16.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  16.6k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  16.6k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  62.7k|    } else { \
  |  |  |  |  |  |  |  |   62|  62.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  62.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  62.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  62.7k|    } \
  |  |  |  |  |  |  |  |   66|  79.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  79.3k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  79.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  79.3k|{ \
  |  |  |  |  |  |  |  |  128|   139k|    do { \
  |  |  |  |  |  |  |  |  129|   139k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.2k, False: 123k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 13.6k, False: 2.62k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.7k, False: 867]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    867|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    867|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    867|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    867|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.62k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.62k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.62k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.62k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.2k|        } \
  |  |  |  |  |  |  |  |  132|   139k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   139k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   139k|        ct--; \
  |  |  |  |  |  |  |  |  135|   139k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 60.6k, False: 79.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  79.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   514k|    } else {  \
  |  |  |  |  |  |  149|   514k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   514k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 94.7k, False: 420k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  94.7k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  94.7k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  94.7k|{ \
  |  |  |  |  |  |  |  |   45|  94.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 11.9k, False: 82.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  11.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  11.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  82.7k|    } else { \
  |  |  |  |  |  |  |  |   49|  82.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  82.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  82.7k|    } \
  |  |  |  |  |  |  |  |   52|  94.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  94.7k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  94.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  94.7k|{ \
  |  |  |  |  |  |  |  |  128|   101k|    do { \
  |  |  |  |  |  |  |  |  129|   101k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 12.5k, False: 88.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  12.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  12.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  12.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  12.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  12.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  12.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  12.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  12.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 10.6k, False: 1.92k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  10.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.0k, False: 574]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  10.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  10.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  10.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  10.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    574|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    574|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    574|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    574|            } \
  |  |  |  |  |  |  |  |  |  |  118|  10.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.92k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.92k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.92k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.92k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  12.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  12.5k|        } \
  |  |  |  |  |  |  |  |  132|   101k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   101k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   101k|        ct--; \
  |  |  |  |  |  |  |  |  135|   101k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 6.31k, False: 94.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  94.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   420k|        } else { \
  |  |  |  |  |  |  154|   420k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   420k|        } \
  |  |  |  |  |  |  156|   514k|    } \
  |  |  |  |  |  |  157|   594k|}
  |  |  |  |  ------------------
  |  |  |  | 1126|   594k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 486k, False: 107k]
  |  |  |  |  ------------------
  |  |  |  | 1127|   594k|                    break; \
  |  |  |  | 1128|   594k|            } \
  |  |  |  | 1129|   822k|            { \
  |  |  |  | 1130|   335k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   335k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   335k|                                    ci); \
  |  |  |  | 1133|   335k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   335k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   335k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   335k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   335k|{ \
  |  |  |  |  |  |  140|   335k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   335k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   335k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   335k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   335k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   335k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 105k, False: 229k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   105k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   105k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   105k|{ \
  |  |  |  |  |  |  |  |   57|   105k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 9.79k, False: 95.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  9.79k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  9.79k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  9.79k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  95.8k|    } else { \
  |  |  |  |  |  |  |  |   62|  95.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  95.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  95.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  95.8k|    } \
  |  |  |  |  |  |  |  |   66|   105k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   105k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   105k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   105k|{ \
  |  |  |  |  |  |  |  |  128|   164k|    do { \
  |  |  |  |  |  |  |  |  129|   164k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 19.3k, False: 145k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  19.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  19.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  19.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  19.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  19.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  19.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  19.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  19.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 15.6k, False: 3.67k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  15.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 14.5k, False: 1.13k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  14.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  14.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  14.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  14.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.13k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.13k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.13k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.13k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  15.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.67k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.67k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.67k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.67k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  19.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  19.3k|        } \
  |  |  |  |  |  |  |  |  132|   164k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   164k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   164k|        ct--; \
  |  |  |  |  |  |  |  |  135|   164k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 58.8k, False: 105k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   105k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   229k|    } else {  \
  |  |  |  |  |  |  149|   229k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   229k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 114k, False: 114k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 8.80k, False: 105k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  8.80k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  8.80k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   105k|    } else { \
  |  |  |  |  |  |  |  |   49|   105k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   105k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   105k|    } \
  |  |  |  |  |  |  |  |   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|   118k|    do { \
  |  |  |  |  |  |  |  |  129|   118k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 14.7k, False: 104k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  14.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  14.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  14.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  14.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  14.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  14.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  14.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  14.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 11.7k, False: 3.08k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 11.0k, False: 631]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  11.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  11.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  11.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  11.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    631|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    631|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    631|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    631|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.08k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.08k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.08k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.08k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  14.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  14.7k|        } \
  |  |  |  |  |  |  |  |  132|   118k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   118k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   118k|        ct--; \
  |  |  |  |  |  |  |  |  135|   118k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.28k, False: 114k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   114k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   114k|        } else { \
  |  |  |  |  |  |  154|   114k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   114k|        } \
  |  |  |  |  |  |  156|   229k|    } \
  |  |  |  |  |  |  157|   335k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   335k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   335k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 172k, False: 162k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   335k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   335k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   335k|{ \
  |  |  |  |  |  |  323|   335k|    /* east */ \
  |  |  |  |  |  |  324|   335k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   335k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   335k| \
  |  |  |  |  |  |  326|   335k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   335k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   335k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   335k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   335k| \
  |  |  |  |  |  |  329|   335k|    /* west */ \
  |  |  |  |  |  |  330|   335k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   335k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   335k| \
  |  |  |  |  |  |  332|   335k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   335k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   335k| \
  |  |  |  |  |  |  340|   335k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   335k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|   335k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   335k|            } \
  |  |  |  | 1139|   335k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   822k|    } \
  |  |  |  | 1141|   822k|}
  |  |  ------------------
  |  | 1296|   822k|                                            flags, flagsp, flags_stride, data, \
  |  | 1297|   822k|                                            l_w, 2, mqc, curctx, \
  |  | 1298|   822k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1299|   822k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   822k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1300|   822k|                        /* FALLTHRU */ \
  |  | 1301|  1.02M|                    case 3: \
  |  |  ------------------
  |  |  |  Branch (1301:21): [True: 201k, False: 822k]
  |  |  ------------------
  |  | 1302|  1.02M|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1118|  1.02M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  1.02M|{ \
  |  |  |  | 1120|  1.02M|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|  1.02M|        do { \
  |  |  |  | 1122|  1.02M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [True: 822k, False: 201k]
  |  |  |  |  ------------------
  |  |  |  | 1123|   822k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|   822k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   822k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|   822k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   822k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   822k|{ \
  |  |  |  |  |  |  140|   822k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   822k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   822k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   822k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   822k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   822k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 88.0k, False: 734k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  88.0k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  88.0k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  88.0k|{ \
  |  |  |  |  |  |  |  |   57|  88.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 18.7k, False: 69.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  18.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  18.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  18.7k|        *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|  88.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  88.0k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  88.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  88.0k|{ \
  |  |  |  |  |  |  |  |  128|   164k|    do { \
  |  |  |  |  |  |  |  |  129|   164k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 20.6k, False: 143k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  20.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  20.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  20.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  20.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  20.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  20.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  20.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  20.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 16.3k, False: 4.39k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  16.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 15.0k, False: 1.21k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  15.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  15.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  15.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  15.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.21k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.21k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.21k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.21k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  16.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.39k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.39k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.39k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.39k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  20.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  20.6k|        } \
  |  |  |  |  |  |  |  |  132|   164k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   164k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   164k|        ct--; \
  |  |  |  |  |  |  |  |  135|   164k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 76.5k, False: 88.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  88.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   734k|    } else {  \
  |  |  |  |  |  |  149|   734k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   734k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 101k, False: 632k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   101k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   101k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   101k|{ \
  |  |  |  |  |  |  |  |   45|   101k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 13.6k, False: 88.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  13.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  13.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  88.1k|    } else { \
  |  |  |  |  |  |  |  |   49|  88.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  88.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  88.1k|    } \
  |  |  |  |  |  |  |  |   52|   101k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   101k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   101k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   101k|{ \
  |  |  |  |  |  |  |  |  128|   109k|    do { \
  |  |  |  |  |  |  |  |  129|   109k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 14.3k, False: 94.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 12.1k, False: 2.18k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  12.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 11.4k, False: 730]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  11.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  11.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  11.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  11.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    730|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    730|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    730|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    730|            } \
  |  |  |  |  |  |  |  |  |  |  118|  12.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.18k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.18k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.18k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.18k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  14.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  14.3k|        } \
  |  |  |  |  |  |  |  |  132|   109k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   109k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   109k|        ct--; \
  |  |  |  |  |  |  |  |  135|   109k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 7.33k, False: 101k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   101k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   632k|        } else { \
  |  |  |  |  |  |  154|   632k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   632k|        } \
  |  |  |  |  |  |  156|   734k|    } \
  |  |  |  |  |  |  157|   822k|}
  |  |  |  |  ------------------
  |  |  |  | 1126|   822k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 698k, False: 123k]
  |  |  |  |  ------------------
  |  |  |  | 1127|   822k|                    break; \
  |  |  |  | 1128|   822k|            } \
  |  |  |  | 1129|  1.02M|            { \
  |  |  |  | 1130|   324k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   324k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   324k|                                    ci); \
  |  |  |  | 1133|   324k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   324k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   324k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   324k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   324k|{ \
  |  |  |  |  |  |  140|   324k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   324k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   324k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   324k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   324k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   324k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 102k, False: 222k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 13.7k, False: 88.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  13.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  13.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  13.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  88.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  88.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  88.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  88.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  88.4k|    } \
  |  |  |  |  |  |  |  |   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|   157k|    do { \
  |  |  |  |  |  |  |  |  129|   157k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 18.4k, False: 139k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  18.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  18.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  18.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  18.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  18.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  18.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  18.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  18.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 14.7k, False: 3.66k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  14.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.8k, False: 949]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  13.8k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  13.8k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  13.8k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  13.8k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    949|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    949|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    949|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    949|            } \
  |  |  |  |  |  |  |  |  |  |  118|  14.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.66k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.66k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.66k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.66k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  18.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  18.4k|        } \
  |  |  |  |  |  |  |  |  132|   157k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   157k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   157k|        ct--; \
  |  |  |  |  |  |  |  |  135|   157k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 55.5k, False: 102k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   102k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   222k|    } else {  \
  |  |  |  |  |  |  149|   222k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   222k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 113k, False: 108k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   113k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   113k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   113k|{ \
  |  |  |  |  |  |  |  |   45|   113k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 10.2k, False: 103k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  10.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  10.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   103k|    } else { \
  |  |  |  |  |  |  |  |   49|   103k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   103k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   103k|    } \
  |  |  |  |  |  |  |  |   52|   113k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   113k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   113k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   113k|{ \
  |  |  |  |  |  |  |  |  128|   118k|    do { \
  |  |  |  |  |  |  |  |  129|   118k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 17.8k, False: 100k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  17.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  17.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  17.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  17.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  17.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  17.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  17.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  17.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 12.0k, False: 5.84k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  12.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 11.2k, False: 716]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  11.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  11.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  11.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  11.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    716|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    716|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    716|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    716|            } \
  |  |  |  |  |  |  |  |  |  |  118|  12.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.84k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.84k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.84k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.84k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  17.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  17.8k|        } \
  |  |  |  |  |  |  |  |  132|   118k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   118k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   118k|        ct--; \
  |  |  |  |  |  |  |  |  135|   118k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.25k, False: 113k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   113k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   113k|        } else { \
  |  |  |  |  |  |  154|   108k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   108k|        } \
  |  |  |  |  |  |  156|   222k|    } \
  |  |  |  |  |  |  157|   324k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   324k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   324k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 168k, False: 156k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   324k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   324k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   324k|{ \
  |  |  |  |  |  |  323|   324k|    /* east */ \
  |  |  |  |  |  |  324|   324k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   324k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   324k| \
  |  |  |  |  |  |  326|   324k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   324k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   324k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   324k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   324k| \
  |  |  |  |  |  |  329|   324k|    /* west */ \
  |  |  |  |  |  |  330|   324k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   324k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   324k| \
  |  |  |  |  |  |  332|   324k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   324k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   324k| \
  |  |  |  |  |  |  340|   324k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   324k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|   324k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|   324k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   324k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   324k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|   324k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   324k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   324k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   324k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|   324k|    } \
  |  |  |  |  |  |  347|   324k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   324k|            } \
  |  |  |  | 1139|   324k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  1.02M|    } \
  |  |  |  | 1141|  1.02M|}
  |  |  ------------------
  |  | 1303|  1.02M|                                            flags, flagsp, flags_stride, data, \
  |  | 1304|  1.02M|                                            l_w, 3, mqc, curctx, \
  |  | 1305|  1.02M|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1306|  1.02M|                        break; \
  |  | 1307|  1.02M|                } \
  |  | 1308|  35.4M|            } else { \
  |  | 1309|  35.4M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  35.4M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  35.4M|{ \
  |  |  |  | 1120|  35.4M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  35.4M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  35.4M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  35.4M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  35.4M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 10.3M, False: 25.0M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  10.3M|        do { \
  |  |  |  | 1122|  10.3M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  10.3M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  10.3M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  10.3M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  10.3M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  10.3M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  10.3M|{ \
  |  |  |  |  |  |  140|  10.3M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  10.3M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  10.3M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  10.3M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  10.3M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  10.3M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 2.13M, False: 8.22M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.13M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  2.13M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  2.13M|{ \
  |  |  |  |  |  |  |  |   57|  2.13M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 461k, False: 1.67M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   461k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   461k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   461k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.67M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.67M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.67M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.67M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.67M|    } \
  |  |  |  |  |  |  |  |   66|  2.13M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.13M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.13M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.13M|{ \
  |  |  |  |  |  |  |  |  128|  3.55M|    do { \
  |  |  |  |  |  |  |  |  129|  3.55M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 450k, False: 3.10M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   450k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   450k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   450k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   450k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   450k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   450k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   450k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   450k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 415k, False: 35.4k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   415k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 404k, False: 10.1k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   404k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   404k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   404k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   404k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  10.1k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  10.1k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  10.1k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  10.1k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   415k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  35.4k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  35.4k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  35.4k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  35.4k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   450k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   450k|        } \
  |  |  |  |  |  |  |  |  132|  3.55M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.55M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.55M|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.55M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.42M, False: 2.13M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.13M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  8.22M|    } else {  \
  |  |  |  |  |  |  149|  8.22M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  8.22M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.26M, False: 5.95M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.26M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.26M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.26M|{ \
  |  |  |  |  |  |  |  |   45|  2.26M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 345k, False: 1.91M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   345k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   345k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.91M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.91M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.91M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.91M|    } \
  |  |  |  |  |  |  |  |   52|  2.26M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.26M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.26M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.26M|{ \
  |  |  |  |  |  |  |  |  128|  2.42M|    do { \
  |  |  |  |  |  |  |  |  129|  2.42M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 304k, False: 2.11M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   304k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   304k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   304k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   304k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   304k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   304k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   304k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   304k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 277k, False: 26.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   277k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 271k, False: 6.20k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   271k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   271k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   271k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   271k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  6.20k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  6.20k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  6.20k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  6.20k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   277k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  26.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  26.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  26.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  26.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   304k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   304k|        } \
  |  |  |  |  |  |  |  |  132|  2.42M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.42M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.42M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.42M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 156k, False: 2.26M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.26M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  5.95M|        } else { \
  |  |  |  |  |  |  154|  5.95M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  5.95M|        } \
  |  |  |  |  |  |  156|  8.22M|    } \
  |  |  |  |  |  |  157|  10.3M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  10.3M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 5.98M, False: 4.37M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  10.3M|                    break; \
  |  |  |  | 1128|  10.3M|            } \
  |  |  |  | 1129|  10.3M|            { \
  |  |  |  | 1130|  4.37M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  4.37M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  4.37M|                                    ci); \
  |  |  |  | 1133|  4.37M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  4.37M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  4.37M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.37M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.37M|{ \
  |  |  |  |  |  |  140|  4.37M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.37M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.37M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.37M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.37M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.37M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.14M, False: 3.22M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.14M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.14M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.14M|{ \
  |  |  |  |  |  |  |  |   57|  1.14M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 244k, False: 900k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   244k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   244k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   244k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   900k|    } else { \
  |  |  |  |  |  |  |  |   62|   900k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   900k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   900k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   900k|    } \
  |  |  |  |  |  |  |  |   66|  1.14M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.14M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.14M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.14M|{ \
  |  |  |  |  |  |  |  |  128|  1.83M|    do { \
  |  |  |  |  |  |  |  |  129|  1.83M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 228k, False: 1.60M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   228k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   228k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   228k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   228k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   228k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   228k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   228k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   228k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 213k, False: 15.1k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   213k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 209k, False: 4.48k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   209k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   209k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   209k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   209k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  4.48k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  4.48k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  4.48k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  4.48k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   213k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  15.1k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  15.1k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  15.1k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  15.1k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   228k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   228k|        } \
  |  |  |  |  |  |  |  |  132|  1.83M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.83M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.83M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.83M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 689k, False: 1.14M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.14M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.22M|    } else {  \
  |  |  |  |  |  |  149|  3.22M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.22M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.20M, False: 2.02M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.20M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.20M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.20M|{ \
  |  |  |  |  |  |  |  |   45|  1.20M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 192k, False: 1.01M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   192k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   192k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.01M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.01M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.01M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.01M|    } \
  |  |  |  |  |  |  |  |   52|  1.20M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.20M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.20M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.20M|{ \
  |  |  |  |  |  |  |  |  128|  1.28M|    do { \
  |  |  |  |  |  |  |  |  129|  1.28M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 156k, False: 1.13M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   156k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   156k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   156k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   156k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   156k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   156k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   156k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   156k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 147k, False: 9.56k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   147k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 143k, False: 3.43k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   143k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   143k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   143k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   143k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.43k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.43k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.43k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.43k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   147k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  9.56k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  9.56k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  9.56k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  9.56k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   156k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   156k|        } \
  |  |  |  |  |  |  |  |  132|  1.28M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.28M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.28M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.28M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 82.9k, False: 1.20M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.20M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.02M|        } else { \
  |  |  |  |  |  |  154|  2.02M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.02M|        } \
  |  |  |  |  |  |  156|  3.22M|    } \
  |  |  |  |  |  |  157|  4.37M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  4.37M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  4.37M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 2.18M, False: 2.18M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  4.37M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  4.37M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  4.37M|{ \
  |  |  |  |  |  |  323|  4.37M|    /* east */ \
  |  |  |  |  |  |  324|  4.37M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.37M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  4.37M| \
  |  |  |  |  |  |  326|  4.37M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  4.37M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.37M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.37M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.37M| \
  |  |  |  |  |  |  329|  4.37M|    /* west */ \
  |  |  |  |  |  |  330|  4.37M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.37M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.37M| \
  |  |  |  |  |  |  332|  4.37M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  4.37M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  4.37M|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|  4.37M|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|  4.37M|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|  4.37M|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|  4.37M|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|  4.37M|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|  4.37M|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|  4.37M|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|  4.37M|    } \
  |  |  |  |  |  |  339|  4.37M| \
  |  |  |  |  |  |  340|  4.37M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  4.37M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  4.37M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  4.37M|            } \
  |  |  |  | 1139|  4.37M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  10.3M|    } \
  |  |  |  | 1141|  35.4M|}
  |  |  ------------------
  |  | 1310|  35.4M|                                    flags, flagsp, flags_stride, data, \
  |  | 1311|  35.4M|                                    l_w, 0, mqc, curctx, \
  |  | 1312|  35.4M|                                    v, a, c, ct, oneplushalf, vsc); \
  |  | 1313|  35.4M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  35.4M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  35.4M|{ \
  |  |  |  | 1120|  35.4M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  35.4M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  35.4M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  35.4M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  35.4M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 10.3M, False: 25.1M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  10.3M|        do { \
  |  |  |  | 1122|  10.3M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  10.3M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  10.3M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  10.3M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  10.3M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  10.3M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  10.3M|{ \
  |  |  |  |  |  |  140|  10.3M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  10.3M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  10.3M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  10.3M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  10.3M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  10.3M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 2.08M, False: 8.25M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.08M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  2.08M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  2.08M|{ \
  |  |  |  |  |  |  |  |   57|  2.08M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 427k, False: 1.65M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   427k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   427k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   427k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.65M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.65M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.65M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.65M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.65M|    } \
  |  |  |  |  |  |  |  |   66|  2.08M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.08M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.08M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.08M|{ \
  |  |  |  |  |  |  |  |  128|  3.50M|    do { \
  |  |  |  |  |  |  |  |  129|  3.50M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 431k, False: 3.07M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   431k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   431k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   431k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   431k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   431k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   431k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   431k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   431k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 399k, False: 32.1k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   399k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 390k, False: 8.85k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   390k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   390k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   390k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   390k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  8.85k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  8.85k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  8.85k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  8.85k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   399k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  32.1k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  32.1k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  32.1k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  32.1k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   431k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   431k|        } \
  |  |  |  |  |  |  |  |  132|  3.50M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.50M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.50M|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.50M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.42M, False: 2.08M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.08M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  8.25M|    } else {  \
  |  |  |  |  |  |  149|  8.25M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  8.25M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.24M, False: 6.01M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.24M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.24M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.24M|{ \
  |  |  |  |  |  |  |  |   45|  2.24M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 339k, False: 1.90M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   339k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   339k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.90M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.90M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.90M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.90M|    } \
  |  |  |  |  |  |  |  |   52|  2.24M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.24M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.24M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.24M|{ \
  |  |  |  |  |  |  |  |  128|  2.39M|    do { \
  |  |  |  |  |  |  |  |  129|  2.39M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 315k, False: 2.08M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   315k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   315k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   315k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   315k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   315k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   315k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   315k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   315k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 282k, False: 32.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   282k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 273k, False: 8.24k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   273k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   273k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   273k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   273k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  8.24k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  8.24k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  8.24k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  8.24k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   282k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  32.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  32.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  32.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  32.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   315k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   315k|        } \
  |  |  |  |  |  |  |  |  132|  2.39M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.39M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.39M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.39M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 155k, False: 2.24M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.24M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  6.01M|        } else { \
  |  |  |  |  |  |  154|  6.01M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  6.01M|        } \
  |  |  |  |  |  |  156|  8.25M|    } \
  |  |  |  |  |  |  157|  10.3M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  10.3M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 5.99M, False: 4.34M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  10.3M|                    break; \
  |  |  |  | 1128|  10.3M|            } \
  |  |  |  | 1129|  10.3M|            { \
  |  |  |  | 1130|  4.34M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  4.34M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  4.34M|                                    ci); \
  |  |  |  | 1133|  4.34M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  4.34M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  4.34M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.34M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.34M|{ \
  |  |  |  |  |  |  140|  4.34M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.34M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.34M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.34M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.34M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.34M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.14M, False: 3.19M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.14M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.14M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.14M|{ \
  |  |  |  |  |  |  |  |   57|  1.14M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 258k, False: 888k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   258k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   258k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   258k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   888k|    } else { \
  |  |  |  |  |  |  |  |   62|   888k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   888k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   888k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   888k|    } \
  |  |  |  |  |  |  |  |   66|  1.14M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.14M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.14M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.14M|{ \
  |  |  |  |  |  |  |  |  128|  1.83M|    do { \
  |  |  |  |  |  |  |  |  129|  1.83M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 231k, False: 1.59M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   231k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   231k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   231k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   231k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   231k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   231k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   231k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   231k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 214k, False: 17.9k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   214k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 209k, False: 4.58k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   209k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   209k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   209k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   209k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  4.58k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  4.58k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  4.58k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  4.58k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   214k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  17.9k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  17.9k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  17.9k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  17.9k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   231k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   231k|        } \
  |  |  |  |  |  |  |  |  132|  1.83M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.83M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.83M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.83M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 683k, False: 1.14M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.14M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.19M|    } else {  \
  |  |  |  |  |  |  149|  3.19M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.19M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.19M, False: 2.00M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.19M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.19M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.19M|{ \
  |  |  |  |  |  |  |  |   45|  1.19M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 197k, False: 996k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   197k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   197k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   996k|    } else { \
  |  |  |  |  |  |  |  |   49|   996k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   996k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   996k|    } \
  |  |  |  |  |  |  |  |   52|  1.19M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.19M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.19M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.19M|{ \
  |  |  |  |  |  |  |  |  128|  1.28M|    do { \
  |  |  |  |  |  |  |  |  129|  1.28M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 157k, False: 1.12M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   157k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   157k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   157k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   157k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   157k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   157k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   157k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   157k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 146k, False: 10.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   146k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 143k, False: 3.47k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   143k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   143k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   143k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   143k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.47k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.47k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.47k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.47k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   146k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  10.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  10.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  10.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  10.6k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   157k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   157k|        } \
  |  |  |  |  |  |  |  |  132|  1.28M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.28M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.28M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.28M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 88.9k, False: 1.19M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.19M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.00M|        } else { \
  |  |  |  |  |  |  154|  2.00M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.00M|        } \
  |  |  |  |  |  |  156|  3.19M|    } \
  |  |  |  |  |  |  157|  4.34M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  4.34M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  4.34M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 2.16M, False: 2.17M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  4.34M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  4.34M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  4.34M|{ \
  |  |  |  |  |  |  323|  4.34M|    /* east */ \
  |  |  |  |  |  |  324|  4.34M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.34M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  4.34M| \
  |  |  |  |  |  |  326|  4.34M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  4.34M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.34M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.34M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.34M| \
  |  |  |  |  |  |  329|  4.34M|    /* west */ \
  |  |  |  |  |  |  330|  4.34M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.34M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.34M| \
  |  |  |  |  |  |  332|  4.34M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  4.34M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  4.34M| \
  |  |  |  |  |  |  340|  4.34M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  4.34M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  4.34M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  4.34M|            } \
  |  |  |  | 1139|  4.34M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  10.3M|    } \
  |  |  |  | 1141|  35.4M|}
  |  |  ------------------
  |  | 1314|  35.4M|                                    flags, flagsp, flags_stride, data, \
  |  | 1315|  35.4M|                                    l_w, 1, mqc, curctx, \
  |  | 1316|  35.4M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1317|  35.4M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  35.4M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  35.4M|{ \
  |  |  |  | 1120|  35.4M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  35.4M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  35.4M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  35.4M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  35.4M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 10.3M, False: 25.0M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  10.3M|        do { \
  |  |  |  | 1122|  10.3M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  10.3M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  10.3M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  10.3M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  10.3M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  10.3M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  10.3M|{ \
  |  |  |  |  |  |  140|  10.3M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  10.3M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  10.3M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  10.3M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  10.3M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  10.3M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 2.00M, False: 8.37M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.00M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  2.00M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  2.00M|{ \
  |  |  |  |  |  |  |  |   57|  2.00M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 402k, False: 1.60M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   402k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   402k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   402k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.60M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.60M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.60M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.60M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.60M|    } \
  |  |  |  |  |  |  |  |   66|  2.00M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.00M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.00M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.00M|{ \
  |  |  |  |  |  |  |  |  128|  3.41M|    do { \
  |  |  |  |  |  |  |  |  129|  3.41M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 430k, False: 2.98M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   430k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   430k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   430k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   430k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   430k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   430k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   430k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   430k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 393k, False: 37.0k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   393k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 383k, False: 9.84k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   383k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   383k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   383k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   383k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  9.84k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  9.84k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  9.84k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  9.84k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   393k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  37.0k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  37.0k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  37.0k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  37.0k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   430k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   430k|        } \
  |  |  |  |  |  |  |  |  132|  3.41M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.41M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.41M|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.41M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.41M, False: 2.00M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.00M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  8.37M|    } else {  \
  |  |  |  |  |  |  149|  8.37M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  8.37M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.13M, False: 6.23M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.13M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.13M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.13M|{ \
  |  |  |  |  |  |  |  |   45|  2.13M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 309k, False: 1.82M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   309k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   309k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.82M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.82M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.82M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.82M|    } \
  |  |  |  |  |  |  |  |   52|  2.13M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.13M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.13M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.13M|{ \
  |  |  |  |  |  |  |  |  128|  2.27M|    do { \
  |  |  |  |  |  |  |  |  129|  2.27M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 288k, False: 1.99M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   288k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   288k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   288k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   288k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   288k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   288k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   288k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   288k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 262k, False: 25.4k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   262k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 256k, False: 6.55k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   256k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   256k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   256k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   256k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  6.55k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  6.55k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  6.55k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  6.55k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   262k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  25.4k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  25.4k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  25.4k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  25.4k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   288k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   288k|        } \
  |  |  |  |  |  |  |  |  132|  2.27M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.27M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.27M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.27M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 142k, False: 2.13M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.13M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  6.23M|        } else { \
  |  |  |  |  |  |  154|  6.23M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  6.23M|        } \
  |  |  |  |  |  |  156|  8.37M|    } \
  |  |  |  |  |  |  157|  10.3M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  10.3M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 6.14M, False: 4.23M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  10.3M|                    break; \
  |  |  |  | 1128|  10.3M|            } \
  |  |  |  | 1129|  10.3M|            { \
  |  |  |  | 1130|  4.23M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  4.23M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  4.23M|                                    ci); \
  |  |  |  | 1133|  4.23M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  4.23M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  4.23M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.23M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.23M|{ \
  |  |  |  |  |  |  140|  4.23M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.23M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.23M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.23M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.23M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.23M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.12M, False: 3.11M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.12M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.12M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.12M|{ \
  |  |  |  |  |  |  |  |   57|  1.12M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 244k, False: 880k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   244k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   244k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   244k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   880k|    } else { \
  |  |  |  |  |  |  |  |   62|   880k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   880k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   880k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   880k|    } \
  |  |  |  |  |  |  |  |   66|  1.12M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.12M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.12M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.12M|{ \
  |  |  |  |  |  |  |  |  128|  1.79M|    do { \
  |  |  |  |  |  |  |  |  129|  1.79M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 230k, False: 1.56M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   230k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   230k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   230k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   230k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   230k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   230k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   230k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   230k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 206k, False: 24.2k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   206k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 202k, False: 4.14k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   202k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   202k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   202k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   202k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  4.14k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  4.14k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  4.14k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  4.14k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   206k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  24.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  24.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  24.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  24.2k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   230k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   230k|        } \
  |  |  |  |  |  |  |  |  132|  1.79M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.79M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.79M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.79M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 673k, False: 1.12M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.12M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.11M|    } else {  \
  |  |  |  |  |  |  149|  3.11M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.11M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.15M, False: 1.95M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.15M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.15M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.15M|{ \
  |  |  |  |  |  |  |  |   45|  1.15M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 197k, False: 960k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   197k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   197k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   960k|    } else { \
  |  |  |  |  |  |  |  |   49|   960k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   960k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   960k|    } \
  |  |  |  |  |  |  |  |   52|  1.15M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.15M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.15M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.15M|{ \
  |  |  |  |  |  |  |  |  128|  1.24M|    do { \
  |  |  |  |  |  |  |  |  129|  1.24M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 153k, False: 1.09M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   153k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   153k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   153k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   153k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   153k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   153k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   153k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   153k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 143k, False: 10.6k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   143k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 139k, False: 3.17k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   139k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   139k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   139k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   139k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.17k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.17k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.17k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.17k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   143k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  10.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  10.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  10.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  10.6k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   153k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   153k|        } \
  |  |  |  |  |  |  |  |  132|  1.24M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.24M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.24M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.24M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 91.7k, False: 1.15M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.15M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.95M|        } else { \
  |  |  |  |  |  |  154|  1.95M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.95M|        } \
  |  |  |  |  |  |  156|  3.11M|    } \
  |  |  |  |  |  |  157|  4.23M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  4.23M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  4.23M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 2.13M, False: 2.10M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  4.23M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  4.23M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  4.23M|{ \
  |  |  |  |  |  |  323|  4.23M|    /* east */ \
  |  |  |  |  |  |  324|  4.23M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.23M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  4.23M| \
  |  |  |  |  |  |  326|  4.23M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  4.23M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.23M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.23M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.23M| \
  |  |  |  |  |  |  329|  4.23M|    /* west */ \
  |  |  |  |  |  |  330|  4.23M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.23M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.23M| \
  |  |  |  |  |  |  332|  4.23M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  4.23M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  4.23M| \
  |  |  |  |  |  |  340|  4.23M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  4.23M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  4.23M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  4.23M|            } \
  |  |  |  | 1139|  4.23M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  10.3M|    } \
  |  |  |  | 1141|  35.4M|}
  |  |  ------------------
  |  | 1318|  35.4M|                                    flags, flagsp, flags_stride, data, \
  |  | 1319|  35.4M|                                    l_w, 2, mqc, curctx, \
  |  | 1320|  35.4M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1321|  35.4M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  35.4M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  35.4M|{ \
  |  |  |  | 1120|  35.4M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  35.4M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  35.4M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  35.4M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  35.4M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 10.4M, False: 25.0M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  10.4M|        do { \
  |  |  |  | 1122|  10.4M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  10.4M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  10.4M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  10.4M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  10.4M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  10.4M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  10.4M|{ \
  |  |  |  |  |  |  140|  10.4M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  10.4M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  10.4M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  10.4M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  10.4M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  10.4M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.81M, False: 8.59M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.81M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.81M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.81M|{ \
  |  |  |  |  |  |  |  |   57|  1.81M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 343k, False: 1.46M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   343k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   343k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   343k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.46M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.46M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.46M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.46M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.46M|    } \
  |  |  |  |  |  |  |  |   66|  1.81M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.81M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.81M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.81M|{ \
  |  |  |  |  |  |  |  |  128|  3.13M|    do { \
  |  |  |  |  |  |  |  |  129|  3.13M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 388k, False: 2.75M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   388k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   388k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   388k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   388k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   388k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   388k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   388k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   388k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 362k, False: 25.5k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   362k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 354k, False: 7.82k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   354k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   354k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   354k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   354k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  7.82k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  7.82k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  7.82k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  7.82k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   362k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  25.5k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  25.5k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  25.5k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  25.5k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   388k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   388k|        } \
  |  |  |  |  |  |  |  |  132|  3.13M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.13M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.13M|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.13M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.32M, False: 1.81M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.81M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  8.59M|    } else {  \
  |  |  |  |  |  |  149|  8.59M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  8.59M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.96M, False: 6.62M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.96M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.96M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.96M|{ \
  |  |  |  |  |  |  |  |   45|  1.96M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 276k, False: 1.68M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   276k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   276k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.68M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.68M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.68M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.68M|    } \
  |  |  |  |  |  |  |  |   52|  1.96M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.96M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.96M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.96M|{ \
  |  |  |  |  |  |  |  |  128|  2.09M|    do { \
  |  |  |  |  |  |  |  |  129|  2.09M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 261k, False: 1.83M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   261k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   261k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   261k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   261k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   261k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   261k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   261k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   261k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 245k, False: 16.1k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   245k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 240k, False: 4.91k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   240k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   240k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   240k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   240k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  4.91k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  4.91k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  4.91k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  4.91k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   245k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  16.1k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  16.1k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  16.1k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  16.1k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   261k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   261k|        } \
  |  |  |  |  |  |  |  |  132|  2.09M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.09M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.09M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.09M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 127k, False: 1.96M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.96M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  6.62M|        } else { \
  |  |  |  |  |  |  154|  6.62M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  6.62M|        } \
  |  |  |  |  |  |  156|  8.59M|    } \
  |  |  |  |  |  |  157|  10.4M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  10.4M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 6.44M, False: 3.95M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  10.4M|                    break; \
  |  |  |  | 1128|  10.4M|            } \
  |  |  |  | 1129|  10.4M|            { \
  |  |  |  | 1130|  3.95M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  3.95M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  3.95M|                                    ci); \
  |  |  |  | 1133|  3.95M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  3.95M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  3.95M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  3.95M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  3.95M|{ \
  |  |  |  |  |  |  140|  3.95M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  3.95M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  3.95M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  3.95M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  3.95M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  3.95M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.03M, False: 2.92M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.03M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.03M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.03M|{ \
  |  |  |  |  |  |  |  |   57|  1.03M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 234k, False: 795k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   234k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   234k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   234k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   795k|    } else { \
  |  |  |  |  |  |  |  |   62|   795k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   795k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   795k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   795k|    } \
  |  |  |  |  |  |  |  |   66|  1.03M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.03M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.03M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.03M|{ \
  |  |  |  |  |  |  |  |  128|  1.64M|    do { \
  |  |  |  |  |  |  |  |  129|  1.64M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 208k, False: 1.43M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   208k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   208k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   208k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   208k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   208k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   208k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   208k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   208k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 193k, False: 14.4k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   193k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 190k, False: 3.76k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   190k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   190k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   190k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   190k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.76k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.76k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.76k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.76k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   193k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  14.4k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  14.4k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  14.4k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  14.4k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   208k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   208k|        } \
  |  |  |  |  |  |  |  |  132|  1.64M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.64M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.64M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.64M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 615k, False: 1.03M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.03M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  2.92M|    } else {  \
  |  |  |  |  |  |  149|  2.92M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  2.92M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.07M, False: 1.85M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.07M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.07M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.07M|{ \
  |  |  |  |  |  |  |  |   45|  1.07M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 187k, False: 888k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   187k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   187k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   888k|    } else { \
  |  |  |  |  |  |  |  |   49|   888k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   888k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   888k|    } \
  |  |  |  |  |  |  |  |   52|  1.07M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.07M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.07M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.07M|{ \
  |  |  |  |  |  |  |  |  128|  1.15M|    do { \
  |  |  |  |  |  |  |  |  129|  1.15M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 142k, False: 1.01M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   142k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   142k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   142k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   142k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   142k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   142k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   142k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   142k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 132k, False: 9.60k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   132k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 130k, False: 2.57k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   130k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   130k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   130k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   130k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.57k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.57k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.57k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.57k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   132k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  9.60k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  9.60k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  9.60k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  9.60k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   142k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   142k|        } \
  |  |  |  |  |  |  |  |  132|  1.15M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.15M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.15M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.15M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 83.1k, False: 1.07M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.07M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.85M|        } else { \
  |  |  |  |  |  |  154|  1.85M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.85M|        } \
  |  |  |  |  |  |  156|  2.92M|    } \
  |  |  |  |  |  |  157|  3.95M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  3.95M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  3.95M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 1.97M, False: 1.98M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  3.95M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  3.95M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  3.95M|{ \
  |  |  |  |  |  |  323|  3.95M|    /* east */ \
  |  |  |  |  |  |  324|  3.95M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  3.95M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  3.95M| \
  |  |  |  |  |  |  326|  3.95M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  3.95M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  3.95M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.95M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  3.95M| \
  |  |  |  |  |  |  329|  3.95M|    /* west */ \
  |  |  |  |  |  |  330|  3.95M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  3.95M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  3.95M| \
  |  |  |  |  |  |  332|  3.95M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  3.95M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  3.95M| \
  |  |  |  |  |  |  340|  3.95M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  3.95M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|  3.95M|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|  3.95M|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  3.95M|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  3.95M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  3.95M|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  3.95M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  3.95M|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  3.95M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|  3.95M|    } \
  |  |  |  |  |  |  347|  3.95M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  3.95M|            } \
  |  |  |  | 1139|  3.95M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  10.4M|    } \
  |  |  |  | 1141|  35.4M|}
  |  |  ------------------
  |  | 1322|  35.4M|                                    flags, flagsp, flags_stride, data, \
  |  | 1323|  35.4M|                                    l_w, 3, mqc, curctx, \
  |  | 1324|  35.4M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1325|  35.4M|            } \
  |  | 1326|  48.2M|            *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  36.4M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  36.4M|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  36.4M|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  36.4M|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1327|  36.4M|        } \
  |  | 1328|   754k|    } \
  |  | 1329|  47.1k|    UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  47.1k|        mqc->curctx = curctx; \
  |  |  |  |  167|  47.1k|        mqc->c = c; \
  |  |  |  |  168|  47.1k|        mqc->a = a; \
  |  |  |  |  169|  47.1k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1330|  47.1k|    if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1330:9): [True: 0, False: 47.1k]
  |  |  ------------------
  |  | 1331|      0|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) { \
  |  |  ------------------
  |  |  |  Branch (1331:21): [True: 0, False: 0]
  |  |  ------------------
  |  | 1332|      0|            for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1332:25): [True: 0, False: 0]
  |  |  ------------------
  |  | 1333|      0|                opj_t1_dec_clnpass_step(t1, flagsp, data + j * l_w, oneplushalf, j, vsc); \
  |  | 1334|      0|            } \
  |  | 1335|      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)
  |  |  ------------------
  |  | 1336|      0|        } \
  |  | 1337|      0|    } \
  |  | 1338|  47.1k|}
  ------------------
 1366|  47.1k|}
t1.c:opj_t1_dec_clnpass_generic_vsc:
 1386|   216k|{
 1387|   216k|    opj_t1_dec_clnpass_internal(t1, bpno, OPJ_TRUE, t1->w, t1->h,
  ------------------
  |  | 1251|   216k|#define opj_t1_dec_clnpass_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  | 1252|   216k|{ \
  |  | 1253|   216k|    OPJ_INT32 one, half, oneplushalf; \
  |  | 1254|   216k|    OPJ_UINT32 runlen; \
  |  | 1255|   216k|    OPJ_UINT32 i, j, k; \
  |  | 1256|   216k|    const OPJ_UINT32 l_w = w; \
  |  | 1257|   216k|    opj_mqc_t* mqc = &(t1->mqc); \
  |  | 1258|   216k|    register OPJ_INT32 *data = t1->data; \
  |  | 1259|   216k|    register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  | 1260|   216k|    DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|   216k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|   216k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|   216k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|   216k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  | 1261|   216k|    register OPJ_UINT32 v; \
  |  | 1262|   216k|    one = 1 << bpno; \
  |  | 1263|   216k|    half = one >> 1; \
  |  | 1264|   216k|    oneplushalf = one | half; \
  |  | 1265|  6.87M|    for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (1265:17): [True: 6.65M, False: 216k]
  |  |  ------------------
  |  | 1266|  53.9M|        for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1266:21): [True: 47.3M, False: 6.65M]
  |  |  ------------------
  |  | 1267|  47.3M|            opj_flag_t flags = *flagsp; \
  |  | 1268|  47.3M|            if (flags == 0) { \
  |  |  ------------------
  |  |  |  Branch (1268:17): [True: 16.4M, False: 30.8M]
  |  |  ------------------
  |  | 1269|  16.4M|                OPJ_UINT32 partial = OPJ_TRUE; \
  |  |  ------------------
  |  |  |  |  117|  16.4M|#define OPJ_TRUE 1
  |  |  ------------------
  |  | 1270|  16.4M|                opj_t1_setcurctx(curctx, T1_CTXNO_AGG); \
  |  |  ------------------
  |  |  |  |   62|  16.4M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1271|  16.4M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  16.4M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  16.4M|{ \
  |  |  |  |  140|  16.4M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  16.4M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  16.4M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  16.4M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  16.4M|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  16.4M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 1.00M, False: 15.4M]
  |  |  |  |  ------------------
  |  |  |  |  146|  1.00M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  1.00M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  1.00M|{ \
  |  |  |  |  |  |   57|  1.00M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 145k, False: 860k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|   145k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|   145k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|   145k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   860k|    } else { \
  |  |  |  |  |  |   62|   860k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   860k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   860k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   860k|    } \
  |  |  |  |  |  |   66|  1.00M|}
  |  |  |  |  ------------------
  |  |  |  |  147|  1.00M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  1.00M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  1.00M|{ \
  |  |  |  |  |  |  128|  2.04M|    do { \
  |  |  |  |  |  |  129|  2.04M|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 254k, False: 1.79M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|   254k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|   254k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|   254k|{ \
  |  |  |  |  |  |  |  |  104|   254k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|   254k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|   254k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|   254k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|   254k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 201k, False: 52.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|   201k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 177k, False: 23.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|   177k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|   177k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|   177k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|   177k|            } else { \
  |  |  |  |  |  |  |  |  114|  23.8k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  23.8k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  23.8k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  23.8k|            } \
  |  |  |  |  |  |  |  |  118|   201k|        } else { \
  |  |  |  |  |  |  |  |  119|  52.7k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  52.7k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  52.7k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  52.7k|        } \
  |  |  |  |  |  |  |  |  123|   254k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|   254k|        } \
  |  |  |  |  |  |  132|  2.04M|        a <<= 1; \
  |  |  |  |  |  |  133|  2.04M|        c <<= 1; \
  |  |  |  |  |  |  134|  2.04M|        ct--; \
  |  |  |  |  |  |  135|  2.04M|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 1.04M, False: 1.00M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  1.00M|}
  |  |  |  |  ------------------
  |  |  |  |  148|  15.4M|    } else {  \
  |  |  |  |  149|  15.4M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  15.4M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 1.18M, False: 14.2M]
  |  |  |  |  ------------------
  |  |  |  |  151|  1.18M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.18M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  1.18M|{ \
  |  |  |  |  |  |   45|  1.18M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 117k, False: 1.06M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|   117k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|   117k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  1.06M|    } else { \
  |  |  |  |  |  |   49|  1.06M|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  1.06M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  1.06M|    } \
  |  |  |  |  |  |   52|  1.18M|}
  |  |  |  |  ------------------
  |  |  |  |  152|  1.18M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  1.18M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  1.18M|{ \
  |  |  |  |  |  |  128|  1.23M|    do { \
  |  |  |  |  |  |  129|  1.23M|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 172k, False: 1.06M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|   172k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|   172k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|   172k|{ \
  |  |  |  |  |  |  |  |  104|   172k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|   172k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|   172k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|   172k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|   172k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 132k, False: 39.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|   132k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 121k, False: 11.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|   121k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|   121k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|   121k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|   121k|            } else { \
  |  |  |  |  |  |  |  |  114|  11.0k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  11.0k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  11.0k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  11.0k|            } \
  |  |  |  |  |  |  |  |  118|   132k|        } else { \
  |  |  |  |  |  |  |  |  119|  39.6k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  39.6k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  39.6k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  39.6k|        } \
  |  |  |  |  |  |  |  |  123|   172k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|   172k|        } \
  |  |  |  |  |  |  132|  1.23M|        a <<= 1; \
  |  |  |  |  |  |  133|  1.23M|        c <<= 1; \
  |  |  |  |  |  |  134|  1.23M|        ct--; \
  |  |  |  |  |  |  135|  1.23M|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 51.1k, False: 1.18M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  1.18M|}
  |  |  |  |  ------------------
  |  |  |  |  153|  14.2M|        } else { \
  |  |  |  |  154|  14.2M|            d = (*curctx)->mps; \
  |  |  |  |  155|  14.2M|        } \
  |  |  |  |  156|  15.4M|    } \
  |  |  |  |  157|  16.4M|}
  |  |  ------------------
  |  | 1272|  16.4M|                if (!v) { \
  |  |  ------------------
  |  |  |  Branch (1272:21): [True: 15.2M, False: 1.17M]
  |  |  ------------------
  |  | 1273|  15.2M|                    continue; \
  |  | 1274|  15.2M|                } \
  |  | 1275|  16.4M|                opj_t1_setcurctx(curctx, T1_CTXNO_UNI); \
  |  |  ------------------
  |  |  |  |   62|  1.17M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1276|  1.17M|                opj_mqc_decode_macro(runlen, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  1.17M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  1.17M|{ \
  |  |  |  |  140|  1.17M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  1.17M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  1.17M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  1.17M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  1.17M|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  1.17M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 586k, False: 588k]
  |  |  |  |  ------------------
  |  |  |  |  146|   586k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   586k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   586k|{ \
  |  |  |  |  |  |   57|   586k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 332k, False: 254k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|   332k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|   332k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|   332k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   332k|    } else { \
  |  |  |  |  |  |   62|   254k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   254k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   254k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   254k|    } \
  |  |  |  |  |  |   66|   586k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   586k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   586k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   586k|{ \
  |  |  |  |  |  |  128|   586k|    do { \
  |  |  |  |  |  |  129|   586k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 72.6k, False: 514k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  72.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  72.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  72.6k|{ \
  |  |  |  |  |  |  |  |  104|  72.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  72.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  72.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  72.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  72.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 64.3k, False: 8.34k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  64.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 58.6k, False: 5.67k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  58.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  58.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  58.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  58.6k|            } else { \
  |  |  |  |  |  |  |  |  114|  5.67k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  5.67k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  5.67k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  5.67k|            } \
  |  |  |  |  |  |  |  |  118|  64.3k|        } else { \
  |  |  |  |  |  |  |  |  119|  8.34k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  8.34k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  8.34k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  8.34k|        } \
  |  |  |  |  |  |  |  |  123|  72.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  72.6k|        } \
  |  |  |  |  |  |  132|   586k|        a <<= 1; \
  |  |  |  |  |  |  133|   586k|        c <<= 1; \
  |  |  |  |  |  |  134|   586k|        ct--; \
  |  |  |  |  |  |  135|   586k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 586k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   586k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   588k|    } else {  \
  |  |  |  |  149|   588k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   588k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 459k, False: 128k]
  |  |  |  |  ------------------
  |  |  |  |  151|   459k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   459k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   459k|{ \
  |  |  |  |  |  |   45|   459k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 254k, False: 204k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|   254k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|   254k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   254k|    } else { \
  |  |  |  |  |  |   49|   204k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   204k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   204k|    } \
  |  |  |  |  |  |   52|   459k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   459k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   459k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   459k|{ \
  |  |  |  |  |  |  128|   560k|    do { \
  |  |  |  |  |  |  129|   560k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 72.2k, False: 488k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  72.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  72.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  72.2k|{ \
  |  |  |  |  |  |  |  |  104|  72.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  72.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  72.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  72.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  72.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 58.9k, False: 13.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  58.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 55.7k, False: 3.18k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  55.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  55.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  55.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  55.7k|            } else { \
  |  |  |  |  |  |  |  |  114|  3.18k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  3.18k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  3.18k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  3.18k|            } \
  |  |  |  |  |  |  |  |  118|  58.9k|        } else { \
  |  |  |  |  |  |  |  |  119|  13.3k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  13.3k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  13.3k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  13.3k|        } \
  |  |  |  |  |  |  |  |  123|  72.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  72.2k|        } \
  |  |  |  |  |  |  132|   560k|        a <<= 1; \
  |  |  |  |  |  |  133|   560k|        c <<= 1; \
  |  |  |  |  |  |  134|   560k|        ct--; \
  |  |  |  |  |  |  135|   560k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 101k, False: 459k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   459k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   459k|        } else { \
  |  |  |  |  154|   128k|            d = (*curctx)->mps; \
  |  |  |  |  155|   128k|        } \
  |  |  |  |  156|   588k|    } \
  |  |  |  |  157|  1.17M|}
  |  |  ------------------
  |  | 1277|  1.17M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  1.17M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  1.17M|{ \
  |  |  |  |  140|  1.17M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  1.17M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  1.17M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  1.17M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  1.17M|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  1.17M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 591k, False: 583k]
  |  |  |  |  ------------------
  |  |  |  |  146|   591k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   591k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   591k|{ \
  |  |  |  |  |  |   57|   591k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 168k, False: 423k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|   168k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|   168k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|   168k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   423k|    } else { \
  |  |  |  |  |  |   62|   423k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   423k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   423k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   423k|    } \
  |  |  |  |  |  |   66|   591k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   591k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   591k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   591k|{ \
  |  |  |  |  |  |  128|   591k|    do { \
  |  |  |  |  |  |  129|   591k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 71.9k, False: 519k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  71.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  71.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  71.9k|{ \
  |  |  |  |  |  |  |  |  104|  71.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  71.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  71.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  71.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  71.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 59.6k, False: 12.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  59.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 56.5k, False: 3.13k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  56.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  56.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  56.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  56.5k|            } else { \
  |  |  |  |  |  |  |  |  114|  3.13k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  3.13k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  3.13k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  3.13k|            } \
  |  |  |  |  |  |  |  |  118|  59.6k|        } else { \
  |  |  |  |  |  |  |  |  119|  12.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  12.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  12.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  12.2k|        } \
  |  |  |  |  |  |  |  |  123|  71.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  71.9k|        } \
  |  |  |  |  |  |  132|   591k|        a <<= 1; \
  |  |  |  |  |  |  133|   591k|        c <<= 1; \
  |  |  |  |  |  |  134|   591k|        ct--; \
  |  |  |  |  |  |  135|   591k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 591k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   591k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   591k|    } else {  \
  |  |  |  |  149|   583k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   583k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 487k, False: 95.4k]
  |  |  |  |  ------------------
  |  |  |  |  151|   487k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   487k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   487k|{ \
  |  |  |  |  |  |   45|   487k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 115k, False: 372k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|   115k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|   115k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   372k|    } else { \
  |  |  |  |  |  |   49|   372k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   372k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   372k|    } \
  |  |  |  |  |  |   52|   487k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   487k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   487k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   487k|{ \
  |  |  |  |  |  |  128|   554k|    do { \
  |  |  |  |  |  |  129|   554k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 68.3k, False: 485k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  68.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  68.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  68.3k|{ \
  |  |  |  |  |  |  |  |  104|  68.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  68.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  68.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  68.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  68.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 58.6k, False: 9.69k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  58.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 55.7k, False: 2.91k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  55.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  55.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  55.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  55.7k|            } else { \
  |  |  |  |  |  |  |  |  114|  2.91k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  2.91k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  2.91k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  2.91k|            } \
  |  |  |  |  |  |  |  |  118|  58.6k|        } else { \
  |  |  |  |  |  |  |  |  119|  9.69k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  9.69k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  9.69k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  9.69k|        } \
  |  |  |  |  |  |  |  |  123|  68.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  68.3k|        } \
  |  |  |  |  |  |  132|   554k|        a <<= 1; \
  |  |  |  |  |  |  133|   554k|        c <<= 1; \
  |  |  |  |  |  |  134|   554k|        ct--; \
  |  |  |  |  |  |  135|   554k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 66.4k, False: 487k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   487k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   487k|        } else { \
  |  |  |  |  154|  95.4k|            d = (*curctx)->mps; \
  |  |  |  |  155|  95.4k|        } \
  |  |  |  |  156|   583k|    } \
  |  |  |  |  157|  1.17M|}
  |  |  ------------------
  |  | 1278|  1.17M|                runlen = (runlen << 1) | v; \
  |  | 1279|  1.17M|                switch(runlen) { \
  |  |  ------------------
  |  |  |  Branch (1279:24): [True: 0, False: 1.17M]
  |  |  ------------------
  |  | 1280|   362k|                    case 0: \
  |  |  ------------------
  |  |  |  Branch (1280:21): [True: 362k, False: 812k]
  |  |  ------------------
  |  | 1281|   362k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, OPJ_TRUE,\
  |  |  ------------------
  |  |  |  | 1118|   362k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   362k|{ \
  |  |  |  | 1120|   362k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   362k|        do { \
  |  |  |  | 1122|   362k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|      0|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|      0|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|      0|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|      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|}
  |  |  |  |  ------------------
  |  |  |  | 1126|      0|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1127|      0|                    break; \
  |  |  |  | 1128|      0|            } \
  |  |  |  | 1129|   362k|            { \
  |  |  |  | 1130|   362k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   362k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   362k|                                    ci); \
  |  |  |  | 1133|   362k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   362k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   362k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   362k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   362k|{ \
  |  |  |  |  |  |  140|   362k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   362k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   362k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   362k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   362k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   362k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 109k, False: 253k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 6.04k, False: 103k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  6.04k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  6.04k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  6.04k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   103k|    } else { \
  |  |  |  |  |  |  |  |   62|   103k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   103k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   103k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   103k|    } \
  |  |  |  |  |  |  |  |   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|   179k|    do { \
  |  |  |  |  |  |  |  |  129|   179k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 19.5k, False: 160k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  19.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  19.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  19.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  19.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  19.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  19.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  19.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  19.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 17.2k, False: 2.38k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  17.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 16.2k, False: 920]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  16.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  16.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  16.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  16.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    920|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    920|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    920|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    920|            } \
  |  |  |  |  |  |  |  |  |  |  118|  17.2k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.38k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.38k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.38k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.38k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  19.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  19.5k|        } \
  |  |  |  |  |  |  |  |  132|   179k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   179k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   179k|        ct--; \
  |  |  |  |  |  |  |  |  135|   179k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 70.3k, False: 109k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   109k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   253k|    } else {  \
  |  |  |  |  |  |  149|   253k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   253k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 124k, False: 128k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   124k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   124k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   124k|{ \
  |  |  |  |  |  |  |  |   45|   124k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 5.83k, False: 118k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  5.83k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  5.83k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   118k|    } else { \
  |  |  |  |  |  |  |  |   49|   118k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   118k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   118k|    } \
  |  |  |  |  |  |  |  |   52|   124k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   124k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   124k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   124k|{ \
  |  |  |  |  |  |  |  |  128|   125k|    do { \
  |  |  |  |  |  |  |  |  129|   125k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.0k, False: 109k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  16.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  16.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  16.0k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  16.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  16.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  16.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  16.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  16.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 14.1k, False: 1.86k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  14.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.4k, False: 1.71k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.71k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.71k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.71k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.71k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  14.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.86k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.86k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.86k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.86k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.0k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.0k|        } \
  |  |  |  |  |  |  |  |  132|   125k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   125k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   125k|        ct--; \
  |  |  |  |  |  |  |  |  135|   125k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.05k, False: 124k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   124k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   128k|        } else { \
  |  |  |  |  |  |  154|   128k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   128k|        } \
  |  |  |  |  |  |  156|   253k|    } \
  |  |  |  |  |  |  157|   362k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   362k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   362k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 170k, False: 191k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   362k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   362k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   362k|{ \
  |  |  |  |  |  |  323|   362k|    /* east */ \
  |  |  |  |  |  |  324|   362k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   362k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   362k| \
  |  |  |  |  |  |  326|   362k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   362k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   362k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   362k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   362k| \
  |  |  |  |  |  |  329|   362k|    /* west */ \
  |  |  |  |  |  |  330|   362k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   362k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   362k| \
  |  |  |  |  |  |  332|   362k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   362k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   362k| \
  |  |  |  |  |  |  340|   362k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   362k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|   362k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   362k|            } \
  |  |  |  | 1139|   362k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   362k|    } \
  |  |  |  | 1141|   362k|}
  |  |  ------------------
  |  | 1282|   362k|                                            flags, flagsp, flags_stride, data, \
  |  | 1283|   362k|                                            l_w, 0, mqc, curctx, \
  |  | 1284|   362k|                                            v, a, c, ct, oneplushalf, vsc); \
  |  | 1285|   362k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   362k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1286|   362k|                        /* FALLTHRU */ \
  |  | 1287|   665k|                    case 1: \
  |  |  ------------------
  |  |  |  Branch (1287:21): [True: 303k, False: 871k]
  |  |  ------------------
  |  | 1288|   665k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1118|   665k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   665k|{ \
  |  |  |  | 1120|   665k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   665k|        do { \
  |  |  |  | 1122|   665k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [True: 362k, False: 303k]
  |  |  |  |  ------------------
  |  |  |  | 1123|   362k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|   362k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   362k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|   362k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   362k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   362k|{ \
  |  |  |  |  |  |  140|   362k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   362k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   362k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   362k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   362k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   362k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 92.0k, False: 270k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  92.0k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  92.0k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  92.0k|{ \
  |  |  |  |  |  |  |  |   57|  92.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 18.7k, False: 73.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  18.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  18.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  18.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  73.2k|    } else { \
  |  |  |  |  |  |  |  |   62|  73.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  73.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  73.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  73.2k|    } \
  |  |  |  |  |  |  |  |   66|  92.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  92.0k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  92.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  92.0k|{ \
  |  |  |  |  |  |  |  |  128|   147k|    do { \
  |  |  |  |  |  |  |  |  129|   147k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 19.6k, False: 127k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 16.7k, False: 2.92k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  16.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 15.0k, False: 1.69k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  15.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  15.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  15.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  15.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.69k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.69k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.69k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.69k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  16.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.92k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.92k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.92k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.92k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  19.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  19.6k|        } \
  |  |  |  |  |  |  |  |  132|   147k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   147k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   147k|        ct--; \
  |  |  |  |  |  |  |  |  135|   147k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 55.2k, False: 92.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  92.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   270k|    } else {  \
  |  |  |  |  |  |  149|   270k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   270k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 102k, False: 168k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 15.1k, False: 87.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  15.1k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  15.1k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  87.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  87.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  87.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  87.0k|    } \
  |  |  |  |  |  |  |  |   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|   110k|    do { \
  |  |  |  |  |  |  |  |  129|   110k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 14.3k, False: 96.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 11.6k, False: 2.65k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 11.0k, False: 641]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  11.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  11.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  11.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  11.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    641|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    641|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    641|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    641|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.65k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.65k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.65k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.65k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  14.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  14.3k|        } \
  |  |  |  |  |  |  |  |  132|   110k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   110k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   110k|        ct--; \
  |  |  |  |  |  |  |  |  135|   110k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 8.51k, False: 102k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   102k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   168k|        } else { \
  |  |  |  |  |  |  154|   168k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   168k|        } \
  |  |  |  |  |  |  156|   270k|    } \
  |  |  |  |  |  |  157|   362k|}
  |  |  |  |  ------------------
  |  |  |  | 1126|   362k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 244k, False: 118k]
  |  |  |  |  ------------------
  |  |  |  | 1127|   362k|                    break; \
  |  |  |  | 1128|   362k|            } \
  |  |  |  | 1129|   665k|            { \
  |  |  |  | 1130|   421k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   421k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   421k|                                    ci); \
  |  |  |  | 1133|   421k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   421k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   421k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   421k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   421k|{ \
  |  |  |  |  |  |  140|   421k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   421k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   421k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   421k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   421k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   421k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 119k, False: 301k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   119k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   119k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   119k|{ \
  |  |  |  |  |  |  |  |   57|   119k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 9.54k, False: 110k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  9.54k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  9.54k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  9.54k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   110k|    } else { \
  |  |  |  |  |  |  |  |   62|   110k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   110k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   110k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   110k|    } \
  |  |  |  |  |  |  |  |   66|   119k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   119k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   119k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   119k|{ \
  |  |  |  |  |  |  |  |  128|   187k|    do { \
  |  |  |  |  |  |  |  |  129|   187k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 23.4k, False: 164k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 21.1k, False: 2.34k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  21.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 19.7k, False: 1.41k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  19.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  19.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  19.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  19.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.41k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.41k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.41k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.41k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  21.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.34k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.34k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.34k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.34k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  23.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  23.4k|        } \
  |  |  |  |  |  |  |  |  132|   187k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   187k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   187k|        ct--; \
  |  |  |  |  |  |  |  |  135|   187k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 68.2k, False: 119k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   119k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   301k|    } else {  \
  |  |  |  |  |  |  149|   301k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   301k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 147k, False: 154k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   147k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   147k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   147k|{ \
  |  |  |  |  |  |  |  |   45|   147k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 6.35k, False: 140k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  6.35k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  6.35k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   140k|    } else { \
  |  |  |  |  |  |  |  |   49|   140k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   140k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   140k|    } \
  |  |  |  |  |  |  |  |   52|   147k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   147k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   147k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   147k|{ \
  |  |  |  |  |  |  |  |  128|   149k|    do { \
  |  |  |  |  |  |  |  |  129|   149k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 18.3k, False: 130k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  18.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  18.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  18.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  18.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  18.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  18.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  18.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  18.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 14.3k, False: 3.98k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  14.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.6k, False: 753]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  13.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  13.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  13.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  13.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    753|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    753|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    753|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    753|            } \
  |  |  |  |  |  |  |  |  |  |  118|  14.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.98k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.98k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.98k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.98k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  18.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  18.3k|        } \
  |  |  |  |  |  |  |  |  132|   149k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   149k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   149k|        ct--; \
  |  |  |  |  |  |  |  |  135|   149k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.24k, False: 147k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   147k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   154k|        } else { \
  |  |  |  |  |  |  154|   154k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   154k|        } \
  |  |  |  |  |  |  156|   301k|    } \
  |  |  |  |  |  |  157|   421k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   421k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   421k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 199k, False: 222k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   421k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   421k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   421k|{ \
  |  |  |  |  |  |  323|   421k|    /* east */ \
  |  |  |  |  |  |  324|   421k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   421k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   421k| \
  |  |  |  |  |  |  326|   421k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   421k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   421k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   421k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   421k| \
  |  |  |  |  |  |  329|   421k|    /* west */ \
  |  |  |  |  |  |  330|   421k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   421k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   421k| \
  |  |  |  |  |  |  332|   421k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   421k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   421k| \
  |  |  |  |  |  |  340|   421k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   421k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|   421k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   421k|            } \
  |  |  |  | 1139|   421k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   665k|    } \
  |  |  |  | 1141|   665k|}
  |  |  ------------------
  |  | 1289|   665k|                                            flags, flagsp, flags_stride, data, \
  |  | 1290|   665k|                                            l_w, 1, mqc, curctx, \
  |  | 1291|   665k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1292|   665k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   665k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1293|   665k|                        /* FALLTHRU */ \
  |  | 1294|   939k|                    case 2: \
  |  |  ------------------
  |  |  |  Branch (1294:21): [True: 273k, False: 901k]
  |  |  ------------------
  |  | 1295|   939k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1118|   939k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   939k|{ \
  |  |  |  | 1120|   939k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   939k|        do { \
  |  |  |  | 1122|   939k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [True: 665k, False: 273k]
  |  |  |  |  ------------------
  |  |  |  | 1123|   665k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|   665k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   665k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|   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: 123k, False: 542k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   123k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   123k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   123k|{ \
  |  |  |  |  |  |  |  |   57|   123k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 27.3k, False: 95.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  27.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  27.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  27.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  95.9k|    } else { \
  |  |  |  |  |  |  |  |   62|  95.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  95.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  95.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  95.9k|    } \
  |  |  |  |  |  |  |  |   66|   123k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   123k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   123k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   123k|{ \
  |  |  |  |  |  |  |  |  128|   200k|    do { \
  |  |  |  |  |  |  |  |  129|   200k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 24.7k, False: 175k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 21.9k, False: 2.80k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  21.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 20.4k, False: 1.54k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  20.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  20.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  20.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  20.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.54k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.54k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.54k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.54k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  21.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.80k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.80k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.80k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.80k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  24.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  24.7k|        } \
  |  |  |  |  |  |  |  |  132|   200k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   200k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   200k|        ct--; \
  |  |  |  |  |  |  |  |  135|   200k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 77.3k, False: 123k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   123k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   542k|    } else {  \
  |  |  |  |  |  |  149|   542k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   542k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 148k, False: 394k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   148k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   148k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   148k|{ \
  |  |  |  |  |  |  |  |   45|   148k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 21.8k, False: 126k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  21.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  21.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   126k|    } else { \
  |  |  |  |  |  |  |  |   49|   126k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   126k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   126k|    } \
  |  |  |  |  |  |  |  |   52|   148k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   148k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   148k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   148k|{ \
  |  |  |  |  |  |  |  |  128|   159k|    do { \
  |  |  |  |  |  |  |  |  129|   159k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 19.0k, False: 140k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  19.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  19.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  19.0k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  19.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  19.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  19.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  19.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  19.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 16.0k, False: 3.03k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  16.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 15.0k, False: 1.01k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  15.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  15.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  15.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  15.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.01k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.01k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.01k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.01k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  16.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.03k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.03k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.03k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.03k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  19.0k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  19.0k|        } \
  |  |  |  |  |  |  |  |  132|   159k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   159k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   159k|        ct--; \
  |  |  |  |  |  |  |  |  135|   159k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 11.1k, False: 148k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   148k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   394k|        } else { \
  |  |  |  |  |  |  154|   394k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   394k|        } \
  |  |  |  |  |  |  156|   542k|    } \
  |  |  |  |  |  |  157|   665k|}
  |  |  |  |  ------------------
  |  |  |  | 1126|   665k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 487k, False: 178k]
  |  |  |  |  ------------------
  |  |  |  | 1127|   665k|                    break; \
  |  |  |  | 1128|   665k|            } \
  |  |  |  | 1129|   939k|            { \
  |  |  |  | 1130|   451k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   451k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   451k|                                    ci); \
  |  |  |  | 1133|   451k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   451k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   451k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   451k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   451k|{ \
  |  |  |  |  |  |  140|   451k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   451k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   451k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   451k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   451k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   451k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 131k, False: 320k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   131k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   131k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   131k|{ \
  |  |  |  |  |  |  |  |   57|   131k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 17.0k, False: 114k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  17.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  17.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  17.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   114k|    } else { \
  |  |  |  |  |  |  |  |   62|   114k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   114k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   114k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   114k|    } \
  |  |  |  |  |  |  |  |   66|   131k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   131k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   131k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   131k|{ \
  |  |  |  |  |  |  |  |  128|   212k|    do { \
  |  |  |  |  |  |  |  |  129|   212k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 26.1k, False: 185k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  26.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  26.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  26.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  26.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  26.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  26.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  26.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  26.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 23.5k, False: 2.62k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  23.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 22.4k, False: 1.16k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  22.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  22.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  22.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  22.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.16k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.16k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.16k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.16k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  23.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.62k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.62k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.62k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.62k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  26.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  26.1k|        } \
  |  |  |  |  |  |  |  |  132|   212k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   212k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   212k|        ct--; \
  |  |  |  |  |  |  |  |  135|   212k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 80.7k, False: 131k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   131k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   320k|    } else {  \
  |  |  |  |  |  |  149|   320k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   320k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 153k, False: 166k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   153k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   153k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   153k|{ \
  |  |  |  |  |  |  |  |   45|   153k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 12.0k, False: 141k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  12.0k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  12.0k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   141k|    } else { \
  |  |  |  |  |  |  |  |   49|   141k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   141k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   141k|    } \
  |  |  |  |  |  |  |  |   52|   153k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   153k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   153k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   153k|{ \
  |  |  |  |  |  |  |  |  128|   160k|    do { \
  |  |  |  |  |  |  |  |  129|   160k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 21.5k, False: 138k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  21.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  21.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  21.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  21.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  21.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  21.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  21.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  21.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 18.5k, False: 2.99k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  18.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 16.8k, False: 1.73k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  16.8k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  16.8k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  16.8k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  16.8k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.73k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.73k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.73k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.73k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  18.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.99k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.99k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.99k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.99k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  21.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  21.5k|        } \
  |  |  |  |  |  |  |  |  132|   160k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   160k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   160k|        ct--; \
  |  |  |  |  |  |  |  |  135|   160k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 6.16k, False: 153k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   153k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   166k|        } else { \
  |  |  |  |  |  |  154|   166k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   166k|        } \
  |  |  |  |  |  |  156|   320k|    } \
  |  |  |  |  |  |  157|   451k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   451k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   451k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 221k, False: 230k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   451k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   451k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   451k|{ \
  |  |  |  |  |  |  323|   451k|    /* east */ \
  |  |  |  |  |  |  324|   451k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   451k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   451k| \
  |  |  |  |  |  |  326|   451k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   451k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   451k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   451k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   451k| \
  |  |  |  |  |  |  329|   451k|    /* west */ \
  |  |  |  |  |  |  330|   451k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   451k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   451k| \
  |  |  |  |  |  |  332|   451k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   451k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   451k| \
  |  |  |  |  |  |  340|   451k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   451k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|   451k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   451k|            } \
  |  |  |  | 1139|   451k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   939k|    } \
  |  |  |  | 1141|   939k|}
  |  |  ------------------
  |  | 1296|   939k|                                            flags, flagsp, flags_stride, data, \
  |  | 1297|   939k|                                            l_w, 2, mqc, curctx, \
  |  | 1298|   939k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1299|   939k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   939k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1300|   939k|                        /* FALLTHRU */ \
  |  | 1301|  1.17M|                    case 3: \
  |  |  ------------------
  |  |  |  Branch (1301:21): [True: 235k, False: 939k]
  |  |  ------------------
  |  | 1302|  1.17M|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1118|  1.17M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  1.17M|{ \
  |  |  |  | 1120|  1.17M|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|  1.17M|        do { \
  |  |  |  | 1122|  1.17M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [True: 939k, False: 235k]
  |  |  |  |  ------------------
  |  |  |  | 1123|   939k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|   939k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   939k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|   939k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   939k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   939k|{ \
  |  |  |  |  |  |  140|   939k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   939k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   939k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   939k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   939k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   939k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 147k, False: 792k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   147k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   147k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   147k|{ \
  |  |  |  |  |  |  |  |   57|   147k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 33.0k, False: 114k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  33.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  33.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  33.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   114k|    } else { \
  |  |  |  |  |  |  |  |   62|   114k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   114k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   114k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   114k|    } \
  |  |  |  |  |  |  |  |   66|   147k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   147k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   147k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   147k|{ \
  |  |  |  |  |  |  |  |  128|   252k|    do { \
  |  |  |  |  |  |  |  |  129|   252k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 33.6k, False: 218k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  33.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  33.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  33.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  33.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  33.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  33.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  33.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  33.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 27.0k, False: 6.66k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  27.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 25.2k, False: 1.79k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  25.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  25.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  25.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  25.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.79k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.79k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.79k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.79k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  27.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.66k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.66k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.66k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.66k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  33.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  33.6k|        } \
  |  |  |  |  |  |  |  |  132|   252k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   252k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   252k|        ct--; \
  |  |  |  |  |  |  |  |  135|   252k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 105k, False: 147k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   147k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   792k|    } else {  \
  |  |  |  |  |  |  149|   792k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   792k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 165k, False: 626k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   165k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   165k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   165k|{ \
  |  |  |  |  |  |  |  |   45|   165k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 22.2k, False: 142k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  22.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  22.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   142k|    } else { \
  |  |  |  |  |  |  |  |   49|   142k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   142k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   142k|    } \
  |  |  |  |  |  |  |  |   52|   165k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   165k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   165k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   165k|{ \
  |  |  |  |  |  |  |  |  128|   176k|    do { \
  |  |  |  |  |  |  |  |  129|   176k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 24.4k, False: 152k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 20.7k, False: 3.77k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  20.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 19.1k, False: 1.52k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  19.1k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  19.1k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  19.1k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  19.1k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.52k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.52k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.52k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.52k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  20.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  3.77k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  3.77k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  3.77k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  3.77k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  24.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  24.4k|        } \
  |  |  |  |  |  |  |  |  132|   176k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   176k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   176k|        ct--; \
  |  |  |  |  |  |  |  |  135|   176k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 11.7k, False: 165k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   165k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   626k|        } else { \
  |  |  |  |  |  |  154|   626k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   626k|        } \
  |  |  |  |  |  |  156|   792k|    } \
  |  |  |  |  |  |  157|   939k|}
  |  |  |  |  ------------------
  |  |  |  | 1126|   939k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 720k, False: 218k]
  |  |  |  |  ------------------
  |  |  |  | 1127|   939k|                    break; \
  |  |  |  | 1128|   939k|            } \
  |  |  |  | 1129|  1.17M|            { \
  |  |  |  | 1130|   454k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   454k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   454k|                                    ci); \
  |  |  |  | 1133|   454k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   454k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   454k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   454k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   454k|{ \
  |  |  |  |  |  |  140|   454k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   454k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   454k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   454k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   454k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   454k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 141k, False: 312k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 16.9k, False: 124k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  16.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  16.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  16.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   124k|    } else { \
  |  |  |  |  |  |  |  |   62|   124k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   124k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   124k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   124k|    } \
  |  |  |  |  |  |  |  |   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|   219k|    do { \
  |  |  |  |  |  |  |  |  129|   219k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 25.7k, False: 193k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  25.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  25.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  25.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  25.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  25.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  25.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  25.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  25.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 23.2k, False: 2.45k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  23.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 22.1k, False: 1.07k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  22.1k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  22.1k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  22.1k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  22.1k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.07k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.07k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.07k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.07k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  23.2k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.45k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.45k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.45k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.45k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  25.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  25.7k|        } \
  |  |  |  |  |  |  |  |  132|   219k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   219k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   219k|        ct--; \
  |  |  |  |  |  |  |  |  135|   219k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 77.8k, False: 141k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   141k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   312k|    } else {  \
  |  |  |  |  |  |  149|   312k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   312k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 147k, False: 165k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   147k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   147k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   147k|{ \
  |  |  |  |  |  |  |  |   45|   147k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 12.2k, False: 135k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  12.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  12.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   135k|    } else { \
  |  |  |  |  |  |  |  |   49|   135k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   135k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   135k|    } \
  |  |  |  |  |  |  |  |   52|   147k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   147k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   147k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   147k|{ \
  |  |  |  |  |  |  |  |  128|   152k|    do { \
  |  |  |  |  |  |  |  |  129|   152k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 20.8k, False: 132k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 18.4k, False: 2.34k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  18.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 16.5k, False: 1.93k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  16.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  16.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  16.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  16.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.93k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.93k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.93k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.93k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  18.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.34k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.34k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.34k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.34k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  20.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  20.8k|        } \
  |  |  |  |  |  |  |  |  132|   152k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   152k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   152k|        ct--; \
  |  |  |  |  |  |  |  |  135|   152k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.40k, False: 147k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   147k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   165k|        } else { \
  |  |  |  |  |  |  154|   165k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   165k|        } \
  |  |  |  |  |  |  156|   312k|    } \
  |  |  |  |  |  |  157|   454k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   454k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   454k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 227k, False: 226k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   454k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   454k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   454k|{ \
  |  |  |  |  |  |  323|   454k|    /* east */ \
  |  |  |  |  |  |  324|   454k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   454k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   454k| \
  |  |  |  |  |  |  326|   454k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   454k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   454k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   454k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   454k| \
  |  |  |  |  |  |  329|   454k|    /* west */ \
  |  |  |  |  |  |  330|   454k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   454k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   454k| \
  |  |  |  |  |  |  332|   454k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   454k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   454k| \
  |  |  |  |  |  |  340|   454k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   454k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|   454k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|   454k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   454k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   454k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|   454k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   454k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   454k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   454k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|   454k|    } \
  |  |  |  |  |  |  347|   454k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   454k|            } \
  |  |  |  | 1139|   454k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  1.17M|    } \
  |  |  |  | 1141|  1.17M|}
  |  |  ------------------
  |  | 1303|  1.17M|                                            flags, flagsp, flags_stride, data, \
  |  | 1304|  1.17M|                                            l_w, 3, mqc, curctx, \
  |  | 1305|  1.17M|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1306|  1.17M|                        break; \
  |  | 1307|  1.17M|                } \
  |  | 1308|  30.8M|            } else { \
  |  | 1309|  30.8M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  30.8M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  30.8M|{ \
  |  |  |  | 1120|  30.8M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  30.8M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  30.8M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  30.8M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  30.8M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 6.68M, False: 24.1M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  6.68M|        do { \
  |  |  |  | 1122|  6.68M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  6.68M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  6.68M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  6.68M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  6.68M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  6.68M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  6.68M|{ \
  |  |  |  |  |  |  140|  6.68M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  6.68M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  6.68M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  6.68M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  6.68M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  6.68M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.43M, False: 5.24M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.43M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.43M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.43M|{ \
  |  |  |  |  |  |  |  |   57|  1.43M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 314k, False: 1.12M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   314k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   314k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   314k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.12M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.12M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.12M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.12M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.12M|    } \
  |  |  |  |  |  |  |  |   66|  1.43M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.43M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.43M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.43M|{ \
  |  |  |  |  |  |  |  |  128|  2.36M|    do { \
  |  |  |  |  |  |  |  |  129|  2.36M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 292k, False: 2.07M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   292k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   292k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   292k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   292k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   292k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   292k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   292k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   292k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 266k, False: 26.5k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   266k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 256k, False: 9.40k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   256k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   256k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   256k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   256k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  9.40k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  9.40k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  9.40k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  9.40k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   266k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  26.5k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  26.5k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  26.5k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  26.5k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   292k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   292k|        } \
  |  |  |  |  |  |  |  |  132|  2.36M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.36M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.36M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.36M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 928k, False: 1.43M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.43M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  5.24M|    } else {  \
  |  |  |  |  |  |  149|  5.24M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  5.24M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.50M, False: 3.73M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.50M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.50M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.50M|{ \
  |  |  |  |  |  |  |  |   45|  1.50M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 247k, False: 1.26M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   247k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   247k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.26M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.26M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.26M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.26M|    } \
  |  |  |  |  |  |  |  |   52|  1.50M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.50M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.50M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.50M|{ \
  |  |  |  |  |  |  |  |  128|  1.61M|    do { \
  |  |  |  |  |  |  |  |  129|  1.61M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 204k, False: 1.41M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   204k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   204k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   204k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   204k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   204k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   204k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   204k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   204k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 189k, False: 15.0k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   189k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 180k, False: 9.41k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   180k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   180k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   180k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   180k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  9.41k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  9.41k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  9.41k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  9.41k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   189k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  15.0k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  15.0k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  15.0k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  15.0k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   204k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   204k|        } \
  |  |  |  |  |  |  |  |  132|  1.61M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.61M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.61M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.61M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 109k, False: 1.50M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.50M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.73M|        } else { \
  |  |  |  |  |  |  154|  3.73M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  3.73M|        } \
  |  |  |  |  |  |  156|  5.24M|    } \
  |  |  |  |  |  |  157|  6.68M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  6.68M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 3.99M, False: 2.69M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  6.68M|                    break; \
  |  |  |  | 1128|  6.68M|            } \
  |  |  |  | 1129|  6.68M|            { \
  |  |  |  | 1130|  2.69M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  2.69M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  2.69M|                                    ci); \
  |  |  |  | 1133|  2.69M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.69M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  2.69M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.69M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.69M|{ \
  |  |  |  |  |  |  140|  2.69M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.69M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.69M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.69M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.69M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.69M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 713k, False: 1.97M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   713k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   713k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   713k|{ \
  |  |  |  |  |  |  |  |   57|   713k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 149k, False: 563k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   149k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   149k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   149k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   563k|    } else { \
  |  |  |  |  |  |  |  |   62|   563k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   563k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   563k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   563k|    } \
  |  |  |  |  |  |  |  |   66|   713k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   713k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   713k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   713k|{ \
  |  |  |  |  |  |  |  |  128|  1.14M|    do { \
  |  |  |  |  |  |  |  |  129|  1.14M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 143k, False: 1.00M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   143k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   143k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   143k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   143k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   143k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   143k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   143k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   143k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 130k, False: 13.2k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   130k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 125k, False: 4.47k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   125k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   125k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   125k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   125k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  4.47k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  4.47k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  4.47k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  4.47k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   130k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  13.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  13.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  13.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  13.2k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   143k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   143k|        } \
  |  |  |  |  |  |  |  |  132|  1.14M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.14M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.14M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.14M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 435k, False: 713k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   713k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.97M|    } else {  \
  |  |  |  |  |  |  149|  1.97M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.97M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 752k, False: 1.22M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   752k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   752k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   752k|{ \
  |  |  |  |  |  |  |  |   45|   752k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 119k, False: 632k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   119k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   119k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   632k|    } else { \
  |  |  |  |  |  |  |  |   49|   632k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   632k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   632k|    } \
  |  |  |  |  |  |  |  |   52|   752k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   752k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   752k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   752k|{ \
  |  |  |  |  |  |  |  |  128|   804k|    do { \
  |  |  |  |  |  |  |  |  129|   804k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 97.7k, False: 706k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  97.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  97.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  97.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  97.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  97.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  97.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  97.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  97.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 91.3k, False: 6.35k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  91.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 89.1k, False: 2.28k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  89.1k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  89.1k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  89.1k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  89.1k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.28k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.28k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.28k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.28k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  91.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.35k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.35k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.35k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.35k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  97.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  97.7k|        } \
  |  |  |  |  |  |  |  |  132|   804k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   804k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   804k|        ct--; \
  |  |  |  |  |  |  |  |  135|   804k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 52.3k, False: 752k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   752k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.22M|        } else { \
  |  |  |  |  |  |  154|  1.22M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.22M|        } \
  |  |  |  |  |  |  156|  1.97M|    } \
  |  |  |  |  |  |  157|  2.69M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  2.69M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  2.69M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 1.34M, False: 1.34M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  2.69M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.69M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.69M|{ \
  |  |  |  |  |  |  323|  2.69M|    /* east */ \
  |  |  |  |  |  |  324|  2.69M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.69M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.69M| \
  |  |  |  |  |  |  326|  2.69M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.69M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.69M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.69M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.69M| \
  |  |  |  |  |  |  329|  2.69M|    /* west */ \
  |  |  |  |  |  |  330|  2.69M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.69M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.69M| \
  |  |  |  |  |  |  332|  2.69M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.69M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  2.69M| \
  |  |  |  |  |  |  340|  2.69M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.69M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  2.69M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  2.69M|            } \
  |  |  |  | 1139|  2.69M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  6.68M|    } \
  |  |  |  | 1141|  30.8M|}
  |  |  ------------------
  |  | 1310|  30.8M|                                    flags, flagsp, flags_stride, data, \
  |  | 1311|  30.8M|                                    l_w, 0, mqc, curctx, \
  |  | 1312|  30.8M|                                    v, a, c, ct, oneplushalf, vsc); \
  |  | 1313|  30.8M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  30.8M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  30.8M|{ \
  |  |  |  | 1120|  30.8M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  30.8M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  30.8M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  30.8M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  30.8M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 6.62M, False: 24.2M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  6.62M|        do { \
  |  |  |  | 1122|  6.62M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  6.62M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  6.62M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  6.62M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  6.62M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  6.62M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  6.62M|{ \
  |  |  |  |  |  |  140|  6.62M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  6.62M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  6.62M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  6.62M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  6.62M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  6.62M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.42M, False: 5.19M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.42M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.42M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.42M|{ \
  |  |  |  |  |  |  |  |   57|  1.42M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 311k, False: 1.11M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   311k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   311k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   311k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.11M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.11M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.11M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.11M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.11M|    } \
  |  |  |  |  |  |  |  |   66|  1.42M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.42M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.42M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.42M|{ \
  |  |  |  |  |  |  |  |  128|  2.31M|    do { \
  |  |  |  |  |  |  |  |  129|  2.31M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 291k, False: 2.02M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   291k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   291k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   291k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   291k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   291k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   291k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   291k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   291k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 268k, False: 22.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   268k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 259k, False: 8.91k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   259k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   259k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   259k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   259k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  8.91k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  8.91k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  8.91k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  8.91k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   268k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  22.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  22.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  22.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  22.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   291k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   291k|        } \
  |  |  |  |  |  |  |  |  132|  2.31M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.31M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.31M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.31M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 892k, False: 1.42M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.42M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  5.19M|    } else {  \
  |  |  |  |  |  |  149|  5.19M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  5.19M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.48M, False: 3.70M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.48M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.48M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.48M|{ \
  |  |  |  |  |  |  |  |   45|  1.48M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 245k, False: 1.24M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   245k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   245k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.24M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.24M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.24M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.24M|    } \
  |  |  |  |  |  |  |  |   52|  1.48M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.48M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.48M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.48M|{ \
  |  |  |  |  |  |  |  |  128|  1.59M|    do { \
  |  |  |  |  |  |  |  |  129|  1.59M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 196k, False: 1.39M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   196k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   196k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   196k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   196k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   196k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   196k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   196k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   196k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 182k, False: 14.1k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   182k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 174k, False: 7.90k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   174k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   174k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   174k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   174k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  7.90k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  7.90k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  7.90k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  7.90k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   182k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  14.1k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  14.1k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  14.1k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  14.1k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   196k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   196k|        } \
  |  |  |  |  |  |  |  |  132|  1.59M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.59M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.59M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.59M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 108k, False: 1.48M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.48M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.70M|        } else { \
  |  |  |  |  |  |  154|  3.70M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  3.70M|        } \
  |  |  |  |  |  |  156|  5.19M|    } \
  |  |  |  |  |  |  157|  6.62M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  6.62M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 4.00M, False: 2.61M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  6.62M|                    break; \
  |  |  |  | 1128|  6.62M|            } \
  |  |  |  | 1129|  6.62M|            { \
  |  |  |  | 1130|  2.61M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  2.61M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  2.61M|                                    ci); \
  |  |  |  | 1133|  2.61M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.61M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  2.61M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.61M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.61M|{ \
  |  |  |  |  |  |  140|  2.61M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.61M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.61M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.61M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.61M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.61M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 707k, False: 1.90M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   707k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   707k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   707k|{ \
  |  |  |  |  |  |  |  |   57|   707k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 151k, False: 555k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   151k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   151k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   151k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   555k|    } else { \
  |  |  |  |  |  |  |  |   62|   555k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   555k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   555k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   555k|    } \
  |  |  |  |  |  |  |  |   66|   707k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   707k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   707k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   707k|{ \
  |  |  |  |  |  |  |  |  128|  1.12M|    do { \
  |  |  |  |  |  |  |  |  129|  1.12M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 140k, False: 985k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   140k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   140k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   140k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   140k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   140k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   140k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   140k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   140k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 130k, False: 10.2k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   130k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 126k, False: 3.64k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   126k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   126k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   126k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   126k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.64k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.64k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.64k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.64k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   130k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  10.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  10.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  10.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  10.2k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   140k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   140k|        } \
  |  |  |  |  |  |  |  |  132|  1.12M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.12M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.12M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.12M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 418k, False: 707k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   707k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.90M|    } else {  \
  |  |  |  |  |  |  149|  1.90M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.90M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 738k, False: 1.17M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   738k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   738k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   738k|{ \
  |  |  |  |  |  |  |  |   45|   738k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 119k, False: 618k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   119k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   119k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   618k|    } else { \
  |  |  |  |  |  |  |  |   49|   618k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   618k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   618k|    } \
  |  |  |  |  |  |  |  |   52|   738k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   738k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   738k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   738k|{ \
  |  |  |  |  |  |  |  |  128|   793k|    do { \
  |  |  |  |  |  |  |  |  129|   793k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 99.9k, False: 693k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  99.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  99.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  99.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  99.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  99.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  99.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  99.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  99.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 92.8k, False: 7.11k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  92.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 89.1k, False: 3.73k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  89.1k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  89.1k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  89.1k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  89.1k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.73k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.73k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.73k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.73k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  92.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.11k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.11k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.11k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.11k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  99.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  99.9k|        } \
  |  |  |  |  |  |  |  |  132|   793k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   793k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   793k|        ct--; \
  |  |  |  |  |  |  |  |  135|   793k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 55.2k, False: 738k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   738k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.17M|        } else { \
  |  |  |  |  |  |  154|  1.17M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.17M|        } \
  |  |  |  |  |  |  156|  1.90M|    } \
  |  |  |  |  |  |  157|  2.61M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  2.61M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  2.61M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 1.31M, False: 1.30M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  2.61M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.61M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.61M|{ \
  |  |  |  |  |  |  323|  2.61M|    /* east */ \
  |  |  |  |  |  |  324|  2.61M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.61M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.61M| \
  |  |  |  |  |  |  326|  2.61M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.61M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.61M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.61M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.61M| \
  |  |  |  |  |  |  329|  2.61M|    /* west */ \
  |  |  |  |  |  |  330|  2.61M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.61M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.61M| \
  |  |  |  |  |  |  332|  2.61M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.61M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  2.61M| \
  |  |  |  |  |  |  340|  2.61M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.61M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  2.61M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  2.61M|            } \
  |  |  |  | 1139|  2.61M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  6.62M|    } \
  |  |  |  | 1141|  30.8M|}
  |  |  ------------------
  |  | 1314|  30.8M|                                    flags, flagsp, flags_stride, data, \
  |  | 1315|  30.8M|                                    l_w, 1, mqc, curctx, \
  |  | 1316|  30.8M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1317|  30.8M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  30.8M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  30.8M|{ \
  |  |  |  | 1120|  30.8M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  30.8M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  30.8M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  30.8M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  30.8M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 6.76M, False: 24.1M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  6.76M|        do { \
  |  |  |  | 1122|  6.76M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  6.76M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  6.76M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  6.76M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  6.76M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  6.76M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  6.76M|{ \
  |  |  |  |  |  |  140|  6.76M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  6.76M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  6.76M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  6.76M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  6.76M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  6.76M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.37M, False: 5.39M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.37M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.37M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.37M|{ \
  |  |  |  |  |  |  |  |   57|  1.37M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 298k, False: 1.07M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   298k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   298k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   298k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.07M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.07M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.07M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.07M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.07M|    } \
  |  |  |  |  |  |  |  |   66|  1.37M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.37M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.37M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.37M|{ \
  |  |  |  |  |  |  |  |  128|  2.28M|    do { \
  |  |  |  |  |  |  |  |  129|  2.28M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 290k, False: 1.99M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   290k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   290k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   290k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   290k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   290k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   290k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   290k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   290k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 267k, False: 23.0k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   267k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 257k, False: 9.56k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   257k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   257k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   257k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   257k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  9.56k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  9.56k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  9.56k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  9.56k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   267k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  23.0k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  23.0k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  23.0k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  23.0k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   290k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   290k|        } \
  |  |  |  |  |  |  |  |  132|  2.28M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.28M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.28M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.28M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 904k, False: 1.37M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.37M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  5.39M|    } else {  \
  |  |  |  |  |  |  149|  5.39M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  5.39M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.44M, False: 3.94M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.44M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.44M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.44M|{ \
  |  |  |  |  |  |  |  |   45|  1.44M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 224k, False: 1.21M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   224k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   224k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.21M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.21M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.21M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.21M|    } \
  |  |  |  |  |  |  |  |   52|  1.44M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.44M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.44M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.44M|{ \
  |  |  |  |  |  |  |  |  128|  1.54M|    do { \
  |  |  |  |  |  |  |  |  129|  1.54M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 199k, False: 1.34M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   199k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   199k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   199k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   199k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   199k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   199k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   199k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   199k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 185k, False: 14.1k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   185k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 175k, False: 9.64k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   175k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   175k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   175k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   175k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  9.64k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  9.64k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  9.64k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  9.64k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   185k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  14.1k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  14.1k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  14.1k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  14.1k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   199k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   199k|        } \
  |  |  |  |  |  |  |  |  132|  1.54M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.54M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.54M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.54M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 103k, False: 1.44M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.44M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.94M|        } else { \
  |  |  |  |  |  |  154|  3.94M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  3.94M|        } \
  |  |  |  |  |  |  156|  5.39M|    } \
  |  |  |  |  |  |  157|  6.76M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  6.76M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 4.21M, False: 2.55M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  6.76M|                    break; \
  |  |  |  | 1128|  6.76M|            } \
  |  |  |  | 1129|  6.76M|            { \
  |  |  |  | 1130|  2.55M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  2.55M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  2.55M|                                    ci); \
  |  |  |  | 1133|  2.55M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.55M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  2.55M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.55M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.55M|{ \
  |  |  |  |  |  |  140|  2.55M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.55M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.55M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.55M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.55M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.55M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 689k, False: 1.86M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   689k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   689k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   689k|{ \
  |  |  |  |  |  |  |  |   57|   689k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 148k, False: 540k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   148k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   148k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   148k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   540k|    } else { \
  |  |  |  |  |  |  |  |   62|   540k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   540k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   540k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   540k|    } \
  |  |  |  |  |  |  |  |   66|   689k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   689k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   689k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   689k|{ \
  |  |  |  |  |  |  |  |  128|  1.09M|    do { \
  |  |  |  |  |  |  |  |  129|  1.09M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 136k, False: 956k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   136k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   136k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   136k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   136k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   136k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   136k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   136k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   136k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 125k, False: 11.2k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   125k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 122k, False: 3.23k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   122k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   122k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   122k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   122k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.23k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.23k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.23k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.23k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   125k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  11.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  11.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  11.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  11.2k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   136k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   136k|        } \
  |  |  |  |  |  |  |  |  132|  1.09M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.09M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.09M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.09M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 403k, False: 689k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   689k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.86M|    } else {  \
  |  |  |  |  |  |  149|  1.86M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.86M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 722k, False: 1.14M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   722k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   722k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   722k|{ \
  |  |  |  |  |  |  |  |   45|   722k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 118k, False: 604k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   118k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   118k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   604k|    } else { \
  |  |  |  |  |  |  |  |   49|   604k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   604k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   604k|    } \
  |  |  |  |  |  |  |  |   52|   722k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   722k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   722k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   722k|{ \
  |  |  |  |  |  |  |  |  128|   775k|    do { \
  |  |  |  |  |  |  |  |  129|   775k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 99.3k, False: 676k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  99.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  99.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  99.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  99.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  99.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  99.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  99.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  99.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 90.6k, False: 8.70k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  90.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 88.0k, False: 2.61k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  88.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  88.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  88.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  88.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.61k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.61k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.61k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.61k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  90.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  8.70k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  8.70k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  8.70k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  8.70k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  99.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  99.3k|        } \
  |  |  |  |  |  |  |  |  132|   775k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   775k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   775k|        ct--; \
  |  |  |  |  |  |  |  |  135|   775k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 52.8k, False: 722k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   722k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.14M|        } else { \
  |  |  |  |  |  |  154|  1.14M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.14M|        } \
  |  |  |  |  |  |  156|  1.86M|    } \
  |  |  |  |  |  |  157|  2.55M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  2.55M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  2.55M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 1.27M, False: 1.28M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  2.55M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.55M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.55M|{ \
  |  |  |  |  |  |  323|  2.55M|    /* east */ \
  |  |  |  |  |  |  324|  2.55M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.55M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.55M| \
  |  |  |  |  |  |  326|  2.55M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.55M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.55M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.55M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.55M| \
  |  |  |  |  |  |  329|  2.55M|    /* west */ \
  |  |  |  |  |  |  330|  2.55M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.55M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.55M| \
  |  |  |  |  |  |  332|  2.55M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.55M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  2.55M| \
  |  |  |  |  |  |  340|  2.55M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.55M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  2.55M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  2.55M|            } \
  |  |  |  | 1139|  2.55M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  6.76M|    } \
  |  |  |  | 1141|  30.8M|}
  |  |  ------------------
  |  | 1318|  30.8M|                                    flags, flagsp, flags_stride, data, \
  |  | 1319|  30.8M|                                    l_w, 2, mqc, curctx, \
  |  | 1320|  30.8M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1321|  30.8M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  30.8M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  30.8M|{ \
  |  |  |  | 1120|  30.8M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  30.8M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  30.8M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  30.8M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  30.8M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 7.26M, False: 23.6M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  7.26M|        do { \
  |  |  |  | 1122|  7.26M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  7.26M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  7.26M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  7.26M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  7.26M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  7.26M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  7.26M|{ \
  |  |  |  |  |  |  140|  7.26M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  7.26M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  7.26M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  7.26M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  7.26M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  7.26M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.29M, False: 5.97M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.29M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.29M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.29M|{ \
  |  |  |  |  |  |  |  |   57|  1.29M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 259k, False: 1.03M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   259k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   259k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   259k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.03M|    } else { \
  |  |  |  |  |  |  |  |   62|  1.03M|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.03M|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.03M|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.03M|    } \
  |  |  |  |  |  |  |  |   66|  1.29M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.29M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.29M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.29M|{ \
  |  |  |  |  |  |  |  |  128|  2.18M|    do { \
  |  |  |  |  |  |  |  |  129|  2.18M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 272k, False: 1.91M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   272k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   272k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   272k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   272k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   272k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   272k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   272k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   272k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 252k, False: 20.4k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   252k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 244k, False: 8.22k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   244k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   244k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   244k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   244k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  8.22k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  8.22k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  8.22k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  8.22k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   252k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  20.4k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  20.4k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  20.4k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  20.4k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   272k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   272k|        } \
  |  |  |  |  |  |  |  |  132|  2.18M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.18M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.18M|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.18M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 895k, False: 1.29M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.29M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  5.97M|    } else {  \
  |  |  |  |  |  |  149|  5.97M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  5.97M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.38M, False: 4.58M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.38M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.38M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.38M|{ \
  |  |  |  |  |  |  |  |   45|  1.38M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 206k, False: 1.18M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   206k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   206k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.18M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.18M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.18M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.18M|    } \
  |  |  |  |  |  |  |  |   52|  1.38M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.38M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.38M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.38M|{ \
  |  |  |  |  |  |  |  |  128|  1.47M|    do { \
  |  |  |  |  |  |  |  |  129|  1.47M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 193k, False: 1.28M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   193k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   193k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   193k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   193k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   193k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   193k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   193k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   193k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 172k, False: 21.1k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   172k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 167k, False: 5.07k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   167k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   167k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   167k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   167k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  5.07k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  5.07k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  5.07k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  5.07k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   172k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  21.1k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  21.1k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  21.1k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  21.1k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   193k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   193k|        } \
  |  |  |  |  |  |  |  |  132|  1.47M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.47M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.47M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.47M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 90.7k, False: 1.38M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.38M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.58M|        } else { \
  |  |  |  |  |  |  154|  4.58M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.58M|        } \
  |  |  |  |  |  |  156|  5.97M|    } \
  |  |  |  |  |  |  157|  7.26M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  7.26M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 4.79M, False: 2.47M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  7.26M|                    break; \
  |  |  |  | 1128|  7.26M|            } \
  |  |  |  | 1129|  7.26M|            { \
  |  |  |  | 1130|  2.47M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  2.47M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  2.47M|                                    ci); \
  |  |  |  | 1133|  2.47M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.47M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  2.47M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.47M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.47M|{ \
  |  |  |  |  |  |  140|  2.47M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.47M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.47M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.47M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.47M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.47M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 660k, False: 1.81M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   660k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   660k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   660k|{ \
  |  |  |  |  |  |  |  |   57|   660k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 146k, False: 514k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   146k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   146k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   146k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   514k|    } else { \
  |  |  |  |  |  |  |  |   62|   514k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   514k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   514k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   514k|    } \
  |  |  |  |  |  |  |  |   66|   660k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   660k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   660k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   660k|{ \
  |  |  |  |  |  |  |  |  128|  1.05M|    do { \
  |  |  |  |  |  |  |  |  129|  1.05M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 129k, False: 923k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   129k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   129k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   129k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   129k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   129k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   129k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   129k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   129k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 121k, False: 8.12k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   121k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 117k, False: 3.24k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   117k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   117k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   117k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   117k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.24k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.24k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.24k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.24k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   121k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  8.12k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  8.12k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  8.12k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  8.12k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   129k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   129k|        } \
  |  |  |  |  |  |  |  |  132|  1.05M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.05M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.05M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.05M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 391k, False: 660k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   660k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.81M|    } else {  \
  |  |  |  |  |  |  149|  1.81M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.81M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 697k, False: 1.11M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   697k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   697k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   697k|{ \
  |  |  |  |  |  |  |  |   45|   697k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 114k, False: 583k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   114k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   114k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   583k|    } else { \
  |  |  |  |  |  |  |  |   49|   583k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   583k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   583k|    } \
  |  |  |  |  |  |  |  |   52|   697k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   697k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   697k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   697k|{ \
  |  |  |  |  |  |  |  |  128|   750k|    do { \
  |  |  |  |  |  |  |  |  129|   750k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 95.7k, False: 655k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  95.7k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  95.7k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  95.7k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  95.7k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  95.7k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  95.7k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  95.7k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  95.7k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 88.8k, False: 6.94k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  88.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 85.6k, False: 3.12k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  85.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  85.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  85.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  85.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.12k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.12k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.12k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.12k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  88.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.94k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.94k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.94k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.94k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  95.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  95.7k|        } \
  |  |  |  |  |  |  |  |  132|   750k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   750k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   750k|        ct--; \
  |  |  |  |  |  |  |  |  135|   750k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 52.9k, False: 697k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   697k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.11M|        } else { \
  |  |  |  |  |  |  154|  1.11M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.11M|        } \
  |  |  |  |  |  |  156|  1.81M|    } \
  |  |  |  |  |  |  157|  2.47M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  2.47M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  2.47M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 1.23M, False: 1.23M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  2.47M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.47M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.47M|{ \
  |  |  |  |  |  |  323|  2.47M|    /* east */ \
  |  |  |  |  |  |  324|  2.47M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.47M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.47M| \
  |  |  |  |  |  |  326|  2.47M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.47M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.47M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.47M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.47M| \
  |  |  |  |  |  |  329|  2.47M|    /* west */ \
  |  |  |  |  |  |  330|  2.47M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.47M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.47M| \
  |  |  |  |  |  |  332|  2.47M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.47M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  2.47M| \
  |  |  |  |  |  |  340|  2.47M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.47M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|  2.47M|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|  2.47M|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  2.47M|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  2.47M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  2.47M|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  2.47M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  2.47M|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  2.47M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|  2.47M|    } \
  |  |  |  |  |  |  347|  2.47M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  2.47M|            } \
  |  |  |  | 1139|  2.47M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  7.26M|    } \
  |  |  |  | 1141|  30.8M|}
  |  |  ------------------
  |  | 1322|  30.8M|                                    flags, flagsp, flags_stride, data, \
  |  | 1323|  30.8M|                                    l_w, 3, mqc, curctx, \
  |  | 1324|  30.8M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1325|  30.8M|            } \
  |  | 1326|  47.3M|            *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  32.0M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  32.0M|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  32.0M|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  32.0M|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1327|  32.0M|        } \
  |  | 1328|  6.65M|    } \
  |  | 1329|   216k|    UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|   216k|        mqc->curctx = curctx; \
  |  |  |  |  167|   216k|        mqc->c = c; \
  |  |  |  |  168|   216k|        mqc->a = a; \
  |  |  |  |  169|   216k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1330|   216k|    if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1330:9): [True: 24.1k, False: 191k]
  |  |  ------------------
  |  | 1331|  1.66M|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) { \
  |  |  ------------------
  |  |  |  Branch (1331:21): [True: 1.63M, False: 24.1k]
  |  |  ------------------
  |  | 1332|  4.30M|            for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1332:25): [True: 2.66M, False: 1.63M]
  |  |  ------------------
  |  | 1333|  2.66M|                opj_t1_dec_clnpass_step(t1, flagsp, data + j * l_w, oneplushalf, j, vsc); \
  |  | 1334|  2.66M|            } \
  |  | 1335|  1.63M|            *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  1.63M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  1.63M|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  1.63M|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  1.63M|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1336|  1.63M|        } \
  |  | 1337|  24.1k|    } \
  |  | 1338|   216k|}
  ------------------
 1388|   216k|                                t1->w + 2U);
 1389|   216k|}
t1.c:opj_t1_dec_clnpass_generic_novsc:
 1378|   201k|{
 1379|   201k|    opj_t1_dec_clnpass_internal(t1, bpno, OPJ_FALSE, t1->w, t1->h,
  ------------------
  |  | 1251|   201k|#define opj_t1_dec_clnpass_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  | 1252|   201k|{ \
  |  | 1253|   201k|    OPJ_INT32 one, half, oneplushalf; \
  |  | 1254|   201k|    OPJ_UINT32 runlen; \
  |  | 1255|   201k|    OPJ_UINT32 i, j, k; \
  |  | 1256|   201k|    const OPJ_UINT32 l_w = w; \
  |  | 1257|   201k|    opj_mqc_t* mqc = &(t1->mqc); \
  |  | 1258|   201k|    register OPJ_INT32 *data = t1->data; \
  |  | 1259|   201k|    register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  | 1260|   201k|    DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|   201k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|   201k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|   201k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|   201k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  | 1261|   201k|    register OPJ_UINT32 v; \
  |  | 1262|   201k|    one = 1 << bpno; \
  |  | 1263|   201k|    half = one >> 1; \
  |  | 1264|   201k|    oneplushalf = one | half; \
  |  | 1265|  4.12M|    for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (1265:17): [True: 3.92M, False: 201k]
  |  |  ------------------
  |  | 1266|  50.7M|        for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1266:21): [True: 46.8M, False: 3.92M]
  |  |  ------------------
  |  | 1267|  46.8M|            opj_flag_t flags = *flagsp; \
  |  | 1268|  46.8M|            if (flags == 0) { \
  |  |  ------------------
  |  |  |  Branch (1268:17): [True: 12.4M, False: 34.4M]
  |  |  ------------------
  |  | 1269|  12.4M|                OPJ_UINT32 partial = OPJ_TRUE; \
  |  |  ------------------
  |  |  |  |  117|  12.4M|#define OPJ_TRUE 1
  |  |  ------------------
  |  | 1270|  12.4M|                opj_t1_setcurctx(curctx, T1_CTXNO_AGG); \
  |  |  ------------------
  |  |  |  |   62|  12.4M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1271|  12.4M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  12.4M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  12.4M|{ \
  |  |  |  |  140|  12.4M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  12.4M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  12.4M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  12.4M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  12.4M|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  12.4M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 736k, False: 11.6M]
  |  |  |  |  ------------------
  |  |  |  |  146|   736k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   736k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   736k|{ \
  |  |  |  |  |  |   57|   736k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 102k, False: 633k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|   102k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|   102k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|   102k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   633k|    } else { \
  |  |  |  |  |  |   62|   633k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   633k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   633k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   633k|    } \
  |  |  |  |  |  |   66|   736k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   736k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   736k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   736k|{ \
  |  |  |  |  |  |  128|  1.50M|    do { \
  |  |  |  |  |  |  129|  1.50M|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 190k, False: 1.31M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|   190k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|   190k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|   190k|{ \
  |  |  |  |  |  |  |  |  104|   190k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|   190k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|   190k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|   190k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|   190k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 155k, False: 35.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|   155k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 139k, False: 15.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|   139k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|   139k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|   139k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|   139k|            } else { \
  |  |  |  |  |  |  |  |  114|  15.6k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  15.6k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  15.6k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  15.6k|            } \
  |  |  |  |  |  |  |  |  118|   155k|        } else { \
  |  |  |  |  |  |  |  |  119|  35.5k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  35.5k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  35.5k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  35.5k|        } \
  |  |  |  |  |  |  |  |  123|   190k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|   190k|        } \
  |  |  |  |  |  |  132|  1.50M|        a <<= 1; \
  |  |  |  |  |  |  133|  1.50M|        c <<= 1; \
  |  |  |  |  |  |  134|  1.50M|        ct--; \
  |  |  |  |  |  |  135|  1.50M|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 768k, False: 736k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   736k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  11.6M|    } else {  \
  |  |  |  |  149|  11.6M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  11.6M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 886k, False: 10.8M]
  |  |  |  |  ------------------
  |  |  |  |  151|   886k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   886k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   886k|{ \
  |  |  |  |  |  |   45|   886k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 80.8k, False: 805k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  80.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  80.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   805k|    } else { \
  |  |  |  |  |  |   49|   805k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   805k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   805k|    } \
  |  |  |  |  |  |   52|   886k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   886k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   886k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   886k|{ \
  |  |  |  |  |  |  128|   923k|    do { \
  |  |  |  |  |  |  129|   923k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 122k, False: 800k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|   122k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|   122k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|   122k|{ \
  |  |  |  |  |  |  |  |  104|   122k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|   122k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|   122k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|   122k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|   122k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 97.7k, False: 24.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  97.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 90.8k, False: 6.92k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  90.8k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  90.8k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  90.8k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  90.8k|            } else { \
  |  |  |  |  |  |  |  |  114|  6.92k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  6.92k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  6.92k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  6.92k|            } \
  |  |  |  |  |  |  |  |  118|  97.7k|        } else { \
  |  |  |  |  |  |  |  |  119|  24.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  24.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  24.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  24.8k|        } \
  |  |  |  |  |  |  |  |  123|   122k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|   122k|        } \
  |  |  |  |  |  |  132|   923k|        a <<= 1; \
  |  |  |  |  |  |  133|   923k|        c <<= 1; \
  |  |  |  |  |  |  134|   923k|        ct--; \
  |  |  |  |  |  |  135|   923k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 37.0k, False: 886k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   886k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  10.8M|        } else { \
  |  |  |  |  154|  10.8M|            d = (*curctx)->mps; \
  |  |  |  |  155|  10.8M|        } \
  |  |  |  |  156|  11.6M|    } \
  |  |  |  |  157|  12.4M|}
  |  |  ------------------
  |  | 1272|  12.4M|                if (!v) { \
  |  |  ------------------
  |  |  |  Branch (1272:21): [True: 11.5M, False: 852k]
  |  |  ------------------
  |  | 1273|  11.5M|                    continue; \
  |  | 1274|  11.5M|                } \
  |  | 1275|  12.4M|                opj_t1_setcurctx(curctx, T1_CTXNO_UNI); \
  |  |  ------------------
  |  |  |  |   62|   852k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1276|   852k|                opj_mqc_decode_macro(runlen, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   852k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   852k|{ \
  |  |  |  |  140|   852k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   852k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   852k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   852k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   852k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   852k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 421k, False: 430k]
  |  |  |  |  ------------------
  |  |  |  |  146|   421k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   421k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   421k|{ \
  |  |  |  |  |  |   57|   421k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 235k, False: 186k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|   235k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|   235k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|   235k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   235k|    } else { \
  |  |  |  |  |  |   62|   186k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   186k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   186k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   186k|    } \
  |  |  |  |  |  |   66|   421k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   421k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   421k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   421k|{ \
  |  |  |  |  |  |  128|   421k|    do { \
  |  |  |  |  |  |  129|   421k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 52.0k, False: 369k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 46.6k, False: 5.43k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  46.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 43.3k, False: 3.32k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  43.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  43.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  43.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  43.3k|            } else { \
  |  |  |  |  |  |  |  |  114|  3.32k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  3.32k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  3.32k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  3.32k|            } \
  |  |  |  |  |  |  |  |  118|  46.6k|        } else { \
  |  |  |  |  |  |  |  |  119|  5.43k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  5.43k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  5.43k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  5.43k|        } \
  |  |  |  |  |  |  |  |  123|  52.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  52.0k|        } \
  |  |  |  |  |  |  132|   421k|        a <<= 1; \
  |  |  |  |  |  |  133|   421k|        c <<= 1; \
  |  |  |  |  |  |  134|   421k|        ct--; \
  |  |  |  |  |  |  135|   421k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 421k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   421k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   430k|    } else {  \
  |  |  |  |  149|   430k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   430k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 335k, False: 95.1k]
  |  |  |  |  ------------------
  |  |  |  |  151|   335k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   335k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   335k|{ \
  |  |  |  |  |  |   45|   335k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 184k, False: 150k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|   184k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|   184k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   184k|    } else { \
  |  |  |  |  |  |   49|   150k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   150k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   150k|    } \
  |  |  |  |  |  |   52|   335k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   335k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   335k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   335k|{ \
  |  |  |  |  |  |  128|   412k|    do { \
  |  |  |  |  |  |  129|   412k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 54.0k, False: 358k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  54.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  54.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  54.0k|{ \
  |  |  |  |  |  |  |  |  104|  54.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  54.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  54.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  54.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  54.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 45.3k, False: 8.69k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  45.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 43.4k, False: 1.82k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  43.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  43.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  43.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  43.4k|            } else { \
  |  |  |  |  |  |  |  |  114|  1.82k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  1.82k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  1.82k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  1.82k|            } \
  |  |  |  |  |  |  |  |  118|  45.3k|        } else { \
  |  |  |  |  |  |  |  |  119|  8.69k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  8.69k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  8.69k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  8.69k|        } \
  |  |  |  |  |  |  |  |  123|  54.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  54.0k|        } \
  |  |  |  |  |  |  132|   412k|        a <<= 1; \
  |  |  |  |  |  |  133|   412k|        c <<= 1; \
  |  |  |  |  |  |  134|   412k|        ct--; \
  |  |  |  |  |  |  135|   412k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 77.3k, False: 335k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   335k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   335k|        } else { \
  |  |  |  |  154|  95.1k|            d = (*curctx)->mps; \
  |  |  |  |  155|  95.1k|        } \
  |  |  |  |  156|   430k|    } \
  |  |  |  |  157|   852k|}
  |  |  ------------------
  |  | 1277|   852k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   852k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   852k|{ \
  |  |  |  |  140|   852k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   852k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   852k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   852k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   852k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   852k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 425k, False: 427k]
  |  |  |  |  ------------------
  |  |  |  |  146|   425k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   425k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   425k|{ \
  |  |  |  |  |  |   57|   425k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 119k, False: 305k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|   119k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|   119k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|   119k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   305k|    } else { \
  |  |  |  |  |  |   62|   305k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   305k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   305k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   305k|    } \
  |  |  |  |  |  |   66|   425k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   425k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   425k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   425k|{ \
  |  |  |  |  |  |  128|   425k|    do { \
  |  |  |  |  |  |  129|   425k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 52.0k, False: 373k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 45.0k, False: 6.98k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  45.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 42.6k, False: 2.43k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  42.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  42.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  42.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  42.6k|            } else { \
  |  |  |  |  |  |  |  |  114|  2.43k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  2.43k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  2.43k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  2.43k|            } \
  |  |  |  |  |  |  |  |  118|  45.0k|        } else { \
  |  |  |  |  |  |  |  |  119|  6.98k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  6.98k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  6.98k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  6.98k|        } \
  |  |  |  |  |  |  |  |  123|  52.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  52.0k|        } \
  |  |  |  |  |  |  132|   425k|        a <<= 1; \
  |  |  |  |  |  |  133|   425k|        c <<= 1; \
  |  |  |  |  |  |  134|   425k|        ct--; \
  |  |  |  |  |  |  135|   425k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 425k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   425k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   427k|    } else {  \
  |  |  |  |  149|   427k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   427k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 357k, False: 69.8k]
  |  |  |  |  ------------------
  |  |  |  |  151|   357k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   357k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   357k|{ \
  |  |  |  |  |  |   45|   357k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 83.6k, False: 273k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  83.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  83.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   273k|    } else { \
  |  |  |  |  |  |   49|   273k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   273k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   273k|    } \
  |  |  |  |  |  |   52|   357k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   357k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   357k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   357k|{ \
  |  |  |  |  |  |  128|   405k|    do { \
  |  |  |  |  |  |  129|   405k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 51.5k, False: 353k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  51.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  51.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  51.5k|{ \
  |  |  |  |  |  |  |  |  104|  51.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  51.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  51.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  51.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  51.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 45.1k, False: 6.42k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  45.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 43.2k, False: 1.96k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  43.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  43.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  43.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  43.2k|            } else { \
  |  |  |  |  |  |  |  |  114|  1.96k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  1.96k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  1.96k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  1.96k|            } \
  |  |  |  |  |  |  |  |  118|  45.1k|        } else { \
  |  |  |  |  |  |  |  |  119|  6.42k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  6.42k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  6.42k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  6.42k|        } \
  |  |  |  |  |  |  |  |  123|  51.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  51.5k|        } \
  |  |  |  |  |  |  132|   405k|        a <<= 1; \
  |  |  |  |  |  |  133|   405k|        c <<= 1; \
  |  |  |  |  |  |  134|   405k|        ct--; \
  |  |  |  |  |  |  135|   405k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 47.8k, False: 357k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   357k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   357k|        } else { \
  |  |  |  |  154|  69.8k|            d = (*curctx)->mps; \
  |  |  |  |  155|  69.8k|        } \
  |  |  |  |  156|   427k|    } \
  |  |  |  |  157|   852k|}
  |  |  ------------------
  |  | 1278|   852k|                runlen = (runlen << 1) | v; \
  |  | 1279|   852k|                switch(runlen) { \
  |  |  ------------------
  |  |  |  Branch (1279:24): [True: 0, False: 852k]
  |  |  ------------------
  |  | 1280|   266k|                    case 0: \
  |  |  ------------------
  |  |  |  Branch (1280:21): [True: 266k, False: 585k]
  |  |  ------------------
  |  | 1281|   266k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, OPJ_TRUE,\
  |  |  ------------------
  |  |  |  | 1118|   266k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   266k|{ \
  |  |  |  | 1120|   266k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   266k|        do { \
  |  |  |  | 1122|   266k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|      0|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|      0|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|      0|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|      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|}
  |  |  |  |  ------------------
  |  |  |  | 1126|      0|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1127|      0|                    break; \
  |  |  |  | 1128|      0|            } \
  |  |  |  | 1129|   266k|            { \
  |  |  |  | 1130|   266k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   266k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   266k|                                    ci); \
  |  |  |  | 1133|   266k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   266k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   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: 80.0k, False: 186k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  80.0k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  80.0k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  80.0k|{ \
  |  |  |  |  |  |  |  |   57|  80.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 4.57k, False: 75.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  4.57k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  4.57k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  4.57k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  75.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  75.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  75.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  75.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  75.4k|    } \
  |  |  |  |  |  |  |  |   66|  80.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  80.0k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  80.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  80.0k|{ \
  |  |  |  |  |  |  |  |  128|   131k|    do { \
  |  |  |  |  |  |  |  |  129|   131k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 13.7k, False: 117k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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.2k, False: 1.46k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  12.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 11.6k, False: 616]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  11.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  11.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  11.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  11.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    616|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    616|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    616|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    616|            } \
  |  |  |  |  |  |  |  |  |  |  118|  12.2k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.46k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.46k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.46k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.46k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  13.7k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  13.7k|        } \
  |  |  |  |  |  |  |  |  132|   131k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   131k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   131k|        ct--; \
  |  |  |  |  |  |  |  |  135|   131k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 51.2k, False: 80.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  80.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   186k|    } else {  \
  |  |  |  |  |  |  149|   186k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   186k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 90.7k, False: 96.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  90.7k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  90.7k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  90.7k|{ \
  |  |  |  |  |  |  |  |   45|  90.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 4.14k, False: 86.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  4.14k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  4.14k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  86.5k|    } else { \
  |  |  |  |  |  |  |  |   49|  86.5k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  86.5k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  86.5k|    } \
  |  |  |  |  |  |  |  |   52|  90.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  90.7k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  90.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  90.7k|{ \
  |  |  |  |  |  |  |  |  128|  91.2k|    do { \
  |  |  |  |  |  |  |  |  129|  91.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 11.6k, False: 79.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 10.0k, False: 1.58k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  10.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 8.95k, False: 1.06k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  8.95k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  8.95k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  8.95k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  8.95k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.06k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.06k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.06k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.06k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  10.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.58k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.58k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.58k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.58k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  11.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  11.6k|        } \
  |  |  |  |  |  |  |  |  132|  91.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  91.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  91.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  91.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 488, False: 90.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  90.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  96.2k|        } else { \
  |  |  |  |  |  |  154|  96.2k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  96.2k|        } \
  |  |  |  |  |  |  156|   186k|    } \
  |  |  |  |  |  |  157|   266k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   266k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   266k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 119k, False: 147k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   266k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   266k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   266k|{ \
  |  |  |  |  |  |  323|   266k|    /* east */ \
  |  |  |  |  |  |  324|   266k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   266k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   266k| \
  |  |  |  |  |  |  326|   266k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   266k| \
  |  |  |  |  |  |  329|   266k|    /* west */ \
  |  |  |  |  |  |  330|   266k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   266k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   266k| \
  |  |  |  |  |  |  332|   266k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   266k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   266k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|   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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|   266k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|   266k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|   266k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|   266k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|   266k|    } \
  |  |  |  |  |  |  339|   266k| \
  |  |  |  |  |  |  340|   266k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   266k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|   266k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   266k|            } \
  |  |  |  | 1139|   266k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   266k|    } \
  |  |  |  | 1141|   266k|}
  |  |  ------------------
  |  | 1282|   266k|                                            flags, flagsp, flags_stride, data, \
  |  | 1283|   266k|                                            l_w, 0, mqc, curctx, \
  |  | 1284|   266k|                                            v, a, c, ct, oneplushalf, vsc); \
  |  | 1285|   266k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   266k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1286|   266k|                        /* FALLTHRU */ \
  |  | 1287|   481k|                    case 1: \
  |  |  ------------------
  |  |  |  Branch (1287:21): [True: 214k, False: 637k]
  |  |  ------------------
  |  | 1288|   481k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1118|   481k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   481k|{ \
  |  |  |  | 1120|   481k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   481k|        do { \
  |  |  |  | 1122|   481k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [True: 266k, False: 214k]
  |  |  |  |  ------------------
  |  |  |  | 1123|   266k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|   266k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   266k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|   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: 61.4k, False: 205k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  61.4k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  61.4k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  61.4k|{ \
  |  |  |  |  |  |  |  |   57|  61.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 12.1k, False: 49.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  12.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  12.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  12.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  49.2k|    } else { \
  |  |  |  |  |  |  |  |   62|  49.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  49.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  49.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  49.2k|    } \
  |  |  |  |  |  |  |  |   66|  61.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  61.4k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  61.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  61.4k|{ \
  |  |  |  |  |  |  |  |  128|  99.1k|    do { \
  |  |  |  |  |  |  |  |  129|  99.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 12.6k, False: 86.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 11.1k, False: 1.46k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  11.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.1k, False: 1.00k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  10.1k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  10.1k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  10.1k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  10.1k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.00k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.00k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.00k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.00k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  11.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.46k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.46k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.46k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.46k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  12.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  12.6k|        } \
  |  |  |  |  |  |  |  |  132|  99.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  99.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  99.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  99.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 37.7k, False: 61.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  61.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   205k|    } else {  \
  |  |  |  |  |  |  149|   205k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   205k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 74.5k, False: 130k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  74.5k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  74.5k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  74.5k|{ \
  |  |  |  |  |  |  |  |   45|  74.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 9.87k, False: 64.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  9.87k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  9.87k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  64.6k|    } else { \
  |  |  |  |  |  |  |  |   49|  64.6k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  64.6k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  64.6k|    } \
  |  |  |  |  |  |  |  |   52|  74.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  74.5k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  74.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  74.5k|{ \
  |  |  |  |  |  |  |  |  128|  79.4k|    do { \
  |  |  |  |  |  |  |  |  129|  79.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 9.48k, False: 69.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  9.48k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  9.48k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  9.48k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  9.48k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  9.48k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  9.48k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  9.48k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  9.48k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.91k, False: 1.57k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  7.91k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 7.54k, False: 365]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  7.54k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  7.54k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  7.54k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  7.54k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    365|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    365|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    365|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    365|            } \
  |  |  |  |  |  |  |  |  |  |  118|  7.91k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.57k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.57k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.57k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.57k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  9.48k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  9.48k|        } \
  |  |  |  |  |  |  |  |  132|  79.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  79.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  79.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  79.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.93k, False: 74.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  74.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   130k|        } else { \
  |  |  |  |  |  |  154|   130k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   130k|        } \
  |  |  |  |  |  |  156|   205k|    } \
  |  |  |  |  |  |  157|   266k|}
  |  |  |  |  ------------------
  |  |  |  | 1126|   266k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 185k, False: 81.5k]
  |  |  |  |  ------------------
  |  |  |  | 1127|   266k|                    break; \
  |  |  |  | 1128|   266k|            } \
  |  |  |  | 1129|   481k|            { \
  |  |  |  | 1130|   295k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   295k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   295k|                                    ci); \
  |  |  |  | 1133|   295k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   295k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   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: 87.7k, False: 208k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  87.7k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  87.7k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  87.7k|{ \
  |  |  |  |  |  |  |  |   57|  87.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 6.93k, False: 80.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  6.93k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  6.93k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  6.93k|        *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|  87.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  87.7k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  87.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  87.7k|{ \
  |  |  |  |  |  |  |  |  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: 15.3k, False: 1.69k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  15.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 14.3k, False: 961]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  14.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  14.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  14.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  14.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    961|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    961|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    961|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    961|            } \
  |  |  |  |  |  |  |  |  |  |  118|  15.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.69k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.69k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.69k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.69k|        } \
  |  |  |  |  |  |  |  |  |  |  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: 48.6k, False: 87.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  87.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   208k|    } else {  \
  |  |  |  |  |  |  149|   208k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   208k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 98.8k, False: 109k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  98.8k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  98.8k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  98.8k|{ \
  |  |  |  |  |  |  |  |   45|  98.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 4.78k, False: 94.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  4.78k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  4.78k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  94.1k|    } else { \
  |  |  |  |  |  |  |  |   49|  94.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  94.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  94.1k|    } \
  |  |  |  |  |  |  |  |   52|  98.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  98.8k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  98.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  98.8k|{ \
  |  |  |  |  |  |  |  |  128|   100k|    do { \
  |  |  |  |  |  |  |  |  129|   100k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 12.6k, False: 88.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: 10.7k, False: 1.91k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  10.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.2k, False: 414]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  10.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  10.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  10.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  10.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    414|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    414|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    414|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    414|            } \
  |  |  |  |  |  |  |  |  |  |  118|  10.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.91k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.91k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.91k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.91k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  12.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  12.6k|        } \
  |  |  |  |  |  |  |  |  132|   100k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   100k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   100k|        ct--; \
  |  |  |  |  |  |  |  |  135|   100k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.80k, False: 98.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  98.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   109k|        } else { \
  |  |  |  |  |  |  154|   109k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   109k|        } \
  |  |  |  |  |  |  156|   208k|    } \
  |  |  |  |  |  |  157|   295k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   295k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   295k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 138k, False: 157k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   295k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   295k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   295k|{ \
  |  |  |  |  |  |  323|   295k|    /* east */ \
  |  |  |  |  |  |  324|   295k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   295k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   295k| \
  |  |  |  |  |  |  326|   295k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   295k| \
  |  |  |  |  |  |  329|   295k|    /* west */ \
  |  |  |  |  |  |  330|   295k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   295k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   295k| \
  |  |  |  |  |  |  332|   295k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   295k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   295k| \
  |  |  |  |  |  |  340|   295k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   295k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|   295k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   295k|            } \
  |  |  |  | 1139|   295k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   481k|    } \
  |  |  |  | 1141|   481k|}
  |  |  ------------------
  |  | 1289|   481k|                                            flags, flagsp, flags_stride, data, \
  |  | 1290|   481k|                                            l_w, 1, mqc, curctx, \
  |  | 1291|   481k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1292|   481k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   481k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1293|   481k|                        /* FALLTHRU */ \
  |  | 1294|   678k|                    case 2: \
  |  |  ------------------
  |  |  |  Branch (1294:21): [True: 196k, False: 655k]
  |  |  ------------------
  |  | 1295|   678k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1118|   678k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   678k|{ \
  |  |  |  | 1120|   678k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   678k|        do { \
  |  |  |  | 1122|   678k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [True: 481k, False: 196k]
  |  |  |  |  ------------------
  |  |  |  | 1123|   481k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|   481k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   481k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|   481k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   481k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   481k|{ \
  |  |  |  |  |  |  140|   481k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   481k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   481k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   481k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   481k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   481k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 85.9k, False: 395k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  85.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  85.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  85.9k|{ \
  |  |  |  |  |  |  |  |   57|  85.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 18.2k, False: 67.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  18.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  18.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  18.2k|        *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|  85.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  85.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  85.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  85.9k|{ \
  |  |  |  |  |  |  |  |  128|   141k|    do { \
  |  |  |  |  |  |  |  |  129|   141k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 17.0k, False: 124k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 15.1k, False: 1.86k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  15.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 14.5k, False: 626]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  14.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  14.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  14.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  14.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    626|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    626|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    626|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    626|            } \
  |  |  |  |  |  |  |  |  |  |  118|  15.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.86k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.86k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.86k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.86k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  17.0k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  17.0k|        } \
  |  |  |  |  |  |  |  |  132|   141k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   141k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   141k|        ct--; \
  |  |  |  |  |  |  |  |  135|   141k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 55.0k, False: 85.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  85.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   395k|    } else {  \
  |  |  |  |  |  |  149|   395k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   395k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 100k, False: 295k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   100k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   100k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   100k|{ \
  |  |  |  |  |  |  |  |   45|   100k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 13.7k, False: 86.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  13.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  13.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  86.5k|    } else { \
  |  |  |  |  |  |  |  |   49|  86.5k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  86.5k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  86.5k|    } \
  |  |  |  |  |  |  |  |   52|   100k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   100k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   100k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   100k|{ \
  |  |  |  |  |  |  |  |  128|   107k|    do { \
  |  |  |  |  |  |  |  |  129|   107k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 14.5k, False: 92.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  14.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  14.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  14.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  14.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  14.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  14.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  14.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  14.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 12.1k, False: 2.38k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  12.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 11.5k, False: 552]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  11.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  11.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  11.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  11.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    552|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    552|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    552|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    552|            } \
  |  |  |  |  |  |  |  |  |  |  118|  12.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.38k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.38k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.38k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.38k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  14.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  14.5k|        } \
  |  |  |  |  |  |  |  |  132|   107k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   107k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   107k|        ct--; \
  |  |  |  |  |  |  |  |  135|   107k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 7.00k, False: 100k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   100k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   295k|        } else { \
  |  |  |  |  |  |  154|   295k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   295k|        } \
  |  |  |  |  |  |  156|   395k|    } \
  |  |  |  |  |  |  157|   481k|}
  |  |  |  |  ------------------
  |  |  |  | 1126|   481k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 354k, False: 127k]
  |  |  |  |  ------------------
  |  |  |  | 1127|   481k|                    break; \
  |  |  |  | 1128|   481k|            } \
  |  |  |  | 1129|   678k|            { \
  |  |  |  | 1130|   323k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   323k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   323k|                                    ci); \
  |  |  |  | 1133|   323k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   323k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   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: 94.5k, False: 229k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  94.5k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  94.5k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  94.5k|{ \
  |  |  |  |  |  |  |  |   57|  94.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 12.0k, False: 82.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  12.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  12.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  12.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  82.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  82.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  82.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  82.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  82.4k|    } \
  |  |  |  |  |  |  |  |   66|  94.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  94.5k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  94.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  94.5k|{ \
  |  |  |  |  |  |  |  |  128|   148k|    do { \
  |  |  |  |  |  |  |  |  129|   148k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 17.9k, False: 131k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  17.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  17.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  17.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  17.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  17.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  17.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  17.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  17.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 15.9k, False: 1.94k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  15.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 15.0k, False: 895]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  15.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  15.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  15.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  15.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    895|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    895|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    895|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    895|            } \
  |  |  |  |  |  |  |  |  |  |  118|  15.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.94k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.94k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.94k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.94k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  17.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  17.9k|        } \
  |  |  |  |  |  |  |  |  132|   148k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   148k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   148k|        ct--; \
  |  |  |  |  |  |  |  |  135|   148k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 54.4k, False: 94.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  94.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   229k|    } else {  \
  |  |  |  |  |  |  149|   229k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   229k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 109k, False: 119k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   109k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   109k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   109k|{ \
  |  |  |  |  |  |  |  |   45|   109k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 8.99k, False: 100k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  8.99k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  8.99k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   100k|    } else { \
  |  |  |  |  |  |  |  |   49|   100k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   100k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   100k|    } \
  |  |  |  |  |  |  |  |   52|   109k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   109k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   109k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   109k|{ \
  |  |  |  |  |  |  |  |  128|   113k|    do { \
  |  |  |  |  |  |  |  |  129|   113k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 15.5k, False: 98.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  15.5k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  15.5k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  15.5k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  15.5k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  15.5k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  15.5k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  15.5k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  15.5k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 13.8k, False: 1.73k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.5k, False: 1.30k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.30k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.30k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.30k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.30k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.73k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.73k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.73k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.73k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  15.5k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  15.5k|        } \
  |  |  |  |  |  |  |  |  132|   113k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   113k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   113k|        ct--; \
  |  |  |  |  |  |  |  |  135|   113k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.30k, False: 109k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   109k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   119k|        } else { \
  |  |  |  |  |  |  154|   119k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   119k|        } \
  |  |  |  |  |  |  156|   229k|    } \
  |  |  |  |  |  |  157|   323k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   323k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   323k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 151k, False: 171k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   323k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   323k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   323k|{ \
  |  |  |  |  |  |  323|   323k|    /* east */ \
  |  |  |  |  |  |  324|   323k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   323k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   323k| \
  |  |  |  |  |  |  326|   323k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   323k| \
  |  |  |  |  |  |  329|   323k|    /* west */ \
  |  |  |  |  |  |  330|   323k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   323k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   323k| \
  |  |  |  |  |  |  332|   323k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   323k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   323k| \
  |  |  |  |  |  |  340|   323k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   323k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|   323k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   323k|            } \
  |  |  |  | 1139|   323k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   678k|    } \
  |  |  |  | 1141|   678k|}
  |  |  ------------------
  |  | 1296|   678k|                                            flags, flagsp, flags_stride, data, \
  |  | 1297|   678k|                                            l_w, 2, mqc, curctx, \
  |  | 1298|   678k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1299|   678k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|   678k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1300|   678k|                        /* FALLTHRU */ \
  |  | 1301|   852k|                    case 3: \
  |  |  ------------------
  |  |  |  Branch (1301:21): [True: 174k, False: 678k]
  |  |  ------------------
  |  | 1302|   852k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1118|   852k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|   852k|{ \
  |  |  |  | 1120|   852k|    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 (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1121|   852k|        do { \
  |  |  |  | 1122|   852k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [True: 678k, False: 174k]
  |  |  |  |  ------------------
  |  |  |  | 1123|   678k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|   678k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   678k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|   678k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   678k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   678k|{ \
  |  |  |  |  |  |  140|   678k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   678k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   678k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   678k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   678k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   678k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 102k, False: 576k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 22.2k, False: 79.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  22.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  22.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  22.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  79.7k|    } else { \
  |  |  |  |  |  |  |  |   62|  79.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  79.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  79.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  79.7k|    } \
  |  |  |  |  |  |  |  |   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|   176k|    do { \
  |  |  |  |  |  |  |  |  129|   176k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 23.9k, False: 152k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  23.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  23.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  23.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  23.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  23.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  23.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  23.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  23.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 19.4k, False: 4.50k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  19.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 18.5k, False: 867]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  18.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  18.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  18.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  18.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    867|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    867|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    867|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    867|            } \
  |  |  |  |  |  |  |  |  |  |  118|  19.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.50k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.50k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.50k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.50k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  23.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  23.9k|        } \
  |  |  |  |  |  |  |  |  132|   176k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   176k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   176k|        ct--; \
  |  |  |  |  |  |  |  |  135|   176k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 74.6k, False: 102k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   102k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   576k|    } else {  \
  |  |  |  |  |  |  149|   576k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   576k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 117k, False: 458k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   117k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   117k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   117k|{ \
  |  |  |  |  |  |  |  |   45|   117k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 14.8k, False: 102k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  14.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  14.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   102k|    } else { \
  |  |  |  |  |  |  |  |   49|   102k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   102k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   102k|    } \
  |  |  |  |  |  |  |  |   52|   117k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   117k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   117k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   117k|{ \
  |  |  |  |  |  |  |  |  128|   125k|    do { \
  |  |  |  |  |  |  |  |  129|   125k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16.6k, False: 108k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  16.6k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  16.6k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  16.6k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  16.6k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  16.6k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  16.6k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  16.6k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  16.6k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 14.6k, False: 2.00k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  14.6k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 14.0k, False: 599]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  14.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  14.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  14.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  14.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    599|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    599|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    599|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    599|            } \
  |  |  |  |  |  |  |  |  |  |  118|  14.6k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  2.00k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  2.00k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  2.00k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  2.00k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  16.6k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  16.6k|        } \
  |  |  |  |  |  |  |  |  132|   125k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   125k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   125k|        ct--; \
  |  |  |  |  |  |  |  |  135|   125k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 7.57k, False: 117k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   117k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   458k|        } else { \
  |  |  |  |  |  |  154|   458k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   458k|        } \
  |  |  |  |  |  |  156|   576k|    } \
  |  |  |  |  |  |  157|   678k|}
  |  |  |  |  ------------------
  |  |  |  | 1126|   678k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 521k, False: 156k]
  |  |  |  |  ------------------
  |  |  |  | 1127|   678k|                    break; \
  |  |  |  | 1128|   678k|            } \
  |  |  |  | 1129|   852k|            { \
  |  |  |  | 1130|   330k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|   330k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|   330k|                                    ci); \
  |  |  |  | 1133|   330k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   330k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|   330k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   330k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   330k|{ \
  |  |  |  |  |  |  140|   330k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   330k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   330k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   330k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   330k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   330k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 102k, False: 227k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 13.4k, False: 89.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  13.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  13.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  13.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  89.0k|    } else { \
  |  |  |  |  |  |  |  |   62|  89.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  89.0k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  89.0k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  89.0k|    } \
  |  |  |  |  |  |  |  |   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|   155k|    do { \
  |  |  |  |  |  |  |  |  129|   155k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 17.1k, False: 138k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  17.1k|            opj_mqc_bytein_macro(mqc, c, 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: 15.4k, False: 1.71k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  15.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 14.7k, False: 693]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  14.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  14.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  14.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  14.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    693|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    693|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    693|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    693|            } \
  |  |  |  |  |  |  |  |  |  |  118|  15.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.71k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.71k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.71k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.71k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  17.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  17.1k|        } \
  |  |  |  |  |  |  |  |  132|   155k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   155k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   155k|        ct--; \
  |  |  |  |  |  |  |  |  135|   155k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 53.1k, False: 102k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   102k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   227k|    } else {  \
  |  |  |  |  |  |  149|   227k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   227k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 106k, False: 121k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   106k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   106k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   106k|{ \
  |  |  |  |  |  |  |  |   45|   106k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 11.2k, False: 95.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  11.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  11.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  95.1k|    } else { \
  |  |  |  |  |  |  |  |   49|  95.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  95.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  95.1k|    } \
  |  |  |  |  |  |  |  |   52|   106k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   106k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   106k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   106k|{ \
  |  |  |  |  |  |  |  |  128|   111k|    do { \
  |  |  |  |  |  |  |  |  129|   111k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 14.9k, False: 96.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  14.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  14.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  14.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  14.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  14.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  14.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  14.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  14.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 13.4k, False: 1.43k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.2k, False: 1.19k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.2k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.2k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.2k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.2k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.19k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.19k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.19k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.19k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.43k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.43k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.43k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.43k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  14.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  14.9k|        } \
  |  |  |  |  |  |  |  |  132|   111k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   111k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   111k|        ct--; \
  |  |  |  |  |  |  |  |  135|   111k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.07k, False: 106k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   106k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   121k|        } else { \
  |  |  |  |  |  |  154|   121k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   121k|        } \
  |  |  |  |  |  |  156|   227k|    } \
  |  |  |  |  |  |  157|   330k|}
  |  |  |  |  ------------------
  |  |  |  | 1135|   330k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|   330k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 158k, False: 171k]
  |  |  |  |  ------------------
  |  |  |  | 1137|   330k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|   330k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|   330k|{ \
  |  |  |  |  |  |  323|   330k|    /* east */ \
  |  |  |  |  |  |  324|   330k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   330k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|   330k| \
  |  |  |  |  |  |  326|   330k|    /* mark target as significant */ \
  |  |  |  |  |  |  327|   330k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   330k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   330k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   330k| \
  |  |  |  |  |  |  329|   330k|    /* west */ \
  |  |  |  |  |  |  330|   330k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   330k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   330k| \
  |  |  |  |  |  |  332|   330k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|   330k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|   330k| \
  |  |  |  |  |  |  340|   330k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|   330k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|   330k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|   330k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   330k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   330k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|   330k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   330k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   330k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   330k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|   330k|    } \
  |  |  |  |  |  |  347|   330k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|   330k|            } \
  |  |  |  | 1139|   330k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|   852k|    } \
  |  |  |  | 1141|   852k|}
  |  |  ------------------
  |  | 1303|   852k|                                            flags, flagsp, flags_stride, data, \
  |  | 1304|   852k|                                            l_w, 3, mqc, curctx, \
  |  | 1305|   852k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1306|   852k|                        break; \
  |  | 1307|   852k|                } \
  |  | 1308|  34.4M|            } else { \
  |  | 1309|  34.4M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  34.4M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  34.4M|{ \
  |  |  |  | 1120|  34.4M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  34.4M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  34.4M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  34.4M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  34.4M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 5.41M, False: 29.0M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  5.41M|        do { \
  |  |  |  | 1122|  5.41M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  5.41M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  5.41M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  5.41M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  5.41M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  5.41M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  5.41M|{ \
  |  |  |  |  |  |  140|  5.41M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  5.41M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  5.41M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  5.41M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  5.41M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  5.41M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.14M, False: 4.26M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.14M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.14M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.14M|{ \
  |  |  |  |  |  |  |  |   57|  1.14M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 252k, False: 896k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   252k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   252k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   252k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   896k|    } else { \
  |  |  |  |  |  |  |  |   62|   896k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   896k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   896k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   896k|    } \
  |  |  |  |  |  |  |  |   66|  1.14M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.14M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.14M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.14M|{ \
  |  |  |  |  |  |  |  |  128|  1.88M|    do { \
  |  |  |  |  |  |  |  |  129|  1.88M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 232k, False: 1.65M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   232k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   232k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   232k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   232k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   232k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   232k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   232k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   232k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 214k, False: 17.7k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   214k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 208k, False: 6.44k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   208k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   208k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   208k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   208k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  6.44k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  6.44k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  6.44k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  6.44k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   214k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  17.7k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  17.7k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  17.7k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  17.7k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   232k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   232k|        } \
  |  |  |  |  |  |  |  |  132|  1.88M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.88M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.88M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.88M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 740k, False: 1.14M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.14M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  4.26M|    } else {  \
  |  |  |  |  |  |  149|  4.26M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  4.26M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.19M, False: 3.07M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.19M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.19M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.19M|{ \
  |  |  |  |  |  |  |  |   45|  1.19M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 198k, False: 997k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   198k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   198k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   997k|    } else { \
  |  |  |  |  |  |  |  |   49|   997k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   997k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   997k|    } \
  |  |  |  |  |  |  |  |   52|  1.19M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.19M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.19M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.19M|{ \
  |  |  |  |  |  |  |  |  128|  1.28M|    do { \
  |  |  |  |  |  |  |  |  129|  1.28M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 163k, False: 1.12M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   163k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   163k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   163k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   163k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   163k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   163k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   163k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   163k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 152k, False: 10.5k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   152k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 146k, False: 6.07k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   146k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   146k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   146k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   146k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  6.07k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  6.07k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  6.07k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  6.07k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   152k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  10.5k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  10.5k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  10.5k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  10.5k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   163k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   163k|        } \
  |  |  |  |  |  |  |  |  132|  1.28M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.28M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.28M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.28M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 87.4k, False: 1.19M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.19M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.07M|        } else { \
  |  |  |  |  |  |  154|  3.07M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  3.07M|        } \
  |  |  |  |  |  |  156|  4.26M|    } \
  |  |  |  |  |  |  157|  5.41M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  5.41M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 3.16M, False: 2.25M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  5.41M|                    break; \
  |  |  |  | 1128|  5.41M|            } \
  |  |  |  | 1129|  5.41M|            { \
  |  |  |  | 1130|  2.25M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  2.25M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  2.25M|                                    ci); \
  |  |  |  | 1133|  2.25M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.25M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  2.25M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.25M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.25M|{ \
  |  |  |  |  |  |  140|  2.25M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.25M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.25M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.25M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.25M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.25M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 630k, False: 1.62M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   630k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   630k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   630k|{ \
  |  |  |  |  |  |  |  |   57|   630k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 143k, False: 486k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   143k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   143k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   143k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   486k|    } else { \
  |  |  |  |  |  |  |  |   62|   486k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   486k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   486k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   486k|    } \
  |  |  |  |  |  |  |  |   66|   630k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   630k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   630k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   630k|{ \
  |  |  |  |  |  |  |  |  128|   989k|    do { \
  |  |  |  |  |  |  |  |  129|   989k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 125k, False: 864k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   125k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   125k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   125k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   125k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   125k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   125k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   125k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   125k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 116k, False: 8.09k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   116k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 114k, False: 2.95k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   114k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   114k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   114k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   114k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.95k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.95k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.95k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.95k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   116k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  8.09k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  8.09k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  8.09k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  8.09k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   125k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   125k|        } \
  |  |  |  |  |  |  |  |  132|   989k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   989k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   989k|        ct--; \
  |  |  |  |  |  |  |  |  135|   989k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 359k, False: 630k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   630k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.62M|    } else {  \
  |  |  |  |  |  |  149|  1.62M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.62M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 644k, False: 984k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   644k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   644k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   644k|{ \
  |  |  |  |  |  |  |  |   45|   644k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 112k, False: 531k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   112k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   112k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   531k|    } else { \
  |  |  |  |  |  |  |  |   49|   531k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   531k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   531k|    } \
  |  |  |  |  |  |  |  |   52|   644k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   644k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   644k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   644k|{ \
  |  |  |  |  |  |  |  |  128|   695k|    do { \
  |  |  |  |  |  |  |  |  129|   695k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 86.1k, False: 608k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  86.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  86.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  86.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  86.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  86.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  86.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  86.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  86.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 81.1k, False: 4.96k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  81.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 79.5k, False: 1.57k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  79.5k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  79.5k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  79.5k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  79.5k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.57k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.57k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.57k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.57k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  81.1k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.96k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.96k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.96k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.96k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  86.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  86.1k|        } \
  |  |  |  |  |  |  |  |  132|   695k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   695k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   695k|        ct--; \
  |  |  |  |  |  |  |  |  135|   695k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 50.8k, False: 644k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   644k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   984k|        } else { \
  |  |  |  |  |  |  154|   984k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   984k|        } \
  |  |  |  |  |  |  156|  1.62M|    } \
  |  |  |  |  |  |  157|  2.25M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  2.25M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  2.25M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 1.13M, False: 1.12M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  2.25M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.25M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.25M|{ \
  |  |  |  |  |  |  323|  2.25M|    /* east */ \
  |  |  |  |  |  |  324|  2.25M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.25M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.25M| \
  |  |  |  |  |  |  326|  2.25M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.25M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.25M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.25M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.25M| \
  |  |  |  |  |  |  329|  2.25M|    /* west */ \
  |  |  |  |  |  |  330|  2.25M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.25M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.25M| \
  |  |  |  |  |  |  332|  2.25M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.25M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  2.25M|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|  2.25M|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|  2.25M|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|  2.25M|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|  2.25M|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|  2.25M|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|  2.25M|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|  2.25M|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|  2.25M|    } \
  |  |  |  |  |  |  339|  2.25M| \
  |  |  |  |  |  |  340|  2.25M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.25M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  2.25M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  2.25M|            } \
  |  |  |  | 1139|  2.25M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  5.41M|    } \
  |  |  |  | 1141|  34.4M|}
  |  |  ------------------
  |  | 1310|  34.4M|                                    flags, flagsp, flags_stride, data, \
  |  | 1311|  34.4M|                                    l_w, 0, mqc, curctx, \
  |  | 1312|  34.4M|                                    v, a, c, ct, oneplushalf, vsc); \
  |  | 1313|  34.4M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  34.4M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  34.4M|{ \
  |  |  |  | 1120|  34.4M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  34.4M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  34.4M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  34.4M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  34.4M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 5.28M, False: 29.1M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  5.28M|        do { \
  |  |  |  | 1122|  5.28M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  5.28M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  5.28M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  5.28M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  5.28M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  5.28M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  5.28M|{ \
  |  |  |  |  |  |  140|  5.28M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  5.28M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  5.28M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  5.28M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  5.28M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  5.28M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.15M, False: 4.13M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.15M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.15M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.15M|{ \
  |  |  |  |  |  |  |  |   57|  1.15M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 249k, False: 901k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   249k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   249k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   249k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   901k|    } else { \
  |  |  |  |  |  |  |  |   62|   901k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   901k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   901k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   901k|    } \
  |  |  |  |  |  |  |  |   66|  1.15M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.15M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.15M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.15M|{ \
  |  |  |  |  |  |  |  |  128|  1.87M|    do { \
  |  |  |  |  |  |  |  |  129|  1.87M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 236k, False: 1.64M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   236k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   236k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   236k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   236k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   236k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   236k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   236k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   236k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 221k, False: 14.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   221k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 215k, False: 5.93k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   215k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   215k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   215k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   215k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  5.93k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  5.93k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  5.93k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  5.93k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   221k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  14.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  14.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  14.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  14.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   236k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   236k|        } \
  |  |  |  |  |  |  |  |  132|  1.87M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.87M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.87M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.87M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 726k, False: 1.15M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.15M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  4.13M|    } else {  \
  |  |  |  |  |  |  149|  4.13M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  4.13M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.21M, False: 2.91M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.21M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.21M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.21M|{ \
  |  |  |  |  |  |  |  |   45|  1.21M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 201k, False: 1.01M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   201k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   201k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.01M|    } else { \
  |  |  |  |  |  |  |  |   49|  1.01M|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.01M|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.01M|    } \
  |  |  |  |  |  |  |  |   52|  1.21M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.21M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.21M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.21M|{ \
  |  |  |  |  |  |  |  |  128|  1.30M|    do { \
  |  |  |  |  |  |  |  |  129|  1.30M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 161k, False: 1.14M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   161k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   161k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   161k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   161k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   161k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   161k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   161k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   161k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 151k, False: 10.1k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   151k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 146k, False: 5.01k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   146k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   146k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   146k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   146k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  5.01k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  5.01k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  5.01k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  5.01k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   151k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  10.1k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  10.1k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  10.1k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  10.1k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   161k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   161k|        } \
  |  |  |  |  |  |  |  |  132|  1.30M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.30M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.30M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.30M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 89.2k, False: 1.21M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.21M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.91M|        } else { \
  |  |  |  |  |  |  154|  2.91M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.91M|        } \
  |  |  |  |  |  |  156|  4.13M|    } \
  |  |  |  |  |  |  157|  5.28M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  5.28M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 3.13M, False: 2.15M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  5.28M|                    break; \
  |  |  |  | 1128|  5.28M|            } \
  |  |  |  | 1129|  5.28M|            { \
  |  |  |  | 1130|  2.15M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  2.15M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  2.15M|                                    ci); \
  |  |  |  | 1133|  2.15M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.15M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  2.15M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.15M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.15M|{ \
  |  |  |  |  |  |  140|  2.15M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.15M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.15M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.15M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.15M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.15M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 608k, False: 1.54M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   608k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   608k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   608k|{ \
  |  |  |  |  |  |  |  |   57|   608k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 137k, False: 471k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   137k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   137k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   137k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   471k|    } else { \
  |  |  |  |  |  |  |  |   62|   471k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   471k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   471k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   471k|    } \
  |  |  |  |  |  |  |  |   66|   608k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   608k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   608k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   608k|{ \
  |  |  |  |  |  |  |  |  128|   948k|    do { \
  |  |  |  |  |  |  |  |  129|   948k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 116k, False: 831k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   116k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   116k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   116k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   116k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   116k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   116k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   116k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   116k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 108k, False: 7.62k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   108k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 106k, False: 2.23k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   106k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   106k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   106k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   106k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.23k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.23k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.23k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.23k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   108k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  7.62k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  7.62k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  7.62k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  7.62k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   116k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   116k|        } \
  |  |  |  |  |  |  |  |  132|   948k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   948k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   948k|        ct--; \
  |  |  |  |  |  |  |  |  135|   948k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 339k, False: 608k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   608k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.54M|    } else {  \
  |  |  |  |  |  |  149|  1.54M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.54M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 630k, False: 916k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   630k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   630k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   630k|{ \
  |  |  |  |  |  |  |  |   45|   630k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 110k, False: 520k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   110k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   110k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   520k|    } else { \
  |  |  |  |  |  |  |  |   49|   520k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   520k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   520k|    } \
  |  |  |  |  |  |  |  |   52|   630k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   630k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   630k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   630k|{ \
  |  |  |  |  |  |  |  |  128|   681k|    do { \
  |  |  |  |  |  |  |  |  129|   681k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 83.8k, False: 597k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  83.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  83.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  83.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  83.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  83.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  83.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  83.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  83.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 79.0k, False: 4.83k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  79.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 76.3k, False: 2.63k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  76.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  76.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  76.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  76.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.63k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.63k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.63k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.63k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  79.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.83k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.83k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.83k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.83k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  83.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  83.8k|        } \
  |  |  |  |  |  |  |  |  132|   681k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   681k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   681k|        ct--; \
  |  |  |  |  |  |  |  |  135|   681k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 50.9k, False: 630k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   630k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   916k|        } else { \
  |  |  |  |  |  |  154|   916k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   916k|        } \
  |  |  |  |  |  |  156|  1.54M|    } \
  |  |  |  |  |  |  157|  2.15M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  2.15M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  2.15M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 1.08M, False: 1.07M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  2.15M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.15M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.15M|{ \
  |  |  |  |  |  |  323|  2.15M|    /* east */ \
  |  |  |  |  |  |  324|  2.15M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.15M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.15M| \
  |  |  |  |  |  |  326|  2.15M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.15M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.15M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.15M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.15M| \
  |  |  |  |  |  |  329|  2.15M|    /* west */ \
  |  |  |  |  |  |  330|  2.15M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.15M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.15M| \
  |  |  |  |  |  |  332|  2.15M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.15M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  2.15M| \
  |  |  |  |  |  |  340|  2.15M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.15M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  2.15M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  2.15M|            } \
  |  |  |  | 1139|  2.15M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  5.28M|    } \
  |  |  |  | 1141|  34.4M|}
  |  |  ------------------
  |  | 1314|  34.4M|                                    flags, flagsp, flags_stride, data, \
  |  | 1315|  34.4M|                                    l_w, 1, mqc, curctx, \
  |  | 1316|  34.4M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1317|  34.4M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  34.4M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  34.4M|{ \
  |  |  |  | 1120|  34.4M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  34.4M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  34.4M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  34.4M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  34.4M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 5.29M, False: 29.1M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  5.29M|        do { \
  |  |  |  | 1122|  5.29M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  5.29M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  5.29M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  5.29M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  5.29M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  5.29M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  5.29M|{ \
  |  |  |  |  |  |  140|  5.29M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  5.29M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  5.29M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  5.29M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  5.29M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  5.29M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.11M, False: 4.17M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.11M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.11M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.11M|{ \
  |  |  |  |  |  |  |  |   57|  1.11M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 246k, False: 872k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   246k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   246k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   246k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   872k|    } else { \
  |  |  |  |  |  |  |  |   62|   872k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   872k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   872k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   872k|    } \
  |  |  |  |  |  |  |  |   66|  1.11M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.11M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.11M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.11M|{ \
  |  |  |  |  |  |  |  |  128|  1.83M|    do { \
  |  |  |  |  |  |  |  |  129|  1.83M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 231k, False: 1.60M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   231k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   231k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   231k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   231k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   231k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   231k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   231k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   231k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 214k, False: 17.2k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   214k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 208k, False: 6.37k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   208k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   208k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   208k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   208k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  6.37k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  6.37k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  6.37k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  6.37k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   214k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  17.2k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  17.2k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  17.2k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  17.2k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   231k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   231k|        } \
  |  |  |  |  |  |  |  |  132|  1.83M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.83M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.83M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.83M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 717k, False: 1.11M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.11M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  4.17M|    } else {  \
  |  |  |  |  |  |  149|  4.17M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  4.17M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.17M, False: 3.00M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.17M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.17M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.17M|{ \
  |  |  |  |  |  |  |  |   45|  1.17M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 186k, False: 986k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   186k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   186k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   986k|    } else { \
  |  |  |  |  |  |  |  |   49|   986k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   986k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   986k|    } \
  |  |  |  |  |  |  |  |   52|  1.17M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.17M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.17M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.17M|{ \
  |  |  |  |  |  |  |  |  128|  1.25M|    do { \
  |  |  |  |  |  |  |  |  129|  1.25M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 163k, False: 1.09M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   163k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   163k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   163k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   163k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   163k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   163k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   163k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   163k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 154k, False: 8.89k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   154k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 146k, False: 8.18k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   146k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   146k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   146k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   146k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  8.18k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  8.18k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  8.18k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  8.18k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   154k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  8.89k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  8.89k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  8.89k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  8.89k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   163k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   163k|        } \
  |  |  |  |  |  |  |  |  132|  1.25M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.25M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.25M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.25M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 84.8k, False: 1.17M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.17M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.00M|        } else { \
  |  |  |  |  |  |  154|  3.00M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  3.00M|        } \
  |  |  |  |  |  |  156|  4.17M|    } \
  |  |  |  |  |  |  157|  5.29M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  5.29M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 3.17M, False: 2.11M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  5.29M|                    break; \
  |  |  |  | 1128|  5.29M|            } \
  |  |  |  | 1129|  5.29M|            { \
  |  |  |  | 1130|  2.11M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  2.11M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  2.11M|                                    ci); \
  |  |  |  | 1133|  2.11M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.11M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  2.11M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.11M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.11M|{ \
  |  |  |  |  |  |  140|  2.11M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.11M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.11M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.11M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.11M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.11M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 597k, False: 1.51M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   597k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   597k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   597k|{ \
  |  |  |  |  |  |  |  |   57|   597k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 133k, False: 464k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   133k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   133k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   133k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   464k|    } else { \
  |  |  |  |  |  |  |  |   62|   464k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   464k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   464k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   464k|    } \
  |  |  |  |  |  |  |  |   66|   597k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   597k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   597k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   597k|{ \
  |  |  |  |  |  |  |  |  128|   933k|    do { \
  |  |  |  |  |  |  |  |  129|   933k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 118k, False: 814k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   118k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   118k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   118k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   118k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   118k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   118k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   118k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   118k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 109k, False: 8.54k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   109k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 107k, False: 2.50k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   107k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   107k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   107k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   107k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.50k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.50k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.50k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.50k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   109k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  8.54k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  8.54k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  8.54k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  8.54k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   118k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   118k|        } \
  |  |  |  |  |  |  |  |  132|   933k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   933k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   933k|        ct--; \
  |  |  |  |  |  |  |  |  135|   933k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 335k, False: 597k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   597k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.51M|    } else {  \
  |  |  |  |  |  |  149|  1.51M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.51M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 603k, False: 916k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   603k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   603k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   603k|{ \
  |  |  |  |  |  |  |  |   45|   603k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 106k, False: 496k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   106k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   106k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   496k|    } else { \
  |  |  |  |  |  |  |  |   49|   496k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   496k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   496k|    } \
  |  |  |  |  |  |  |  |   52|   603k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   603k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   603k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   603k|{ \
  |  |  |  |  |  |  |  |  128|   652k|    do { \
  |  |  |  |  |  |  |  |  129|   652k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 84.4k, False: 568k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  84.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  84.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  84.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  84.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  84.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  84.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  84.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  84.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 79.3k, False: 5.18k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  79.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 77.6k, False: 1.65k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  77.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  77.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  77.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  77.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  1.65k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  1.65k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  1.65k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  1.65k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  79.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  5.18k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  5.18k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  5.18k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  5.18k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  84.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  84.4k|        } \
  |  |  |  |  |  |  |  |  132|   652k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   652k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   652k|        ct--; \
  |  |  |  |  |  |  |  |  135|   652k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 49.5k, False: 603k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   603k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   916k|        } else { \
  |  |  |  |  |  |  154|   916k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   916k|        } \
  |  |  |  |  |  |  156|  1.51M|    } \
  |  |  |  |  |  |  157|  2.11M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  2.11M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  2.11M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 1.04M, False: 1.06M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  2.11M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.11M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.11M|{ \
  |  |  |  |  |  |  323|  2.11M|    /* east */ \
  |  |  |  |  |  |  324|  2.11M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.11M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.11M| \
  |  |  |  |  |  |  326|  2.11M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.11M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.11M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.11M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.11M| \
  |  |  |  |  |  |  329|  2.11M|    /* west */ \
  |  |  |  |  |  |  330|  2.11M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.11M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.11M| \
  |  |  |  |  |  |  332|  2.11M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.11M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  2.11M| \
  |  |  |  |  |  |  340|  2.11M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.11M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|      0|    } \
  |  |  |  |  |  |  347|  2.11M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  2.11M|            } \
  |  |  |  | 1139|  2.11M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  5.29M|    } \
  |  |  |  | 1141|  34.4M|}
  |  |  ------------------
  |  | 1318|  34.4M|                                    flags, flagsp, flags_stride, data, \
  |  | 1319|  34.4M|                                    l_w, 2, mqc, curctx, \
  |  | 1320|  34.4M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1321|  34.4M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1118|  34.4M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1119|  34.4M|{ \
  |  |  |  | 1120|  34.4M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  34.4M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  34.4M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  34.4M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  34.4M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1120:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1120:26): [True: 5.38M, False: 29.0M]
  |  |  |  |  ------------------
  |  |  |  | 1121|  5.38M|        do { \
  |  |  |  | 1122|  5.38M|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1122:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1123|  5.38M|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1124|  5.38M|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  5.38M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1125|  5.38M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  5.38M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  5.38M|{ \
  |  |  |  |  |  |  140|  5.38M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  5.38M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  5.38M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  5.38M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  5.38M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  5.38M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.03M, False: 4.34M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.03M|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.03M|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.03M|{ \
  |  |  |  |  |  |  |  |   57|  1.03M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 208k, False: 823k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   208k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   208k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   208k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   823k|    } else { \
  |  |  |  |  |  |  |  |   62|   823k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   823k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   823k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   823k|    } \
  |  |  |  |  |  |  |  |   66|  1.03M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.03M|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.03M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.03M|{ \
  |  |  |  |  |  |  |  |  128|  1.73M|    do { \
  |  |  |  |  |  |  |  |  129|  1.73M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 212k, False: 1.52M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   212k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   212k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   212k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   212k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   212k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   212k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   212k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   212k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 199k, False: 13.0k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   199k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 194k, False: 5.06k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   194k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   194k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   194k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   194k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  5.06k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  5.06k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  5.06k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  5.06k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   199k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  13.0k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  13.0k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  13.0k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  13.0k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   212k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   212k|        } \
  |  |  |  |  |  |  |  |  132|  1.73M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.73M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.73M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.73M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 707k, False: 1.03M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.03M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  4.34M|    } else {  \
  |  |  |  |  |  |  149|  4.34M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  4.34M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.11M, False: 3.23M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.11M|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.11M|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.11M|{ \
  |  |  |  |  |  |  |  |   45|  1.11M|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 169k, False: 947k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   169k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   169k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   947k|    } else { \
  |  |  |  |  |  |  |  |   49|   947k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   947k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   947k|    } \
  |  |  |  |  |  |  |  |   52|  1.11M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.11M|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.11M|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.11M|{ \
  |  |  |  |  |  |  |  |  128|  1.19M|    do { \
  |  |  |  |  |  |  |  |  129|  1.19M|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 156k, False: 1.03M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|   156k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|   156k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|   156k|{ \
  |  |  |  |  |  |  |  |  |  |  104|   156k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|   156k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|   156k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|   156k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|   156k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 141k, False: 14.8k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   141k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 137k, False: 3.33k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   137k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   137k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   137k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   137k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  3.33k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  3.33k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  3.33k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  3.33k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   141k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  14.8k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  14.8k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  14.8k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  14.8k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   156k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   156k|        } \
  |  |  |  |  |  |  |  |  132|  1.19M|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.19M|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.19M|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.19M|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 73.7k, False: 1.11M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.11M|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  3.23M|        } else { \
  |  |  |  |  |  |  154|  3.23M|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  3.23M|        } \
  |  |  |  |  |  |  156|  4.34M|    } \
  |  |  |  |  |  |  157|  5.38M|}
  |  |  |  |  ------------------
  |  |  |  | 1126|  5.38M|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1126:21): [True: 3.35M, False: 2.02M]
  |  |  |  |  ------------------
  |  |  |  | 1127|  5.38M|                    break; \
  |  |  |  | 1128|  5.38M|            } \
  |  |  |  | 1129|  5.38M|            { \
  |  |  |  | 1130|  2.02M|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1131|  2.02M|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1132|  2.02M|                                    ci); \
  |  |  |  | 1133|  2.02M|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  2.02M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1134|  2.02M|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.02M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.02M|{ \
  |  |  |  |  |  |  140|  2.02M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.02M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.02M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.02M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.02M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.02M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 563k, False: 1.45M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   563k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   563k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   563k|{ \
  |  |  |  |  |  |  |  |   57|   563k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 130k, False: 433k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|   130k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|   130k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|   130k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   433k|    } else { \
  |  |  |  |  |  |  |  |   62|   433k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   433k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   433k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   433k|    } \
  |  |  |  |  |  |  |  |   66|   563k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   563k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   563k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   563k|{ \
  |  |  |  |  |  |  |  |  128|   879k|    do { \
  |  |  |  |  |  |  |  |  129|   879k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 111k, False: 768k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 104k, False: 6.55k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|   104k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 102k, False: 2.68k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|   102k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|   102k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|   102k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|   102k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.68k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.68k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.68k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.68k|            } \
  |  |  |  |  |  |  |  |  |  |  118|   104k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  6.55k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  6.55k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  6.55k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  6.55k|        } \
  |  |  |  |  |  |  |  |  |  |  123|   111k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|   111k|        } \
  |  |  |  |  |  |  |  |  132|   879k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   879k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   879k|        ct--; \
  |  |  |  |  |  |  |  |  135|   879k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 315k, False: 563k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   563k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.45M|    } else {  \
  |  |  |  |  |  |  149|  1.45M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.45M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 586k, False: 873k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   586k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   586k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   586k|{ \
  |  |  |  |  |  |  |  |   45|   586k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 103k, False: 482k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   103k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|   103k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   482k|    } else { \
  |  |  |  |  |  |  |  |   49|   482k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   482k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   482k|    } \
  |  |  |  |  |  |  |  |   52|   586k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   586k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   586k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   586k|{ \
  |  |  |  |  |  |  |  |  128|   633k|    do { \
  |  |  |  |  |  |  |  |  129|   633k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 82.1k, False: 551k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  82.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  82.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  82.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  82.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  82.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  82.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  82.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  82.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 77.3k, False: 4.75k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  77.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 74.8k, False: 2.49k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  74.8k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  74.8k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  74.8k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  74.8k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|  2.49k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|  2.49k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|  2.49k|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|  2.49k|            } \
  |  |  |  |  |  |  |  |  |  |  118|  77.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  4.75k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  4.75k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  4.75k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  4.75k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  82.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  82.1k|        } \
  |  |  |  |  |  |  |  |  132|   633k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   633k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   633k|        ct--; \
  |  |  |  |  |  |  |  |  135|   633k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 46.8k, False: 586k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   586k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   873k|        } else { \
  |  |  |  |  |  |  154|   873k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   873k|        } \
  |  |  |  |  |  |  156|  1.45M|    } \
  |  |  |  |  |  |  157|  2.02M|}
  |  |  |  |  ------------------
  |  |  |  | 1135|  2.02M|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1136|  2.02M|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:40): [True: 1.01M, False: 1.01M]
  |  |  |  |  ------------------
  |  |  |  | 1137|  2.02M|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  321|  2.02M|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  322|  2.02M|{ \
  |  |  |  |  |  |  323|  2.02M|    /* east */ \
  |  |  |  |  |  |  324|  2.02M|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  2.02M|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  325|  2.02M| \
  |  |  |  |  |  |  326|  2.02M|    /* mark target as significant */ \
  |  |  |  |  |  |  327|  2.02M|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  2.02M|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  2.02M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  2.02M| \
  |  |  |  |  |  |  329|  2.02M|    /* west */ \
  |  |  |  |  |  |  330|  2.02M|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  2.02M|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  2.02M| \
  |  |  |  |  |  |  332|  2.02M|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  333|  2.02M|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (333:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (333:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  335|      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)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  336|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  338|      0|    } \
  |  |  |  |  |  |  339|  2.02M| \
  |  |  |  |  |  |  340|  2.02M|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  341|  2.02M|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (341:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  342|  2.02M|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  343|  2.02M|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  2.02M|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  2.02M|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  344|  2.02M|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  2.02M|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  2.02M|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  2.02M|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  346|  2.02M|    } \
  |  |  |  |  |  |  347|  2.02M|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  2.02M|            } \
  |  |  |  | 1139|  2.02M|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1140|  5.38M|    } \
  |  |  |  | 1141|  34.4M|}
  |  |  ------------------
  |  | 1322|  34.4M|                                    flags, flagsp, flags_stride, data, \
  |  | 1323|  34.4M|                                    l_w, 3, mqc, curctx, \
  |  | 1324|  34.4M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1325|  34.4M|            } \
  |  | 1326|  46.8M|            *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  35.2M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  35.2M|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  35.2M|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  35.2M|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1327|  35.2M|        } \
  |  | 1328|  3.92M|    } \
  |  | 1329|   201k|    UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|   201k|        mqc->curctx = curctx; \
  |  |  |  |  167|   201k|        mqc->c = c; \
  |  |  |  |  168|   201k|        mqc->a = a; \
  |  |  |  |  169|   201k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1330|   201k|    if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1330:9): [True: 36.9k, False: 164k]
  |  |  ------------------
  |  | 1331|  3.23M|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) { \
  |  |  ------------------
  |  |  |  Branch (1331:21): [True: 3.19M, False: 36.9k]
  |  |  ------------------
  |  | 1332|  8.72M|            for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1332:25): [True: 5.52M, False: 3.19M]
  |  |  ------------------
  |  | 1333|  5.52M|                opj_t1_dec_clnpass_step(t1, flagsp, data + j * l_w, oneplushalf, j, vsc); \
  |  | 1334|  5.52M|            } \
  |  | 1335|  3.19M|            *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  3.19M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  3.19M|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  3.19M|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  3.19M|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1336|  3.19M|        } \
  |  | 1337|  36.9k|    } \
  |  | 1338|   201k|}
  ------------------
 1380|   201k|                                t1->w + 2U);
 1381|   201k|}
t1.c:opj_t1_dec_clnpass_check_segsym:
 1341|   522k|{
 1342|   522k|    if (cblksty & J2K_CCP_CBLKSTY_SEGSYM) {
  ------------------
  |  |   63|   522k|#define J2K_CCP_CBLKSTY_SEGSYM 0x20   /**< Segmentation symbols are used */
  ------------------
  |  Branch (1342:9): [True: 274k, False: 247k]
  ------------------
 1343|   274k|        opj_mqc_t* mqc = &(t1->mqc);
 1344|   274k|        OPJ_UINT32 v, v2;
 1345|   274k|        opj_mqc_setcurctx(mqc, T1_CTXNO_UNI);
  ------------------
  |  |  139|   274k|#define opj_mqc_setcurctx(mqc, ctxno)   (mqc)->curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  ------------------
 1346|   274k|        opj_mqc_decode(v, mqc);
  ------------------
  |  |  194|   274k|    opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
  |  |  ------------------
  |  |  |  |  138|   274k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   274k|{ \
  |  |  |  |  140|   274k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   274k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   274k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   274k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   274k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   274k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 99.6k, False: 175k]
  |  |  |  |  ------------------
  |  |  |  |  146|  99.6k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  99.6k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  99.6k|{ \
  |  |  |  |  |  |   57|  99.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 49.8k, False: 49.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  49.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  49.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  49.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  49.8k|    } else { \
  |  |  |  |  |  |   62|  49.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  49.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  49.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  49.7k|    } \
  |  |  |  |  |  |   66|  99.6k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  99.6k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  99.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  99.6k|{ \
  |  |  |  |  |  |  128|  99.6k|    do { \
  |  |  |  |  |  |  129|  99.6k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 12.4k, False: 87.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  12.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  12.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  12.4k|{ \
  |  |  |  |  |  |  |  |  104|  12.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  12.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  12.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  12.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  12.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.40k, False: 3.05k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  9.40k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 8.38k, False: 1.02k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  8.38k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  8.38k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  8.38k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  8.38k|            } else { \
  |  |  |  |  |  |  |  |  114|  1.02k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  1.02k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  1.02k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  1.02k|            } \
  |  |  |  |  |  |  |  |  118|  9.40k|        } else { \
  |  |  |  |  |  |  |  |  119|  3.05k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  3.05k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  3.05k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  3.05k|        } \
  |  |  |  |  |  |  |  |  123|  12.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  12.4k|        } \
  |  |  |  |  |  |  132|  99.6k|        a <<= 1; \
  |  |  |  |  |  |  133|  99.6k|        c <<= 1; \
  |  |  |  |  |  |  134|  99.6k|        ct--; \
  |  |  |  |  |  |  135|  99.6k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 99.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  99.6k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   175k|    } else {  \
  |  |  |  |  149|   175k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   175k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 125k, False: 49.2k]
  |  |  |  |  ------------------
  |  |  |  |  151|   125k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   125k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   125k|{ \
  |  |  |  |  |  |   45|   125k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 68.7k, False: 57.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  68.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  68.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  68.7k|    } else { \
  |  |  |  |  |  |   49|  57.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  57.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  57.0k|    } \
  |  |  |  |  |  |   52|   125k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   125k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   125k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   125k|{ \
  |  |  |  |  |  |  128|   147k|    do { \
  |  |  |  |  |  |  129|   147k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 29.9k, False: 117k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  29.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  29.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  29.9k|{ \
  |  |  |  |  |  |  |  |  104|  29.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  29.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  29.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  29.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  29.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 26.8k, False: 3.12k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  26.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 25.9k, False: 904]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  25.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  25.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  25.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  25.9k|            } else { \
  |  |  |  |  |  |  |  |  114|    904|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    904|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    904|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    904|            } \
  |  |  |  |  |  |  |  |  118|  26.8k|        } else { \
  |  |  |  |  |  |  |  |  119|  3.12k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  3.12k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  3.12k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  3.12k|        } \
  |  |  |  |  |  |  |  |  123|  29.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  29.9k|        } \
  |  |  |  |  |  |  132|   147k|        a <<= 1; \
  |  |  |  |  |  |  133|   147k|        c <<= 1; \
  |  |  |  |  |  |  134|   147k|        ct--; \
  |  |  |  |  |  |  135|   147k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 21.9k, False: 125k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   125k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   125k|        } else { \
  |  |  |  |  154|  49.2k|            d = (*curctx)->mps; \
  |  |  |  |  155|  49.2k|        } \
  |  |  |  |  156|   175k|    } \
  |  |  |  |  157|   274k|}
  |  |  ------------------
  ------------------
 1347|   274k|        opj_mqc_decode(v2, mqc);
  ------------------
  |  |  194|   274k|    opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
  |  |  ------------------
  |  |  |  |  138|   274k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   274k|{ \
  |  |  |  |  140|   274k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   274k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   274k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   274k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   274k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   274k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 98.9k, False: 175k]
  |  |  |  |  ------------------
  |  |  |  |  146|  98.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  98.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  98.9k|{ \
  |  |  |  |  |  |   57|  98.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 30.0k, False: 68.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  30.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  30.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  30.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  68.9k|    } else { \
  |  |  |  |  |  |   62|  68.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  68.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  68.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  68.9k|    } \
  |  |  |  |  |  |   66|  98.9k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  98.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  98.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  98.9k|{ \
  |  |  |  |  |  |  128|  98.9k|    do { \
  |  |  |  |  |  |  129|  98.9k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 15.9k, False: 83.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 13.0k, False: 2.93k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  13.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10.3k, False: 2.68k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  10.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  10.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  10.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  10.3k|            } else { \
  |  |  |  |  |  |  |  |  114|  2.68k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  2.68k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  2.68k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  2.68k|            } \
  |  |  |  |  |  |  |  |  118|  13.0k|        } else { \
  |  |  |  |  |  |  |  |  119|  2.93k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  2.93k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  2.93k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  2.93k|        } \
  |  |  |  |  |  |  |  |  123|  15.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  15.9k|        } \
  |  |  |  |  |  |  132|  98.9k|        a <<= 1; \
  |  |  |  |  |  |  133|  98.9k|        c <<= 1; \
  |  |  |  |  |  |  134|  98.9k|        ct--; \
  |  |  |  |  |  |  135|  98.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 98.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  98.9k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   175k|    } else {  \
  |  |  |  |  149|   175k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   175k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 147k, False: 28.3k]
  |  |  |  |  ------------------
  |  |  |  |  151|   147k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   147k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   147k|{ \
  |  |  |  |  |  |   45|   147k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 69.4k, False: 77.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  69.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  69.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  77.9k|    } else { \
  |  |  |  |  |  |   49|  77.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  77.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  77.9k|    } \
  |  |  |  |  |  |   52|   147k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   147k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   147k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   147k|{ \
  |  |  |  |  |  |  128|   180k|    do { \
  |  |  |  |  |  |  129|   180k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 20.3k, False: 160k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  20.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  20.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  20.3k|{ \
  |  |  |  |  |  |  |  |  104|  20.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  20.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  20.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  20.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  20.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 18.0k, False: 2.30k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  18.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 16.8k, False: 1.18k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  16.8k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  16.8k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  16.8k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  16.8k|            } else { \
  |  |  |  |  |  |  |  |  114|  1.18k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  1.18k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  1.18k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  1.18k|            } \
  |  |  |  |  |  |  |  |  118|  18.0k|        } else { \
  |  |  |  |  |  |  |  |  119|  2.30k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  2.30k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  2.30k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  2.30k|        } \
  |  |  |  |  |  |  |  |  123|  20.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  20.3k|        } \
  |  |  |  |  |  |  132|   180k|        a <<= 1; \
  |  |  |  |  |  |  133|   180k|        c <<= 1; \
  |  |  |  |  |  |  134|   180k|        ct--; \
  |  |  |  |  |  |  135|   180k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 33.6k, False: 147k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   147k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   147k|        } else { \
  |  |  |  |  154|  28.3k|            d = (*curctx)->mps; \
  |  |  |  |  155|  28.3k|        } \
  |  |  |  |  156|   175k|    } \
  |  |  |  |  157|   274k|}
  |  |  ------------------
  ------------------
 1348|   274k|        v = (v << 1) | v2;
 1349|   274k|        opj_mqc_decode(v2, mqc);
  ------------------
  |  |  194|   274k|    opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
  |  |  ------------------
  |  |  |  |  138|   274k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   274k|{ \
  |  |  |  |  140|   274k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   274k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   274k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   274k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   274k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   274k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 107k, False: 167k]
  |  |  |  |  ------------------
  |  |  |  |  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: 18.3k, False: 88.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  18.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  18.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  18.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  88.6k|    } else { \
  |  |  |  |  |  |   62|  88.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  88.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  88.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  88.6k|    } \
  |  |  |  |  |  |   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|   107k|    do { \
  |  |  |  |  |  |  129|   107k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 15.3k, False: 91.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  15.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  15.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  15.3k|{ \
  |  |  |  |  |  |  |  |  104|  15.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  15.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  15.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  15.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  15.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 13.2k, False: 2.09k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  13.2k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.22k, False: 4.03k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  9.22k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  9.22k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  9.22k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  9.22k|            } else { \
  |  |  |  |  |  |  |  |  114|  4.03k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  4.03k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  4.03k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  4.03k|            } \
  |  |  |  |  |  |  |  |  118|  13.2k|        } else { \
  |  |  |  |  |  |  |  |  119|  2.09k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  2.09k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  2.09k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  2.09k|        } \
  |  |  |  |  |  |  |  |  123|  15.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  15.3k|        } \
  |  |  |  |  |  |  132|   107k|        a <<= 1; \
  |  |  |  |  |  |  133|   107k|        c <<= 1; \
  |  |  |  |  |  |  134|   107k|        ct--; \
  |  |  |  |  |  |  135|   107k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 107k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   107k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   167k|    } else {  \
  |  |  |  |  149|   167k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   167k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 141k, False: 26.1k]
  |  |  |  |  ------------------
  |  |  |  |  151|   141k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   141k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   141k|{ \
  |  |  |  |  |  |   45|   141k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 46.0k, False: 95.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  46.0k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  46.0k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  95.3k|    } else { \
  |  |  |  |  |  |   49|  95.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  95.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  95.3k|    } \
  |  |  |  |  |  |   52|   141k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   141k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   141k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   141k|{ \
  |  |  |  |  |  |  128|   170k|    do { \
  |  |  |  |  |  |  129|   170k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 17.0k, False: 153k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 15.1k, False: 1.94k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  15.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 14.3k, False: 799]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  14.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  14.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  14.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  14.3k|            } else { \
  |  |  |  |  |  |  |  |  114|    799|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    799|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    799|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    799|            } \
  |  |  |  |  |  |  |  |  118|  15.1k|        } else { \
  |  |  |  |  |  |  |  |  119|  1.94k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  1.94k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  1.94k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  1.94k|        } \
  |  |  |  |  |  |  |  |  123|  17.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  17.0k|        } \
  |  |  |  |  |  |  132|   170k|        a <<= 1; \
  |  |  |  |  |  |  133|   170k|        c <<= 1; \
  |  |  |  |  |  |  134|   170k|        ct--; \
  |  |  |  |  |  |  135|   170k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 29.4k, False: 141k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   141k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   141k|        } else { \
  |  |  |  |  154|  26.1k|            d = (*curctx)->mps; \
  |  |  |  |  155|  26.1k|        } \
  |  |  |  |  156|   167k|    } \
  |  |  |  |  157|   274k|}
  |  |  ------------------
  ------------------
 1350|   274k|        v = (v << 1) | v2;
 1351|   274k|        opj_mqc_decode(v2, mqc);
  ------------------
  |  |  194|   274k|    opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
  |  |  ------------------
  |  |  |  |  138|   274k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   274k|{ \
  |  |  |  |  140|   274k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   274k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   274k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   274k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   274k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   274k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 108k, False: 166k]
  |  |  |  |  ------------------
  |  |  |  |  146|   108k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|   108k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|   108k|{ \
  |  |  |  |  |  |   57|   108k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 7.90k, False: 100k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  7.90k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  7.90k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  7.90k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|   100k|    } else { \
  |  |  |  |  |  |   62|   100k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|   100k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|   100k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|   100k|    } \
  |  |  |  |  |  |   66|   108k|}
  |  |  |  |  ------------------
  |  |  |  |  147|   108k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   108k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   108k|{ \
  |  |  |  |  |  |  128|   108k|    do { \
  |  |  |  |  |  |  129|   108k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 12.9k, False: 95.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  12.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  12.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  12.9k|{ \
  |  |  |  |  |  |  |  |  104|  12.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  12.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  12.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  12.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  12.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 10.7k, False: 2.18k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  10.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 8.64k, False: 2.13k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  8.64k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  8.64k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  8.64k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  8.64k|            } else { \
  |  |  |  |  |  |  |  |  114|  2.13k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  2.13k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  2.13k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  2.13k|            } \
  |  |  |  |  |  |  |  |  118|  10.7k|        } else { \
  |  |  |  |  |  |  |  |  119|  2.18k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  2.18k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  2.18k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  2.18k|        } \
  |  |  |  |  |  |  |  |  123|  12.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  12.9k|        } \
  |  |  |  |  |  |  132|   108k|        a <<= 1; \
  |  |  |  |  |  |  133|   108k|        c <<= 1; \
  |  |  |  |  |  |  134|   108k|        ct--; \
  |  |  |  |  |  |  135|   108k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 108k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   108k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   166k|    } else {  \
  |  |  |  |  149|   166k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   166k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 146k, False: 20.1k]
  |  |  |  |  ------------------
  |  |  |  |  151|   146k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   146k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|   146k|{ \
  |  |  |  |  |  |   45|   146k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 35.7k, False: 110k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  35.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  35.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|   110k|    } else { \
  |  |  |  |  |  |   49|   110k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|   110k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|   110k|    } \
  |  |  |  |  |  |   52|   146k|}
  |  |  |  |  ------------------
  |  |  |  |  152|   146k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   146k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|   146k|{ \
  |  |  |  |  |  |  128|   171k|    do { \
  |  |  |  |  |  |  129|   171k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 20.9k, False: 150k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 16.1k, False: 4.79k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  16.1k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.0k, False: 3.11k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  13.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  13.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  13.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  13.0k|            } else { \
  |  |  |  |  |  |  |  |  114|  3.11k|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|  3.11k|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|  3.11k|                ct = 7; \
  |  |  |  |  |  |  |  |  117|  3.11k|            } \
  |  |  |  |  |  |  |  |  118|  16.1k|        } else { \
  |  |  |  |  |  |  |  |  119|  4.79k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  4.79k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  4.79k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  4.79k|        } \
  |  |  |  |  |  |  |  |  123|  20.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  20.9k|        } \
  |  |  |  |  |  |  132|   171k|        a <<= 1; \
  |  |  |  |  |  |  133|   171k|        c <<= 1; \
  |  |  |  |  |  |  134|   171k|        ct--; \
  |  |  |  |  |  |  135|   171k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 25.0k, False: 146k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|   146k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   146k|        } else { \
  |  |  |  |  154|  20.1k|            d = (*curctx)->mps; \
  |  |  |  |  155|  20.1k|        } \
  |  |  |  |  156|   166k|    } \
  |  |  |  |  157|   274k|}
  |  |  ------------------
  ------------------
 1352|   274k|        v = (v << 1) | v2;
 1353|       |        /*
 1354|       |        if (v!=0xa) {
 1355|       |            opj_event_msg(t1->cinfo, EVT_WARNING, "Bad segmentation symbol %x\n", v);
 1356|       |        }
 1357|       |        */
 1358|   274k|    }
 1359|   522k|}

opj_t2_decode_packets:
  402|  6.88k|{
  403|  6.88k|    OPJ_BYTE *l_current_data = p_src;
  404|  6.88k|    opj_pi_iterator_t *l_pi = 00;
  405|  6.88k|    OPJ_UINT32 pino;
  406|  6.88k|    opj_image_t *l_image = p_t2->image;
  407|  6.88k|    opj_cp_t *l_cp = p_t2->cp;
  408|  6.88k|    opj_tcp_t *l_tcp = &(p_t2->cp->tcps[p_tile_no]);
  409|  6.88k|    OPJ_UINT32 l_nb_bytes_read;
  410|  6.88k|    OPJ_UINT32 l_nb_pocs = l_tcp->numpocs + 1;
  411|  6.88k|    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|  6.88k|    opj_packet_info_t *l_pack_info = 00;
  417|  6.88k|    opj_image_comp_t* l_img_comp = 00;
  418|       |
  419|  6.88k|    OPJ_ARG_NOT_USED(p_cstr_index);
  ------------------
  |  |  142|  6.88k|#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|  6.88k|    l_pi = opj_pi_create_decode(l_image, l_cp, p_tile_no, p_manager);
  429|  6.88k|    if (!l_pi) {
  ------------------
  |  Branch (429:9): [True: 14, False: 6.86k]
  ------------------
  430|     14|        return OPJ_FALSE;
  ------------------
  |  |  118|     14|#define OPJ_FALSE 0
  ------------------
  431|     14|    }
  432|       |
  433|       |
  434|  6.86k|    l_current_pi = l_pi;
  435|       |
  436|  21.5k|    for (pino = 0; pino <= l_tcp->numpocs; ++pino) {
  ------------------
  |  Branch (436:20): [True: 15.1k, False: 6.45k]
  ------------------
  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|  15.1k|        OPJ_BOOL* first_pass_failed = NULL;
  444|       |
  445|  15.1k|        if (l_current_pi->poc.prg == OPJ_PROG_UNKNOWN) {
  ------------------
  |  Branch (445:13): [True: 8, False: 15.0k]
  ------------------
  446|       |            /* TODO ADE : add an error */
  447|      8|            opj_pi_destroy(l_pi, l_nb_pocs);
  448|      8|            return OPJ_FALSE;
  ------------------
  |  |  118|      8|#define OPJ_FALSE 0
  ------------------
  449|      8|        }
  450|       |
  451|  15.0k|        first_pass_failed = (OPJ_BOOL*)opj_malloc(l_image->numcomps * sizeof(OPJ_BOOL));
  452|  15.0k|        if (!first_pass_failed) {
  ------------------
  |  Branch (452:13): [True: 0, False: 15.0k]
  ------------------
  453|      0|            opj_pi_destroy(l_pi, l_nb_pocs);
  454|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  455|      0|        }
  456|  15.0k|        memset(first_pass_failed, OPJ_TRUE, l_image->numcomps * sizeof(OPJ_BOOL));
  ------------------
  |  |  117|  15.0k|#define OPJ_TRUE 1
  ------------------
  457|       |
  458|   251M|        while (opj_pi_next(l_current_pi)) {
  ------------------
  |  Branch (458:16): [True: 251M, False: 14.6k]
  ------------------
  459|   251M|            OPJ_BOOL skip_packet = OPJ_FALSE;
  ------------------
  |  |  118|   251M|#define OPJ_FALSE 0
  ------------------
  460|   251M|            JAS_FPRINTF(stderr,
  ------------------
  |  |  390|   251M|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
  461|   251M|                        "packet offset=00000166 prg=%d cmptno=%02d rlvlno=%02d prcno=%03d lyrno=%02d\n\n",
  462|   251M|                        l_current_pi->poc.prg1, l_current_pi->compno, l_current_pi->resno,
  463|   251M|                        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|   251M|            if (l_current_pi->layno >= l_tcp->num_layers_to_decode) {
  ------------------
  |  Branch (467:17): [True: 0, False: 251M]
  ------------------
  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|   251M|            else if (l_current_pi->resno >=
  ------------------
  |  Branch (472:22): [True: 0, False: 251M]
  ------------------
  473|   251M|                     p_tile->comps[l_current_pi->compno].minimum_num_resolutions) {
  474|      0|                skip_packet = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
  475|   251M|            } else {
  476|       |                /* If no precincts of any band intersects the area of interest, */
  477|       |                /* skip the packet */
  478|   251M|                OPJ_UINT32 bandno;
  479|   251M|                opj_tcd_tilecomp_t *tilec = &p_tile->comps[l_current_pi->compno];
  480|   251M|                opj_tcd_resolution_t *res = &tilec->resolutions[l_current_pi->resno];
  481|       |
  482|   251M|                skip_packet = OPJ_TRUE;
  ------------------
  |  |  117|   251M|#define OPJ_TRUE 1
  ------------------
  483|   632M|                for (bandno = 0; bandno < res->numbands; ++bandno) {
  ------------------
  |  Branch (483:34): [True: 500M, False: 131M]
  ------------------
  484|   500M|                    opj_tcd_band_t* band = &res->bands[bandno];
  485|   500M|                    opj_tcd_precinct_t* prec = &band->precincts[l_current_pi->precno];
  486|       |
  487|   500M|                    if (opj_tcd_is_subband_area_of_interest(tcd,
  ------------------
  |  Branch (487:25): [True: 119M, False: 381M]
  ------------------
  488|   500M|                                                            l_current_pi->compno,
  489|   500M|                                                            l_current_pi->resno,
  490|   500M|                                                            band->bandno,
  491|   500M|                                                            (OPJ_UINT32)prec->x0,
  492|   500M|                                                            (OPJ_UINT32)prec->y0,
  493|   500M|                                                            (OPJ_UINT32)prec->x1,
  494|   500M|                                                            (OPJ_UINT32)prec->y1)) {
  495|   119M|                        skip_packet = OPJ_FALSE;
  ------------------
  |  |  118|   119M|#define OPJ_FALSE 0
  ------------------
  496|   119M|                        break;
  497|   119M|                    }
  498|   500M|                }
  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|   251M|            }
  505|   251M|            if (!skip_packet) {
  ------------------
  |  Branch (505:17): [True: 119M, False: 131M]
  ------------------
  506|   119M|                l_nb_bytes_read = 0;
  507|       |
  508|   119M|                first_pass_failed[l_current_pi->compno] = OPJ_FALSE;
  ------------------
  |  |  118|   119M|#define OPJ_FALSE 0
  ------------------
  509|       |
  510|   119M|                if (! opj_t2_decode_packet(p_t2, p_tile, l_tcp, l_current_pi, l_current_data,
  ------------------
  |  Branch (510:21): [True: 306, False: 119M]
  ------------------
  511|   119M|                                           &l_nb_bytes_read, p_max_len, l_pack_info, p_manager)) {
  512|    306|                    opj_pi_destroy(l_pi, l_nb_pocs);
  513|    306|                    opj_free(first_pass_failed);
  514|    306|                    return OPJ_FALSE;
  ------------------
  |  |  118|    306|#define OPJ_FALSE 0
  ------------------
  515|    306|                }
  516|       |
  517|   119M|                l_img_comp = &(l_image->comps[l_current_pi->compno]);
  518|   119M|                l_img_comp->resno_decoded = opj_uint_max(l_current_pi->resno,
  519|   119M|                                            l_img_comp->resno_decoded);
  520|   131M|            } else {
  521|   131M|                l_nb_bytes_read = 0;
  522|   131M|                if (! opj_t2_skip_packet(p_t2, p_tile, l_tcp, l_current_pi, l_current_data,
  ------------------
  |  Branch (522:21): [True: 99, False: 131M]
  ------------------
  523|   131M|                                         &l_nb_bytes_read, p_max_len, l_pack_info, p_manager)) {
  524|     99|                    opj_pi_destroy(l_pi, l_nb_pocs);
  525|     99|                    opj_free(first_pass_failed);
  526|     99|                    return OPJ_FALSE;
  ------------------
  |  |  118|     99|#define OPJ_FALSE 0
  ------------------
  527|     99|                }
  528|   131M|            }
  529|       |
  530|   251M|            if (first_pass_failed[l_current_pi->compno]) {
  ------------------
  |  Branch (530:17): [True: 299k, False: 251M]
  ------------------
  531|   299k|                l_img_comp = &(l_image->comps[l_current_pi->compno]);
  532|   299k|                if (l_img_comp->resno_decoded == 0) {
  ------------------
  |  Branch (532:21): [True: 2.36k, False: 297k]
  ------------------
  533|  2.36k|                    l_img_comp->resno_decoded =
  534|  2.36k|                        p_tile->comps[l_current_pi->compno].minimum_num_resolutions - 1;
  535|  2.36k|                }
  536|   299k|            }
  537|       |
  538|   251M|            l_current_data += l_nb_bytes_read;
  539|   251M|            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|   251M|        }
  570|  14.6k|        ++l_current_pi;
  571|       |
  572|  14.6k|        opj_free(first_pass_failed);
  573|  14.6k|    }
  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|  6.45k|    opj_pi_destroy(l_pi, l_nb_pocs);
  586|  6.45k|    *p_data_read = (OPJ_UINT32)(l_current_data - p_src);
  587|  6.45k|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.45k|#define OPJ_TRUE 1
  ------------------
  588|  6.86k|}
opj_t2_create:
  600|  6.88k|{
  601|       |    /* create the t2 structure */
  602|  6.88k|    opj_t2_t *l_t2 = (opj_t2_t*)opj_calloc(1, sizeof(opj_t2_t));
  603|  6.88k|    if (!l_t2) {
  ------------------
  |  Branch (603:9): [True: 0, False: 6.88k]
  ------------------
  604|      0|        return NULL;
  605|      0|    }
  606|       |
  607|  6.88k|    l_t2->image = p_image;
  608|  6.88k|    l_t2->cp = p_cp;
  609|       |
  610|  6.88k|    return l_t2;
  611|  6.88k|}
opj_t2_destroy:
  614|  6.88k|{
  615|  6.88k|    if (t2) {
  ------------------
  |  Branch (615:9): [True: 6.88k, False: 0]
  ------------------
  616|  6.88k|        opj_free(t2);
  617|  6.88k|    }
  618|  6.88k|}
t2.c:opj_null_jas_fprintf:
  386|   510M|{
  387|   510M|    (void)file;
  388|   510M|    (void)format;
  389|   510M|}
t2.c:opj_t2_decode_packet:
  629|   119M|{
  630|   119M|    OPJ_BOOL l_read_data;
  631|   119M|    OPJ_UINT32 l_nb_bytes_read = 0;
  632|   119M|    OPJ_UINT32 l_nb_total_bytes_read = 0;
  633|       |
  634|   119M|    *p_data_read = 0;
  635|       |
  636|   119M|    if (! opj_t2_read_packet_header(p_t2, p_tile, p_tcp, p_pi, &l_read_data, p_src,
  ------------------
  |  Branch (636:9): [True: 37, False: 119M]
  ------------------
  637|   119M|                                    &l_nb_bytes_read, p_max_length, p_pack_info, p_manager)) {
  638|     37|        return OPJ_FALSE;
  ------------------
  |  |  118|     37|#define OPJ_FALSE 0
  ------------------
  639|     37|    }
  640|       |
  641|   119M|    p_src += l_nb_bytes_read;
  642|   119M|    l_nb_total_bytes_read += l_nb_bytes_read;
  643|   119M|    p_max_length -= l_nb_bytes_read;
  644|       |
  645|       |    /* we should read data for the packet */
  646|   119M|    if (l_read_data) {
  ------------------
  |  Branch (646:9): [True: 159k, False: 119M]
  ------------------
  647|   159k|        l_nb_bytes_read = 0;
  648|       |
  649|   159k|        if (! opj_t2_read_packet_data(p_t2, p_tile, p_pi, p_src, &l_nb_bytes_read,
  ------------------
  |  Branch (649:13): [True: 269, False: 159k]
  ------------------
  650|   159k|                                      p_max_length, p_pack_info, p_manager)) {
  651|    269|            return OPJ_FALSE;
  ------------------
  |  |  118|    269|#define OPJ_FALSE 0
  ------------------
  652|    269|        }
  653|       |
  654|   159k|        l_nb_total_bytes_read += l_nb_bytes_read;
  655|   159k|    }
  656|       |
  657|   119M|    *p_data_read = l_nb_total_bytes_read;
  658|       |
  659|   119M|    return OPJ_TRUE;
  ------------------
  |  |  117|   119M|#define OPJ_TRUE 1
  ------------------
  660|   119M|}
t2.c:opj_t2_read_packet_header:
 1061|   251M|{
 1062|       |    /* loop */
 1063|   251M|    OPJ_UINT32 bandno, cblkno;
 1064|   251M|    OPJ_UINT32 l_nb_code_blocks;
 1065|   251M|    OPJ_UINT32 l_remaining_length;
 1066|   251M|    OPJ_UINT32 l_header_length;
 1067|   251M|    OPJ_UINT32 * l_modified_length_ptr = 00;
 1068|   251M|    OPJ_BYTE *l_current_data = p_src_data;
 1069|   251M|    opj_cp_t *l_cp = p_t2->cp;
 1070|   251M|    opj_bio_t *l_bio = 00;  /* BIO component */
 1071|   251M|    opj_tcd_band_t *l_band = 00;
 1072|   251M|    opj_tcd_cblk_dec_t* l_cblk = 00;
 1073|   251M|    opj_tcd_resolution_t* l_res =
 1074|   251M|        &p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
 1075|       |
 1076|   251M|    OPJ_BYTE *l_header_data = 00;
 1077|   251M|    OPJ_BYTE **l_header_data_start = 00;
 1078|       |
 1079|   251M|    OPJ_UINT32 l_present;
 1080|       |
 1081|   251M|    if (p_pi->layno == 0) {
  ------------------
  |  Branch (1081:9): [True: 205k, False: 251M]
  ------------------
 1082|   205k|        l_band = l_res->bands;
 1083|       |
 1084|       |        /* reset tagtrees */
 1085|   758k|        for (bandno = 0; bandno < l_res->numbands; ++bandno) {
  ------------------
  |  Branch (1085:26): [True: 553k, False: 205k]
  ------------------
 1086|   553k|            if (!opj_tcd_is_band_empty(l_band)) {
  ------------------
  |  Branch (1086:17): [True: 476k, False: 76.1k]
  ------------------
 1087|   476k|                opj_tcd_precinct_t *l_prc = &l_band->precincts[p_pi->precno];
 1088|   476k|                if (!(p_pi->precno < (l_band->precincts_data_size / sizeof(
  ------------------
  |  Branch (1088:21): [True: 0, False: 476k]
  ------------------
 1089|   476k|                                          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|   476k|                opj_tgt_reset(l_prc->incltree);
 1096|   476k|                opj_tgt_reset(l_prc->imsbtree);
 1097|   476k|                l_cblk = l_prc->cblks.dec;
 1098|       |
 1099|   476k|                l_nb_code_blocks = l_prc->cw * l_prc->ch;
 1100|  63.7M|                for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
  ------------------
  |  Branch (1100:34): [True: 63.2M, False: 476k]
  ------------------
 1101|  63.2M|                    l_cblk->numsegs = 0;
 1102|  63.2M|                    l_cblk->real_num_segs = 0;
 1103|  63.2M|                    ++l_cblk;
 1104|  63.2M|                }
 1105|   476k|            }
 1106|       |
 1107|   553k|            ++l_band;
 1108|   553k|        }
 1109|   205k|    }
 1110|       |
 1111|       |    /* SOP markers */
 1112|       |
 1113|   251M|    if (p_tcp->csty & J2K_CP_CSTY_SOP) {
  ------------------
  |  |   55|   251M|#define J2K_CP_CSTY_SOP 0x02
  ------------------
  |  Branch (1113:9): [True: 5.24M, False: 246M]
  ------------------
 1114|  5.24M|        if (p_max_length < 6) {
  ------------------
  |  Branch (1114:13): [True: 5.18M, False: 59.1k]
  ------------------
 1115|  5.18M|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  5.18M|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1116|  5.18M|                          "Not enough space for expected SOP marker\n");
 1117|  5.18M|        } else if ((*l_current_data) != 0xff || (*(l_current_data + 1) != 0x91)) {
  ------------------
  |  Branch (1117:20): [True: 54.3k, False: 4.74k]
  |  Branch (1117:49): [True: 4.44k, False: 296]
  ------------------
 1118|  58.8k|            opj_event_msg(p_manager, EVT_WARNING, "Expected SOP marker\n");
  ------------------
  |  |   67|  58.8k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1119|  58.8k|        } else {
 1120|    296|            l_current_data += 6;
 1121|    296|        }
 1122|       |
 1123|       |        /** TODO : check the Nsop value */
 1124|  5.24M|    }
 1125|       |
 1126|       |    /*
 1127|       |    When the marker PPT/PPM is used the packet header are store in PPT/PPM marker
 1128|       |    This part deal with this characteristic
 1129|       |    step 1: Read packet header in the saved structure
 1130|       |    step 2: Return to codestream for decoding
 1131|       |    */
 1132|       |
 1133|   251M|    l_bio = opj_bio_create();
 1134|   251M|    if (! l_bio) {
  ------------------
  |  Branch (1134:9): [True: 0, False: 251M]
  ------------------
 1135|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1136|      0|    }
 1137|       |
 1138|   251M|    if (l_cp->ppm == 1) { /* PPM */
  ------------------
  |  Branch (1138:9): [True: 974, False: 251M]
  ------------------
 1139|    974|        l_header_data_start = &l_cp->ppm_data;
 1140|    974|        l_header_data = *l_header_data_start;
 1141|    974|        l_modified_length_ptr = &(l_cp->ppm_len);
 1142|       |
 1143|   251M|    } else if (p_tcp->ppt == 1) { /* PPT */
  ------------------
  |  Branch (1143:16): [True: 313, False: 251M]
  ------------------
 1144|    313|        l_header_data_start = &(p_tcp->ppt_data);
 1145|    313|        l_header_data = *l_header_data_start;
 1146|    313|        l_modified_length_ptr = &(p_tcp->ppt_len);
 1147|   251M|    } else { /* Normal Case */
 1148|   251M|        l_header_data_start = &(l_current_data);
 1149|   251M|        l_header_data = *l_header_data_start;
 1150|   251M|        l_remaining_length = (OPJ_UINT32)(p_src_data + p_max_length - l_header_data);
 1151|   251M|        l_modified_length_ptr = &(l_remaining_length);
 1152|   251M|    }
 1153|       |
 1154|   251M|    opj_bio_init_dec(l_bio, l_header_data, *l_modified_length_ptr);
 1155|       |
 1156|   251M|    l_present = opj_bio_read(l_bio, 1);
 1157|   251M|    JAS_FPRINTF(stderr, "present=%d \n", l_present);
  ------------------
  |  |  390|   251M|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1158|   251M|    if (!l_present) {
  ------------------
  |  Branch (1158:9): [True: 251M, False: 272k]
  ------------------
 1159|       |        /* TODO MSD: no test to control the output of this function*/
 1160|   251M|        opj_bio_inalign(l_bio);
 1161|   251M|        l_header_data += opj_bio_numbytes(l_bio);
 1162|   251M|        opj_bio_destroy(l_bio);
 1163|       |
 1164|       |        /* EPH markers */
 1165|   251M|        if (p_tcp->csty & J2K_CP_CSTY_EPH) {
  ------------------
  |  |   56|   251M|#define J2K_CP_CSTY_EPH 0x04
  ------------------
  |  Branch (1165:13): [True: 15.0M, False: 236M]
  ------------------
 1166|  15.0M|            if ((*l_modified_length_ptr - (OPJ_UINT32)(l_header_data -
  ------------------
  |  Branch (1166:17): [True: 14.9M, False: 101k]
  ------------------
 1167|  15.0M|                    *l_header_data_start)) < 2U) {
 1168|  14.9M|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  14.9M|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1169|  14.9M|                              "Not enough space for expected EPH marker\n");
 1170|  14.9M|            } else if ((*l_header_data) != 0xff || (*(l_header_data + 1) != 0x92)) {
  ------------------
  |  Branch (1170:24): [True: 99.8k, False: 2.17k]
  |  Branch (1170:52): [True: 1.93k, False: 242]
  ------------------
 1171|   101k|                opj_event_msg(p_manager, EVT_WARNING, "Expected EPH marker\n");
  ------------------
  |  |   67|   101k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1172|   101k|            } else {
 1173|    242|                l_header_data += 2;
 1174|    242|            }
 1175|  15.0M|        }
 1176|       |
 1177|   251M|        l_header_length = (OPJ_UINT32)(l_header_data - *l_header_data_start);
 1178|   251M|        *l_modified_length_ptr -= l_header_length;
 1179|   251M|        *l_header_data_start += l_header_length;
 1180|       |
 1181|       |        /* << INDEX */
 1182|       |        /* End of packet header position. Currently only represents the distance to start of packet
 1183|       |           Will be updated later by incrementing with packet start value */
 1184|   251M|        if (p_pack_info) {
  ------------------
  |  Branch (1184:13): [True: 0, False: 251M]
  ------------------
 1185|      0|            p_pack_info->end_ph_pos = (OPJ_INT32)(l_current_data - p_src_data);
 1186|      0|        }
 1187|       |        /* INDEX >> */
 1188|       |
 1189|   251M|        * p_is_data_present = OPJ_FALSE;
  ------------------
  |  |  118|   251M|#define OPJ_FALSE 0
  ------------------
 1190|   251M|        *p_data_read = (OPJ_UINT32)(l_current_data - p_src_data);
 1191|   251M|        return OPJ_TRUE;
  ------------------
  |  |  117|   251M|#define OPJ_TRUE 1
  ------------------
 1192|   251M|    }
 1193|       |
 1194|   272k|    l_band = l_res->bands;
 1195|   966k|    for (bandno = 0; bandno < l_res->numbands; ++bandno, ++l_band) {
  ------------------
  |  Branch (1195:22): [True: 693k, False: 272k]
  ------------------
 1196|   693k|        opj_tcd_precinct_t *l_prc = &(l_band->precincts[p_pi->precno]);
 1197|       |
 1198|   693k|        if (opj_tcd_is_band_empty(l_band)) {
  ------------------
  |  Branch (1198:13): [True: 173k, False: 519k]
  ------------------
 1199|   173k|            continue;
 1200|   173k|        }
 1201|       |
 1202|   519k|        l_nb_code_blocks = l_prc->cw * l_prc->ch;
 1203|   519k|        l_cblk = l_prc->cblks.dec;
 1204|  7.75M|        for (cblkno = 0; cblkno < l_nb_code_blocks; cblkno++) {
  ------------------
  |  Branch (1204:26): [True: 7.24M, False: 519k]
  ------------------
 1205|  7.24M|            OPJ_UINT32 l_included, l_increment, l_segno;
 1206|  7.24M|            OPJ_INT32 n;
 1207|       |
 1208|       |            /* if cblk not yet included before --> inclusion tagtree */
 1209|  7.24M|            if (!l_cblk->numsegs) {
  ------------------
  |  Branch (1209:17): [True: 6.77M, False: 460k]
  ------------------
 1210|  6.77M|                l_included = opj_tgt_decode(l_bio, l_prc->incltree, cblkno,
 1211|  6.77M|                                            (OPJ_INT32)(p_pi->layno + 1));
 1212|       |                /* else one bit */
 1213|  6.77M|            } else {
 1214|   460k|                l_included = opj_bio_read(l_bio, 1);
 1215|   460k|            }
 1216|       |
 1217|       |            /* if cblk not included */
 1218|  7.24M|            if (!l_included) {
  ------------------
  |  Branch (1218:17): [True: 6.79M, False: 441k]
  ------------------
 1219|  6.79M|                l_cblk->numnewpasses = 0;
 1220|  6.79M|                ++l_cblk;
 1221|  6.79M|                JAS_FPRINTF(stderr, "included=%d \n", l_included);
  ------------------
  |  |  390|  6.79M|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1222|  6.79M|                continue;
 1223|  6.79M|            }
 1224|       |
 1225|       |            /* if cblk not yet included --> zero-bitplane tagtree */
 1226|   441k|            if (!l_cblk->numsegs) {
  ------------------
  |  Branch (1226:17): [True: 185k, False: 256k]
  ------------------
 1227|   185k|                OPJ_UINT32 i = 0;
 1228|       |
 1229|  1.53M|                while (!opj_tgt_decode(l_bio, l_prc->imsbtree, cblkno, (OPJ_INT32)i)) {
  ------------------
  |  Branch (1229:24): [True: 1.34M, False: 185k]
  ------------------
 1230|  1.34M|                    ++i;
 1231|  1.34M|                }
 1232|       |
 1233|   185k|                l_cblk->Mb = (OPJ_UINT32)l_band->numbps;
 1234|   185k|                l_cblk->numbps = (OPJ_UINT32)l_band->numbps + 1 - i;
 1235|   185k|                l_cblk->numlenbits = 3;
 1236|   185k|            }
 1237|       |
 1238|       |            /* number of coding passes */
 1239|   441k|            l_cblk->numnewpasses = opj_t2_getnumpasses(l_bio);
 1240|   441k|            l_increment = opj_t2_getcommacode(l_bio);
 1241|       |
 1242|       |            /* length indicator increment */
 1243|   441k|            l_cblk->numlenbits += l_increment;
 1244|   441k|            l_segno = 0;
 1245|       |
 1246|   441k|            if (!l_cblk->numsegs) {
  ------------------
  |  Branch (1246:17): [True: 185k, False: 256k]
  ------------------
 1247|   185k|                if (! opj_t2_init_seg(l_cblk, l_segno, p_tcp->tccps[p_pi->compno].cblksty, 1)) {
  ------------------
  |  Branch (1247:21): [True: 0, False: 185k]
  ------------------
 1248|      0|                    opj_bio_destroy(l_bio);
 1249|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1250|      0|                }
 1251|   256k|            } else {
 1252|   256k|                l_segno = l_cblk->numsegs - 1;
 1253|   256k|                if (l_cblk->segs[l_segno].numpasses == l_cblk->segs[l_segno].maxpasses) {
  ------------------
  |  Branch (1253:21): [True: 67.2k, False: 188k]
  ------------------
 1254|  67.2k|                    ++l_segno;
 1255|  67.2k|                    if (! opj_t2_init_seg(l_cblk, l_segno, p_tcp->tccps[p_pi->compno].cblksty, 0)) {
  ------------------
  |  Branch (1255:25): [True: 0, False: 67.2k]
  ------------------
 1256|      0|                        opj_bio_destroy(l_bio);
 1257|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1258|      0|                    }
 1259|  67.2k|                }
 1260|   256k|            }
 1261|   441k|            n = (OPJ_INT32)l_cblk->numnewpasses;
 1262|       |
 1263|   441k|            if ((p_tcp->tccps[p_pi->compno].cblksty & J2K_CCP_CBLKSTY_HT) != 0)
  ------------------
  |  |   64|   441k|#define J2K_CCP_CBLKSTY_HT 0x40       /**< (high throughput) HT codeblocks */
  ------------------
  |  Branch (1263:17): [True: 117k, False: 323k]
  ------------------
 1264|   121k|                do {
 1265|   121k|                    OPJ_UINT32 bit_number;
 1266|   121k|                    l_cblk->segs[l_segno].numnewpasses = l_segno == 0 ? 1 : (OPJ_UINT32)n;
  ------------------
  |  Branch (1266:58): [True: 10.6k, False: 110k]
  ------------------
 1267|   121k|                    bit_number = l_cblk->numlenbits + opj_uint_floorlog2(
 1268|   121k|                                     l_cblk->segs[l_segno].numnewpasses);
 1269|   121k|                    if (bit_number > 32) {
  ------------------
  |  Branch (1269:25): [True: 9, False: 121k]
  ------------------
 1270|      9|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      9|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1271|      9|                                      "Invalid bit number %d in opj_t2_read_packet_header()\n",
 1272|      9|                                      bit_number);
 1273|      9|                        opj_bio_destroy(l_bio);
 1274|      9|                        return OPJ_FALSE;
  ------------------
  |  |  118|      9|#define OPJ_FALSE 0
  ------------------
 1275|      9|                    }
 1276|   121k|                    l_cblk->segs[l_segno].newlen = opj_bio_read(l_bio, bit_number);
 1277|   121k|                    JAS_FPRINTF(stderr, "included=%d numnewpasses=%d increment=%d len=%d \n",
  ------------------
  |  |  390|   121k|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1278|   121k|                                l_included, l_cblk->segs[l_segno].numnewpasses, l_increment,
 1279|   121k|                                l_cblk->segs[l_segno].newlen);
 1280|       |
 1281|   121k|                    n -= (OPJ_INT32)l_cblk->segs[l_segno].numnewpasses;
 1282|   121k|                    if (n > 0) {
  ------------------
  |  Branch (1282:25): [True: 4.33k, False: 117k]
  ------------------
 1283|  4.33k|                        ++l_segno;
 1284|       |
 1285|  4.33k|                        if (! opj_t2_init_seg(l_cblk, l_segno, p_tcp->tccps[p_pi->compno].cblksty, 0)) {
  ------------------
  |  Branch (1285:29): [True: 0, False: 4.33k]
  ------------------
 1286|      0|                            opj_bio_destroy(l_bio);
 1287|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1288|      0|                        }
 1289|  4.33k|                    }
 1290|   121k|                } while (n > 0);
  ------------------
  |  Branch (1290:26): [True: 4.33k, False: 117k]
  ------------------
 1291|   323k|            else
 1292|   697k|                do {
 1293|   697k|                    OPJ_UINT32 bit_number;
 1294|   697k|                    l_cblk->segs[l_segno].numnewpasses = (OPJ_UINT32)opj_int_min((OPJ_INT32)(
 1295|   697k|                            l_cblk->segs[l_segno].maxpasses - l_cblk->segs[l_segno].numpasses), n);
 1296|   697k|                    bit_number = l_cblk->numlenbits + opj_uint_floorlog2(
 1297|   697k|                                     l_cblk->segs[l_segno].numnewpasses);
 1298|   697k|                    if (bit_number > 32) {
  ------------------
  |  Branch (1298:25): [True: 30, False: 697k]
  ------------------
 1299|     30|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     30|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1300|     30|                                      "Invalid bit number %d in opj_t2_read_packet_header()\n",
 1301|     30|                                      bit_number);
 1302|     30|                        opj_bio_destroy(l_bio);
 1303|     30|                        return OPJ_FALSE;
  ------------------
  |  |  118|     30|#define OPJ_FALSE 0
  ------------------
 1304|     30|                    }
 1305|   697k|                    l_cblk->segs[l_segno].newlen = opj_bio_read(l_bio, bit_number);
 1306|   697k|                    JAS_FPRINTF(stderr, "included=%d numnewpasses=%d increment=%d len=%d \n",
  ------------------
  |  |  390|   697k|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1307|   697k|                                l_included, l_cblk->segs[l_segno].numnewpasses, l_increment,
 1308|   697k|                                l_cblk->segs[l_segno].newlen);
 1309|       |
 1310|   697k|                    n -= (OPJ_INT32)l_cblk->segs[l_segno].numnewpasses;
 1311|   697k|                    if (n > 0) {
  ------------------
  |  Branch (1311:25): [True: 373k, False: 323k]
  ------------------
 1312|   373k|                        ++l_segno;
 1313|       |
 1314|   373k|                        if (! opj_t2_init_seg(l_cblk, l_segno, p_tcp->tccps[p_pi->compno].cblksty, 0)) {
  ------------------
  |  Branch (1314:29): [True: 0, False: 373k]
  ------------------
 1315|      0|                            opj_bio_destroy(l_bio);
 1316|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1317|      0|                        }
 1318|   373k|                    }
 1319|   697k|                } while (n > 0);
  ------------------
  |  Branch (1319:26): [True: 373k, False: 323k]
  ------------------
 1320|       |
 1321|   441k|            ++l_cblk;
 1322|   441k|        }
 1323|   519k|    }
 1324|       |
 1325|   272k|    if (!opj_bio_inalign(l_bio)) {
  ------------------
  |  Branch (1325:9): [True: 4, False: 272k]
  ------------------
 1326|      4|        opj_bio_destroy(l_bio);
 1327|      4|        return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
 1328|      4|    }
 1329|       |
 1330|   272k|    l_header_data += opj_bio_numbytes(l_bio);
 1331|   272k|    opj_bio_destroy(l_bio);
 1332|       |
 1333|       |    /* EPH markers */
 1334|   272k|    if (p_tcp->csty & J2K_CP_CSTY_EPH) {
  ------------------
  |  |   56|   272k|#define J2K_CP_CSTY_EPH 0x04
  ------------------
  |  Branch (1334:9): [True: 52.4k, False: 220k]
  ------------------
 1335|  52.4k|        if ((*l_modified_length_ptr - (OPJ_UINT32)(l_header_data -
  ------------------
  |  Branch (1335:13): [True: 308, False: 52.1k]
  ------------------
 1336|  52.4k|                *l_header_data_start)) < 2U) {
 1337|    308|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    308|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1338|    308|                          "Not enough space for expected EPH marker\n");
 1339|  52.1k|        } else if ((*l_header_data) != 0xff || (*(l_header_data + 1) != 0x92)) {
  ------------------
  |  Branch (1339:20): [True: 48.8k, False: 3.30k]
  |  Branch (1339:48): [True: 2.92k, False: 377]
  ------------------
 1340|  51.7k|            opj_event_msg(p_manager, EVT_WARNING, "Expected EPH marker\n");
  ------------------
  |  |   67|  51.7k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1341|  51.7k|        } else {
 1342|    377|            l_header_data += 2;
 1343|    377|        }
 1344|  52.4k|    }
 1345|       |
 1346|   272k|    l_header_length = (OPJ_UINT32)(l_header_data - *l_header_data_start);
 1347|   272k|    JAS_FPRINTF(stderr, "hdrlen=%d \n", l_header_length);
  ------------------
  |  |  390|   272k|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1348|   272k|    JAS_FPRINTF(stderr, "packet body\n");
  ------------------
  |  |  390|   272k|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1349|   272k|    *l_modified_length_ptr -= l_header_length;
 1350|   272k|    *l_header_data_start += l_header_length;
 1351|       |
 1352|       |    /* << INDEX */
 1353|       |    /* End of packet header position. Currently only represents the distance to start of packet
 1354|       |     Will be updated later by incrementing with packet start value */
 1355|   272k|    if (p_pack_info) {
  ------------------
  |  Branch (1355:9): [True: 0, False: 272k]
  ------------------
 1356|      0|        p_pack_info->end_ph_pos = (OPJ_INT32)(l_current_data - p_src_data);
 1357|      0|    }
 1358|       |    /* INDEX >> */
 1359|       |
 1360|   272k|    *p_is_data_present = OPJ_TRUE;
  ------------------
  |  |  117|   272k|#define OPJ_TRUE 1
  ------------------
 1361|   272k|    *p_data_read = (OPJ_UINT32)(l_current_data - p_src_data);
 1362|       |
 1363|   272k|    return OPJ_TRUE;
  ------------------
  |  |  117|   272k|#define OPJ_TRUE 1
  ------------------
 1364|   272k|}
t2.c:opj_t2_getnumpasses:
  200|   441k|{
  201|   441k|    OPJ_UINT32 n;
  202|   441k|    if (!opj_bio_read(bio, 1)) {
  ------------------
  |  Branch (202:9): [True: 158k, False: 282k]
  ------------------
  203|   158k|        return 1;
  204|   158k|    }
  205|   282k|    if (!opj_bio_read(bio, 1)) {
  ------------------
  |  Branch (205:9): [True: 83.4k, False: 199k]
  ------------------
  206|  83.4k|        return 2;
  207|  83.4k|    }
  208|   199k|    if ((n = opj_bio_read(bio, 2)) != 3) {
  ------------------
  |  Branch (208:9): [True: 75.7k, False: 123k]
  ------------------
  209|  75.7k|        return (3 + n);
  210|  75.7k|    }
  211|   123k|    if ((n = opj_bio_read(bio, 5)) != 31) {
  ------------------
  |  Branch (211:9): [True: 122k, False: 1.62k]
  ------------------
  212|   122k|        return (6 + n);
  213|   122k|    }
  214|  1.62k|    return (37 + opj_bio_read(bio, 7));
  215|   123k|}
t2.c:opj_t2_getcommacode:
  176|   441k|{
  177|   441k|    OPJ_UINT32 n = 0;
  178|   561k|    while (opj_bio_read(bio, 1)) {
  ------------------
  |  Branch (178:12): [True: 120k, False: 441k]
  ------------------
  179|   120k|        ++n;
  180|   120k|    }
  181|   441k|    return n;
  182|   441k|}
t2.c:opj_t2_init_seg:
 1645|   630k|{
 1646|   630k|    opj_tcd_seg_t* seg = 00;
 1647|   630k|    OPJ_UINT32 l_nb_segs = index + 1;
 1648|       |
 1649|   630k|    if (l_nb_segs > cblk->m_current_max_segs) {
  ------------------
  |  Branch (1649:9): [True: 41.7k, False: 588k]
  ------------------
 1650|  41.7k|        opj_tcd_seg_t* new_segs;
 1651|  41.7k|        OPJ_UINT32 l_m_current_max_segs = cblk->m_current_max_segs +
 1652|  41.7k|                                          OPJ_J2K_DEFAULT_NB_SEGS;
  ------------------
  |  |  155|  41.7k|#define OPJ_J2K_DEFAULT_NB_SEGS             10
  ------------------
 1653|       |
 1654|  41.7k|        new_segs = (opj_tcd_seg_t*) opj_realloc(cblk->segs,
 1655|  41.7k|                                                l_m_current_max_segs * sizeof(opj_tcd_seg_t));
 1656|  41.7k|        if (! new_segs) {
  ------------------
  |  Branch (1656:13): [True: 0, False: 41.7k]
  ------------------
 1657|       |            /* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to initialize segment %d\n", l_nb_segs); */
 1658|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1659|      0|        }
 1660|  41.7k|        cblk->segs = new_segs;
 1661|  41.7k|        memset(new_segs + cblk->m_current_max_segs,
 1662|  41.7k|               0, OPJ_J2K_DEFAULT_NB_SEGS * sizeof(opj_tcd_seg_t));
  ------------------
  |  |  155|  41.7k|#define OPJ_J2K_DEFAULT_NB_SEGS             10
  ------------------
 1663|  41.7k|        cblk->m_current_max_segs = l_m_current_max_segs;
 1664|  41.7k|    }
 1665|       |
 1666|   630k|    seg = &cblk->segs[index];
 1667|   630k|    opj_tcd_reinit_segment(seg);
 1668|       |
 1669|   630k|    if (cblksty & J2K_CCP_CBLKSTY_TERMALL) {
  ------------------
  |  |   60|   630k|#define J2K_CCP_CBLKSTY_TERMALL 0x04  /**< Termination on each coding pass */
  ------------------
  |  Branch (1669:9): [True: 378k, False: 252k]
  ------------------
 1670|   378k|        seg->maxpasses = 1;
 1671|   378k|    } else if (cblksty & J2K_CCP_CBLKSTY_LAZY) {
  ------------------
  |  |   58|   252k|#define J2K_CCP_CBLKSTY_LAZY 0x01     /**< Selective arithmetic coding bypass */
  ------------------
  |  Branch (1671:16): [True: 102k, False: 149k]
  ------------------
 1672|   102k|        if (first) {
  ------------------
  |  Branch (1672:13): [True: 29.9k, False: 72.6k]
  ------------------
 1673|  29.9k|            seg->maxpasses = 10;
 1674|  72.6k|        } else {
 1675|  72.6k|            seg->maxpasses = (((seg - 1)->maxpasses == 1) ||
  ------------------
  |  Branch (1675:31): [True: 32.8k, False: 39.7k]
  ------------------
 1676|  72.6k|                              ((seg - 1)->maxpasses == 10)) ? 2 : 1;
  ------------------
  |  Branch (1676:31): [True: 5.74k, False: 34.0k]
  ------------------
 1677|  72.6k|        }
 1678|   149k|    } else {
 1679|       |        /* See paragraph "B.10.6 Number of coding passes" of the standard.
 1680|       |         * Probably that 109 must be interpreted a (Mb-1)*3 + 1 with Mb=37,
 1681|       |         * Mb being the maximum number of bit-planes available for the
 1682|       |         * representation of coefficients in the sub-band */
 1683|   149k|        seg->maxpasses = 109;
 1684|   149k|    }
 1685|       |
 1686|   630k|    return OPJ_TRUE;
  ------------------
  |  |  117|   630k|#define OPJ_TRUE 1
  ------------------
 1687|   630k|}
t2.c:opj_t2_read_packet_data:
 1374|   159k|{
 1375|   159k|    OPJ_UINT32 bandno, cblkno;
 1376|   159k|    OPJ_UINT32 l_nb_code_blocks;
 1377|   159k|    OPJ_BYTE *l_current_data = p_src_data;
 1378|   159k|    opj_tcd_band_t *l_band = 00;
 1379|   159k|    opj_tcd_cblk_dec_t* l_cblk = 00;
 1380|   159k|    opj_tcd_resolution_t* l_res =
 1381|   159k|        &p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
 1382|   159k|    OPJ_BOOL partial_buffer = OPJ_FALSE;
  ------------------
  |  |  118|   159k|#define OPJ_FALSE 0
  ------------------
 1383|       |
 1384|   159k|    OPJ_ARG_NOT_USED(p_t2);
  ------------------
  |  |  142|   159k|#define OPJ_ARG_NOT_USED(x) (void)(x)
  ------------------
 1385|   159k|    OPJ_ARG_NOT_USED(pack_info);
  ------------------
  |  |  142|   159k|#define OPJ_ARG_NOT_USED(x) (void)(x)
  ------------------
 1386|       |
 1387|   159k|    l_band = l_res->bands;
 1388|   521k|    for (bandno = 0; bandno < l_res->numbands; ++bandno) {
  ------------------
  |  Branch (1388:22): [True: 362k, False: 159k]
  ------------------
 1389|   362k|        opj_tcd_precinct_t *l_prc = &l_band->precincts[p_pi->precno];
 1390|       |
 1391|   362k|        if ((l_band->x1 - l_band->x0 == 0) || (l_band->y1 - l_band->y0 == 0)) {
  ------------------
  |  Branch (1391:13): [True: 25.2k, False: 336k]
  |  Branch (1391:47): [True: 52.2k, False: 284k]
  ------------------
 1392|  77.5k|            ++l_band;
 1393|  77.5k|            continue;
 1394|  77.5k|        }
 1395|       |
 1396|   284k|        l_nb_code_blocks = l_prc->cw * l_prc->ch;
 1397|   284k|        l_cblk = l_prc->cblks.dec;
 1398|       |
 1399|  5.02M|        for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
  ------------------
  |  Branch (1399:26): [True: 4.74M, False: 284k]
  ------------------
 1400|  4.74M|            opj_tcd_seg_t *l_seg = 00;
 1401|       |
 1402|       |            // if we have a partial data stream, set numchunks to zero
 1403|       |            // since we have no data to actually decode.
 1404|  4.74M|            if (partial_buffer) {
  ------------------
  |  Branch (1404:17): [True: 0, False: 4.74M]
  ------------------
 1405|      0|                l_cblk->numchunks = 0;
 1406|      0|            }
 1407|       |
 1408|  4.74M|            if (!l_cblk->numnewpasses) {
  ------------------
  |  Branch (1408:17): [True: 4.31M, False: 425k]
  ------------------
 1409|       |                /* nothing to do */
 1410|  4.31M|                ++l_cblk;
 1411|  4.31M|                continue;
 1412|  4.31M|            }
 1413|       |
 1414|   425k|            if (!l_cblk->numsegs) {
  ------------------
  |  Branch (1414:17): [True: 171k, False: 253k]
  ------------------
 1415|   171k|                l_seg = l_cblk->segs;
 1416|   171k|                ++l_cblk->numsegs;
 1417|   253k|            } else {
 1418|   253k|                l_seg = &l_cblk->segs[l_cblk->numsegs - 1];
 1419|       |
 1420|   253k|                if (l_seg->numpasses == l_seg->maxpasses) {
  ------------------
  |  Branch (1420:21): [True: 66.8k, False: 186k]
  ------------------
 1421|  66.8k|                    ++l_seg;
 1422|  66.8k|                    ++l_cblk->numsegs;
 1423|  66.8k|                }
 1424|   253k|            }
 1425|       |
 1426|   792k|            do {
 1427|       |                /* Check possible overflow (on l_current_data only, assumes input args already checked) then size */
 1428|   792k|                if ((((OPJ_SIZE_T)l_current_data + (OPJ_SIZE_T)l_seg->newlen) <
  ------------------
  |  Branch (1428:21): [True: 0, False: 792k]
  ------------------
 1429|   792k|                        (OPJ_SIZE_T)l_current_data) ||
 1430|   792k|                        (l_current_data + l_seg->newlen > p_src_data + p_max_length) ||
  ------------------
  |  Branch (1430:25): [True: 269, False: 792k]
  ------------------
 1431|   792k|                        (partial_buffer)) {
  ------------------
  |  Branch (1431:25): [True: 0, False: 792k]
  ------------------
 1432|    269|                    if (p_t2->cp->strict) {
  ------------------
  |  Branch (1432:25): [True: 269, False: 0]
  ------------------
 1433|    269|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    269|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1434|    269|                                      "read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
 1435|    269|                                      l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
 1436|    269|                                      p_pi->compno);
 1437|    269|                        return OPJ_FALSE;
  ------------------
  |  |  118|    269|#define OPJ_FALSE 0
  ------------------
 1438|    269|                    } else {
 1439|      0|                        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1440|      0|                                      "read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
 1441|      0|                                      l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
 1442|      0|                                      p_pi->compno);
 1443|       |                        // skip this codeblock since it is a partial read
 1444|      0|                        partial_buffer = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1445|      0|                        l_cblk->numchunks = 0;
 1446|       |
 1447|      0|                        l_seg->numpasses += l_seg->numnewpasses;
 1448|      0|                        l_cblk->numnewpasses -= l_seg->numnewpasses;
 1449|      0|                        if (l_cblk->numnewpasses > 0) {
  ------------------
  |  Branch (1449:29): [True: 0, False: 0]
  ------------------
 1450|      0|                            ++l_seg;
 1451|      0|                            ++l_cblk->numsegs;
 1452|      0|                            break;
 1453|      0|                        }
 1454|      0|                        continue;
 1455|      0|                    }
 1456|    269|                }
 1457|       |
 1458|       |#ifdef USE_JPWL
 1459|       |                /* we need here a j2k handle to verify if making a check to
 1460|       |                the validity of cblocks parameters is selected from user (-W) */
 1461|       |
 1462|       |                /* let's check that we are not exceeding */
 1463|       |                if ((l_cblk->len + l_seg->newlen) > 8192) {
 1464|       |                    opj_event_msg(p_manager, EVT_WARNING,
 1465|       |                                  "JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
 1466|       |                                  l_seg->newlen, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
 1467|       |                    if (!JPWL_ASSUME) {
 1468|       |                        opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 1469|       |                        return OPJ_FALSE;
 1470|       |                    }
 1471|       |                    l_seg->newlen = 8192 - l_cblk->len;
 1472|       |                    opj_event_msg(p_manager, EVT_WARNING, "      - truncating segment to %d\n",
 1473|       |                                  l_seg->newlen);
 1474|       |                    break;
 1475|       |                };
 1476|       |
 1477|       |#endif /* USE_JPWL */
 1478|       |
 1479|   792k|                if (l_cblk->numchunks == l_cblk->numchunksalloc) {
  ------------------
  |  Branch (1479:21): [True: 233k, False: 558k]
  ------------------
 1480|   233k|                    OPJ_UINT32 l_numchunksalloc = l_cblk->numchunksalloc * 2 + 1;
 1481|   233k|                    opj_tcd_seg_data_chunk_t* l_chunks =
 1482|   233k|                        (opj_tcd_seg_data_chunk_t*)opj_realloc(l_cblk->chunks,
 1483|   233k|                                l_numchunksalloc * sizeof(opj_tcd_seg_data_chunk_t));
 1484|   233k|                    if (l_chunks == NULL) {
  ------------------
  |  Branch (1484:25): [True: 0, False: 233k]
  ------------------
 1485|      0|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1486|      0|                                      "cannot allocate opj_tcd_seg_data_chunk_t* array");
 1487|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1488|      0|                    }
 1489|   233k|                    l_cblk->chunks = l_chunks;
 1490|   233k|                    l_cblk->numchunksalloc = l_numchunksalloc;
 1491|   233k|                }
 1492|       |
 1493|   792k|                l_cblk->chunks[l_cblk->numchunks].data = l_current_data;
 1494|   792k|                l_cblk->chunks[l_cblk->numchunks].len = l_seg->newlen;
 1495|   792k|                l_cblk->numchunks ++;
 1496|       |
 1497|   792k|                l_current_data += l_seg->newlen;
 1498|   792k|                l_seg->len += l_seg->newlen;
 1499|   792k|                l_seg->numpasses += l_seg->numnewpasses;
 1500|   792k|                l_cblk->numnewpasses -= l_seg->numnewpasses;
 1501|       |
 1502|   792k|                l_seg->real_num_passes = l_seg->numpasses;
 1503|       |
 1504|   792k|                if (l_cblk->numnewpasses > 0) {
  ------------------
  |  Branch (1504:21): [True: 367k, False: 424k]
  ------------------
 1505|   367k|                    ++l_seg;
 1506|   367k|                    ++l_cblk->numsegs;
 1507|   367k|                }
 1508|   792k|            } while (l_cblk->numnewpasses > 0);
  ------------------
  |  Branch (1508:22): [True: 367k, False: 424k]
  ------------------
 1509|       |
 1510|   424k|            l_cblk->real_num_segs = l_cblk->numsegs;
 1511|   424k|            ++l_cblk;
 1512|   424k|        } /* next code_block */
 1513|       |
 1514|   284k|        ++l_band;
 1515|   284k|    }
 1516|       |
 1517|       |    // return the number of bytes read
 1518|   159k|    if (partial_buffer) {
  ------------------
  |  Branch (1518:9): [True: 0, False: 159k]
  ------------------
 1519|      0|        *(p_data_read) = p_max_length;
 1520|   159k|    } else {
 1521|   159k|        *(p_data_read) = (OPJ_UINT32)(l_current_data - p_src_data);
 1522|   159k|    }
 1523|       |
 1524|   159k|    return OPJ_TRUE;
  ------------------
  |  |  117|   159k|#define OPJ_TRUE 1
  ------------------
 1525|   159k|}
t2.c:opj_t2_skip_packet:
 1017|   131M|{
 1018|   131M|    OPJ_BOOL l_read_data;
 1019|   131M|    OPJ_UINT32 l_nb_bytes_read = 0;
 1020|   131M|    OPJ_UINT32 l_nb_total_bytes_read = 0;
 1021|       |
 1022|   131M|    *p_data_read = 0;
 1023|       |
 1024|   131M|    if (! opj_t2_read_packet_header(p_t2, p_tile, p_tcp, p_pi, &l_read_data, p_src,
  ------------------
  |  Branch (1024:9): [True: 6, False: 131M]
  ------------------
 1025|   131M|                                    &l_nb_bytes_read, p_max_length, p_pack_info, p_manager)) {
 1026|      6|        return OPJ_FALSE;
  ------------------
  |  |  118|      6|#define OPJ_FALSE 0
  ------------------
 1027|      6|    }
 1028|       |
 1029|   131M|    p_src += l_nb_bytes_read;
 1030|   131M|    l_nb_total_bytes_read += l_nb_bytes_read;
 1031|   131M|    p_max_length -= l_nb_bytes_read;
 1032|       |
 1033|       |    /* we should read data for the packet */
 1034|   131M|    if (l_read_data) {
  ------------------
  |  Branch (1034:9): [True: 113k, False: 131M]
  ------------------
 1035|   113k|        l_nb_bytes_read = 0;
 1036|       |
 1037|   113k|        if (! opj_t2_skip_packet_data(p_t2, p_tile, p_pi, &l_nb_bytes_read,
  ------------------
  |  Branch (1037:13): [True: 93, False: 113k]
  ------------------
 1038|   113k|                                      p_max_length, p_pack_info, p_manager)) {
 1039|     93|            return OPJ_FALSE;
  ------------------
  |  |  118|     93|#define OPJ_FALSE 0
  ------------------
 1040|     93|        }
 1041|       |
 1042|   113k|        l_nb_total_bytes_read += l_nb_bytes_read;
 1043|   113k|    }
 1044|   131M|    *p_data_read = l_nb_total_bytes_read;
 1045|       |
 1046|   131M|    return OPJ_TRUE;
  ------------------
  |  |  117|   131M|#define OPJ_TRUE 1
  ------------------
 1047|   131M|}
t2.c:opj_t2_skip_packet_data:
 1534|   113k|{
 1535|   113k|    OPJ_UINT32 bandno, cblkno;
 1536|   113k|    OPJ_UINT32 l_nb_code_blocks;
 1537|   113k|    opj_tcd_band_t *l_band = 00;
 1538|   113k|    opj_tcd_cblk_dec_t* l_cblk = 00;
 1539|   113k|    opj_tcd_resolution_t* l_res =
 1540|   113k|        &p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
 1541|       |
 1542|   113k|    OPJ_ARG_NOT_USED(p_t2);
  ------------------
  |  |  142|   113k|#define OPJ_ARG_NOT_USED(x) (void)(x)
  ------------------
 1543|   113k|    OPJ_ARG_NOT_USED(pack_info);
  ------------------
  |  |  142|   113k|#define OPJ_ARG_NOT_USED(x) (void)(x)
  ------------------
 1544|       |
 1545|   113k|    *p_data_read = 0;
 1546|   113k|    l_band = l_res->bands;
 1547|       |
 1548|   444k|    for (bandno = 0; bandno < l_res->numbands; ++bandno) {
  ------------------
  |  Branch (1548:22): [True: 330k, False: 113k]
  ------------------
 1549|   330k|        opj_tcd_precinct_t *l_prc = &l_band->precincts[p_pi->precno];
 1550|       |
 1551|   330k|        if ((l_band->x1 - l_band->x0 == 0) || (l_band->y1 - l_band->y0 == 0)) {
  ------------------
  |  Branch (1551:13): [True: 58.7k, False: 272k]
  |  Branch (1551:47): [True: 37.3k, False: 234k]
  ------------------
 1552|  96.0k|            ++l_band;
 1553|  96.0k|            continue;
 1554|  96.0k|        }
 1555|       |
 1556|   234k|        l_nb_code_blocks = l_prc->cw * l_prc->ch;
 1557|   234k|        l_cblk = l_prc->cblks.dec;
 1558|       |
 1559|  2.47M|        for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
  ------------------
  |  Branch (1559:26): [True: 2.24M, False: 234k]
  ------------------
 1560|  2.24M|            opj_tcd_seg_t *l_seg = 00;
 1561|       |
 1562|  2.24M|            if (!l_cblk->numnewpasses) {
  ------------------
  |  Branch (1562:17): [True: 2.23M, False: 12.1k]
  ------------------
 1563|       |                /* nothing to do */
 1564|  2.23M|                ++l_cblk;
 1565|  2.23M|                continue;
 1566|  2.23M|            }
 1567|       |
 1568|  12.1k|            if (!l_cblk->numsegs) {
  ------------------
  |  Branch (1568:17): [True: 9.59k, False: 2.55k]
  ------------------
 1569|  9.59k|                l_seg = l_cblk->segs;
 1570|  9.59k|                ++l_cblk->numsegs;
 1571|  9.59k|            } else {
 1572|  2.55k|                l_seg = &l_cblk->segs[l_cblk->numsegs - 1];
 1573|       |
 1574|  2.55k|                if (l_seg->numpasses == l_seg->maxpasses) {
  ------------------
  |  Branch (1574:21): [True: 353, False: 2.19k]
  ------------------
 1575|    353|                    ++l_seg;
 1576|    353|                    ++l_cblk->numsegs;
 1577|    353|                }
 1578|  2.55k|            }
 1579|       |
 1580|  15.0k|            do {
 1581|       |                /* Check possible overflow then size */
 1582|  15.0k|                if (((*p_data_read + l_seg->newlen) < (*p_data_read)) ||
  ------------------
  |  Branch (1582:21): [True: 1, False: 15.0k]
  ------------------
 1583|  15.0k|                        ((*p_data_read + l_seg->newlen) > p_max_length)) {
  ------------------
  |  Branch (1583:25): [True: 92, False: 14.9k]
  ------------------
 1584|     93|                    if (p_t2->cp->strict) {
  ------------------
  |  Branch (1584:25): [True: 93, False: 0]
  ------------------
 1585|     93|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     93|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1586|     93|                                      "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
 1587|     93|                                      l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
 1588|     93|                                      p_pi->compno);
 1589|     93|                        return OPJ_FALSE;
  ------------------
  |  |  118|     93|#define OPJ_FALSE 0
  ------------------
 1590|     93|                    } else {
 1591|      0|                        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1592|      0|                                      "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
 1593|      0|                                      l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
 1594|      0|                                      p_pi->compno);
 1595|      0|                        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1596|      0|                    }
 1597|     93|                }
 1598|       |
 1599|       |#ifdef USE_JPWL
 1600|       |                /* we need here a j2k handle to verify if making a check to
 1601|       |                the validity of cblocks parameters is selected from user (-W) */
 1602|       |
 1603|       |                /* let's check that we are not exceeding */
 1604|       |                if ((l_cblk->len + l_seg->newlen) > 8192) {
 1605|       |                    opj_event_msg(p_manager, EVT_WARNING,
 1606|       |                                  "JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
 1607|       |                                  l_seg->newlen, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
 1608|       |                    if (!JPWL_ASSUME) {
 1609|       |                        opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 1610|       |                        return -999;
 1611|       |                    }
 1612|       |                    l_seg->newlen = 8192 - l_cblk->len;
 1613|       |                    opj_event_msg(p_manager, EVT_WARNING, "      - truncating segment to %d\n",
 1614|       |                                  l_seg->newlen);
 1615|       |                    break;
 1616|       |                };
 1617|       |
 1618|       |#endif /* USE_JPWL */
 1619|  14.9k|                JAS_FPRINTF(stderr, "p_data_read (%d) newlen (%d) \n", *p_data_read,
  ------------------
  |  |  390|  14.9k|#define JAS_FPRINTF opj_null_jas_fprintf
  ------------------
 1620|  14.9k|                            l_seg->newlen);
 1621|  14.9k|                *(p_data_read) += l_seg->newlen;
 1622|       |
 1623|  14.9k|                l_seg->numpasses += l_seg->numnewpasses;
 1624|  14.9k|                l_cblk->numnewpasses -= l_seg->numnewpasses;
 1625|  14.9k|                if (l_cblk->numnewpasses > 0) {
  ------------------
  |  Branch (1625:21): [True: 2.93k, False: 12.0k]
  ------------------
 1626|  2.93k|                    ++l_seg;
 1627|  2.93k|                    ++l_cblk->numsegs;
 1628|  2.93k|                }
 1629|  14.9k|            } while (l_cblk->numnewpasses > 0);
  ------------------
  |  Branch (1629:22): [True: 2.93k, False: 12.0k]
  ------------------
 1630|       |
 1631|  12.0k|            ++l_cblk;
 1632|  12.0k|        }
 1633|       |
 1634|   234k|        ++l_band;
 1635|   234k|    }
 1636|       |
 1637|   113k|    return OPJ_TRUE;
  ------------------
  |  |  117|   113k|#define OPJ_TRUE 1
  ------------------
 1638|   113k|}

opj_tcd_create:
  209|  6.88k|{
  210|  6.88k|    opj_tcd_t *l_tcd = 00;
  211|       |
  212|       |    /* create the tcd structure */
  213|  6.88k|    l_tcd = (opj_tcd_t*) opj_calloc(1, sizeof(opj_tcd_t));
  214|  6.88k|    if (!l_tcd) {
  ------------------
  |  Branch (214:9): [True: 0, False: 6.88k]
  ------------------
  215|      0|        return 00;
  216|      0|    }
  217|       |
  218|  6.88k|    l_tcd->m_is_decoder = p_is_decoder ? 1 : 0;
  ------------------
  |  Branch (218:27): [True: 6.88k, False: 0]
  ------------------
  219|       |
  220|  6.88k|    l_tcd->tcd_image = (opj_tcd_image_t*)opj_calloc(1, sizeof(opj_tcd_image_t));
  221|  6.88k|    if (!l_tcd->tcd_image) {
  ------------------
  |  Branch (221:9): [True: 0, False: 6.88k]
  ------------------
  222|      0|        opj_free(l_tcd);
  223|      0|        return 00;
  224|      0|    }
  225|       |
  226|  6.88k|    return l_tcd;
  227|  6.88k|}
opj_tcd_init:
  718|  6.88k|{
  719|  6.88k|    p_tcd->image = p_image;
  720|  6.88k|    p_tcd->cp = p_cp;
  721|       |
  722|  6.88k|    p_tcd->tcd_image->tiles = (opj_tcd_tile_t *) opj_calloc(1,
  723|  6.88k|                              sizeof(opj_tcd_tile_t));
  724|  6.88k|    if (! p_tcd->tcd_image->tiles) {
  ------------------
  |  Branch (724:9): [True: 0, False: 6.88k]
  ------------------
  725|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  726|      0|    }
  727|       |
  728|  6.88k|    p_tcd->tcd_image->tiles->comps = (opj_tcd_tilecomp_t *) opj_calloc(
  729|  6.88k|                                         p_image->numcomps, sizeof(opj_tcd_tilecomp_t));
  730|  6.88k|    if (! p_tcd->tcd_image->tiles->comps) {
  ------------------
  |  Branch (730:9): [True: 0, False: 6.88k]
  ------------------
  731|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  732|      0|    }
  733|       |
  734|  6.88k|    p_tcd->tcd_image->tiles->numcomps = p_image->numcomps;
  735|  6.88k|    p_tcd->tp_pos = p_cp->m_specific_param.m_enc.m_tp_pos;
  736|  6.88k|    p_tcd->thread_pool = p_tp;
  737|       |
  738|  6.88k|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.88k|#define OPJ_TRUE 1
  ------------------
  739|  6.88k|}
opj_tcd_destroy:
  745|  9.22k|{
  746|  9.22k|    if (tcd) {
  ------------------
  |  Branch (746:9): [True: 6.88k, False: 2.34k]
  ------------------
  747|  6.88k|        opj_tcd_free_tile(tcd);
  748|       |
  749|  6.88k|        if (tcd->tcd_image) {
  ------------------
  |  Branch (749:13): [True: 6.88k, False: 0]
  ------------------
  750|  6.88k|            opj_free(tcd->tcd_image);
  751|  6.88k|            tcd->tcd_image = 00;
  752|  6.88k|        }
  753|       |
  754|  6.88k|        opj_free(tcd->used_component);
  755|       |
  756|  6.88k|        opj_free(tcd);
  757|  6.88k|    }
  758|  9.22k|}
opj_alloc_tile_component_data:
  761|  5.93k|{
  762|  5.93k|    if ((l_tilec->data == 00) ||
  ------------------
  |  Branch (762:9): [True: 5.73k, False: 201]
  ------------------
  763|  5.93k|            ((l_tilec->data_size_needed > l_tilec->data_size) &&
  ------------------
  |  Branch (763:14): [True: 32, False: 169]
  ------------------
  764|  5.73k|             (l_tilec->ownsData == OPJ_FALSE))) {
  ------------------
  |  |  118|     32|#define OPJ_FALSE 0
  ------------------
  |  Branch (764:14): [True: 0, False: 32]
  ------------------
  765|  5.73k|        l_tilec->data = (OPJ_INT32 *) opj_image_data_alloc(l_tilec->data_size_needed);
  766|  5.73k|        if (!l_tilec->data && l_tilec->data_size_needed != 0) {
  ------------------
  |  Branch (766:13): [True: 583, False: 5.14k]
  |  Branch (766:31): [True: 0, False: 583]
  ------------------
  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|  5.73k|        l_tilec->data_size = l_tilec->data_size_needed;
  771|  5.73k|        l_tilec->ownsData = OPJ_TRUE;
  ------------------
  |  |  117|  5.73k|#define OPJ_TRUE 1
  ------------------
  772|  5.73k|    } else if (l_tilec->data_size_needed > l_tilec->data_size) {
  ------------------
  |  Branch (772:16): [True: 32, False: 169]
  ------------------
  773|       |        /* We don't need to keep old data */
  774|     32|        opj_image_data_free(l_tilec->data);
  775|     32|        l_tilec->data = (OPJ_INT32 *) opj_image_data_alloc(l_tilec->data_size_needed);
  776|     32|        if (! l_tilec->data) {
  ------------------
  |  Branch (776:13): [True: 0, False: 32]
  ------------------
  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|     32|        l_tilec->data_size = l_tilec->data_size_needed;
  784|     32|        l_tilec->ownsData = OPJ_TRUE;
  ------------------
  |  |  117|     32|#define OPJ_TRUE 1
  ------------------
  785|     32|    }
  786|  5.93k|    return OPJ_TRUE;
  ------------------
  |  |  117|  5.93k|#define OPJ_TRUE 1
  ------------------
  787|  5.93k|}
opj_tcd_init_decode_tile:
 1275|  6.97k|{
 1276|  6.97k|    return opj_tcd_init_tile(p_tcd, p_tile_no, OPJ_FALSE,
  ------------------
  |  |  118|  6.97k|#define OPJ_FALSE 0
  ------------------
 1277|  6.97k|                             sizeof(opj_tcd_cblk_dec_t), p_manager);
 1278|  6.97k|}
opj_tcd_reinit_segment:
 1349|  4.15M|{
 1350|  4.15M|    memset(seg, 0, sizeof(opj_tcd_seg_t));
 1351|  4.15M|}
opj_tcd_decode_tile:
 1558|  6.93k|{
 1559|  6.93k|    OPJ_UINT32 l_data_read;
 1560|  6.93k|    OPJ_UINT32 compno;
 1561|       |
 1562|  6.93k|    p_tcd->tcd_tileno = p_tile_no;
 1563|  6.93k|    p_tcd->tcp = &(p_tcd->cp->tcps[p_tile_no]);
 1564|  6.93k|    p_tcd->win_x0 = win_x0;
 1565|  6.93k|    p_tcd->win_y0 = win_y0;
 1566|  6.93k|    p_tcd->win_x1 = win_x1;
 1567|  6.93k|    p_tcd->win_y1 = win_y1;
 1568|  6.93k|    p_tcd->whole_tile_decoding = OPJ_TRUE;
  ------------------
  |  |  117|  6.93k|#define OPJ_TRUE 1
  ------------------
 1569|       |
 1570|  6.93k|    opj_free(p_tcd->used_component);
 1571|  6.93k|    p_tcd->used_component = NULL;
 1572|       |
 1573|  6.93k|    if (numcomps_to_decode) {
  ------------------
  |  Branch (1573:9): [True: 0, False: 6.93k]
  ------------------
 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|  12.8k|    for (compno = 0; compno < p_tcd->image->numcomps; compno++) {
  ------------------
  |  Branch (1586:22): [True: 11.9k, False: 965]
  ------------------
 1587|  11.9k|        if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (1587:13): [True: 0, False: 11.9k]
  |  Branch (1587:46): [True: 0, False: 0]
  ------------------
 1588|      0|            continue;
 1589|      0|        }
 1590|       |
 1591|  11.9k|        if (!opj_tcd_is_whole_tilecomp_decoding(p_tcd, compno)) {
  ------------------
  |  Branch (1591:13): [True: 5.97k, False: 5.95k]
  ------------------
 1592|  5.97k|            p_tcd->whole_tile_decoding = OPJ_FALSE;
  ------------------
  |  |  118|  5.97k|#define OPJ_FALSE 0
  ------------------
 1593|  5.97k|            break;
 1594|  5.97k|        }
 1595|  11.9k|    }
 1596|       |
 1597|  6.93k|    if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (1597:9): [True: 965, False: 5.97k]
  ------------------
 1598|  6.89k|        for (compno = 0; compno < p_tcd->image->numcomps; compno++) {
  ------------------
  |  Branch (1598:26): [True: 5.93k, False: 965]
  ------------------
 1599|  5.93k|            opj_tcd_tilecomp_t* tilec = &(p_tcd->tcd_image->tiles->comps[compno]);
 1600|  5.93k|            opj_tcd_resolution_t *l_res = &
 1601|  5.93k|                                          (tilec->resolutions[tilec->minimum_num_resolutions - 1]);
 1602|  5.93k|            OPJ_SIZE_T l_data_size;
 1603|       |
 1604|       |            /* compute l_data_size with overflow check */
 1605|  5.93k|            OPJ_SIZE_T res_w = (OPJ_SIZE_T)(l_res->x1 - l_res->x0);
 1606|  5.93k|            OPJ_SIZE_T res_h = (OPJ_SIZE_T)(l_res->y1 - l_res->y0);
 1607|       |
 1608|  5.93k|            if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (1608:17): [True: 0, False: 5.93k]
  |  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|  5.93k|            if (res_h > 0 && res_w > SIZE_MAX / res_h) {
  ------------------
  |  Branch (1613:17): [True: 5.89k, False: 36]
  |  Branch (1613:30): [True: 0, False: 5.89k]
  ------------------
 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|  5.93k|            l_data_size = res_w * res_h;
 1619|       |
 1620|  5.93k|            if (SIZE_MAX / sizeof(OPJ_UINT32) < l_data_size) {
  ------------------
  |  Branch (1620:17): [True: 0, False: 5.93k]
  ------------------
 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|  5.93k|            l_data_size *= sizeof(OPJ_UINT32);
 1626|       |
 1627|  5.93k|            tilec->data_size_needed = l_data_size;
 1628|       |
 1629|  5.93k|            if (!opj_alloc_tile_component_data(tilec)) {
  ------------------
  |  Branch (1629:17): [True: 0, False: 5.93k]
  ------------------
 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|  5.93k|        }
 1635|  5.97k|    } 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|  25.5k|        for (compno = 0; compno < p_tcd->image->numcomps; compno++) {
  ------------------
  |  Branch (1639:26): [True: 19.6k, False: 5.91k]
  ------------------
 1640|  19.6k|            OPJ_UINT32 resno;
 1641|  19.6k|            opj_tcd_tilecomp_t* tilec = &(p_tcd->tcd_image->tiles->comps[compno]);
 1642|  19.6k|            opj_image_comp_t* image_comp = &(p_tcd->image->comps[compno]);
 1643|       |
 1644|  19.6k|            if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (1644:17): [True: 0, False: 19.6k]
  |  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|  19.6k|            tilec->win_x0 = opj_uint_max(
 1651|  19.6k|                                (OPJ_UINT32)tilec->x0,
 1652|  19.6k|                                opj_uint_ceildiv(p_tcd->win_x0, image_comp->dx));
 1653|  19.6k|            tilec->win_y0 = opj_uint_max(
 1654|  19.6k|                                (OPJ_UINT32)tilec->y0,
 1655|  19.6k|                                opj_uint_ceildiv(p_tcd->win_y0, image_comp->dy));
 1656|  19.6k|            tilec->win_x1 = opj_uint_min(
 1657|  19.6k|                                (OPJ_UINT32)tilec->x1,
 1658|  19.6k|                                opj_uint_ceildiv(p_tcd->win_x1, image_comp->dx));
 1659|  19.6k|            tilec->win_y1 = opj_uint_min(
 1660|  19.6k|                                (OPJ_UINT32)tilec->y1,
 1661|  19.6k|                                opj_uint_ceildiv(p_tcd->win_y1, image_comp->dy));
 1662|  19.6k|            if (tilec->win_x1 < tilec->win_x0 ||
  ------------------
  |  Branch (1662:17): [True: 52, False: 19.5k]
  ------------------
 1663|  19.6k|                    tilec->win_y1 < tilec->win_y0) {
  ------------------
  |  Branch (1663:21): [True: 5, False: 19.5k]
  ------------------
 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|     57|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     57|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1668|     57|                              "Invalid tilec->win_xxx values\n");
 1669|     57|                return OPJ_FALSE;
  ------------------
  |  |  118|     57|#define OPJ_FALSE 0
  ------------------
 1670|     57|            }
 1671|       |
 1672|   110k|            for (resno = 0; resno < tilec->numresolutions; ++resno) {
  ------------------
  |  Branch (1672:29): [True: 91.0k, False: 19.5k]
  ------------------
 1673|  91.0k|                opj_tcd_resolution_t *res = tilec->resolutions + resno;
 1674|  91.0k|                res->win_x0 = opj_uint_ceildivpow2(tilec->win_x0,
 1675|  91.0k|                                                   tilec->numresolutions - 1 - resno);
 1676|  91.0k|                res->win_y0 = opj_uint_ceildivpow2(tilec->win_y0,
 1677|  91.0k|                                                   tilec->numresolutions - 1 - resno);
 1678|  91.0k|                res->win_x1 = opj_uint_ceildivpow2(tilec->win_x1,
 1679|  91.0k|                                                   tilec->numresolutions - 1 - resno);
 1680|  91.0k|                res->win_y1 = opj_uint_ceildivpow2(tilec->win_y1,
 1681|  91.0k|                                                   tilec->numresolutions - 1 - resno);
 1682|  91.0k|            }
 1683|  19.5k|        }
 1684|  5.97k|    }
 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|  6.88k|    l_data_read = 0;
 1713|  6.88k|    if (! opj_tcd_t2_decode(p_tcd, p_src, &l_data_read, p_max_length, p_cstr_index,
  ------------------
  |  Branch (1713:9): [True: 427, False: 6.45k]
  ------------------
 1714|  6.88k|                            p_manager)) {
 1715|    427|        return OPJ_FALSE;
  ------------------
  |  |  118|    427|#define OPJ_FALSE 0
  ------------------
 1716|    427|    }
 1717|       |    /* FIXME _ProfStop(PGROUP_T2); */
 1718|       |
 1719|       |    /*------------------TIER1-----------------*/
 1720|       |
 1721|       |    /* FIXME _ProfStart(PGROUP_T1); */
 1722|  6.45k|    if (! opj_tcd_t1_decode(p_tcd, p_manager)) {
  ------------------
  |  Branch (1722:9): [True: 500, False: 5.95k]
  ------------------
 1723|    500|        return OPJ_FALSE;
  ------------------
  |  |  118|    500|#define OPJ_FALSE 0
  ------------------
 1724|    500|    }
 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|  5.95k|    if (!p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (1730:9): [True: 5.05k, False: 902]
  ------------------
 1731|  21.8k|        for (compno = 0; compno < p_tcd->image->numcomps; compno++) {
  ------------------
  |  Branch (1731:26): [True: 16.8k, False: 5.05k]
  ------------------
 1732|  16.8k|            opj_tcd_tilecomp_t* tilec = &(p_tcd->tcd_image->tiles->comps[compno]);
 1733|  16.8k|            opj_image_comp_t* image_comp = &(p_tcd->image->comps[compno]);
 1734|  16.8k|            opj_tcd_resolution_t *res = tilec->resolutions + image_comp->resno_decoded;
 1735|  16.8k|            OPJ_SIZE_T w = res->win_x1 - res->win_x0;
 1736|  16.8k|            OPJ_SIZE_T h = res->win_y1 - res->win_y0;
 1737|  16.8k|            OPJ_SIZE_T l_data_size;
 1738|       |
 1739|  16.8k|            opj_image_data_free(tilec->data_win);
 1740|  16.8k|            tilec->data_win = NULL;
 1741|       |
 1742|  16.8k|            if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (1742:17): [True: 0, False: 16.8k]
  |  Branch (1742:50): [True: 0, False: 0]
  ------------------
 1743|      0|                continue;
 1744|      0|            }
 1745|       |
 1746|  16.8k|            if (w > 0 && h > 0) {
  ------------------
  |  Branch (1746:17): [True: 16.2k, False: 533]
  |  Branch (1746:26): [True: 15.9k, False: 312]
  ------------------
 1747|  15.9k|                if (w > SIZE_MAX / h) {
  ------------------
  |  Branch (1747:21): [True: 0, False: 15.9k]
  ------------------
 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|  15.9k|                l_data_size = w * h;
 1753|  15.9k|                if (l_data_size > SIZE_MAX / sizeof(OPJ_INT32)) {
  ------------------
  |  Branch (1753:21): [True: 0, False: 15.9k]
  ------------------
 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|  15.9k|                l_data_size *= sizeof(OPJ_INT32);
 1759|       |
 1760|  15.9k|                tilec->data_win = (OPJ_INT32*) opj_image_data_alloc(l_data_size);
 1761|  15.9k|                if (tilec->data_win == NULL) {
  ------------------
  |  Branch (1761:21): [True: 0, False: 15.9k]
  ------------------
 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|  15.9k|            }
 1767|  16.8k|        }
 1768|  5.05k|    }
 1769|       |
 1770|       |    /*----------------DWT---------------------*/
 1771|       |
 1772|       |    /* FIXME _ProfStart(PGROUP_DWT); */
 1773|  5.95k|    if
 1774|  5.95k|    (! opj_tcd_dwt_decode(p_tcd)) {
  ------------------
  |  Branch (1774:6): [True: 0, False: 5.95k]
  ------------------
 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|  5.95k|    if
 1782|  5.95k|    (! opj_tcd_mct_decode(p_tcd, p_manager)) {
  ------------------
  |  Branch (1782:6): [True: 682, False: 5.27k]
  ------------------
 1783|    682|        return OPJ_FALSE;
  ------------------
  |  |  118|    682|#define OPJ_FALSE 0
  ------------------
 1784|    682|    }
 1785|       |    /* FIXME _ProfStop(PGROUP_MCT); */
 1786|       |
 1787|       |    /* FIXME _ProfStart(PGROUP_DC_SHIFT); */
 1788|  5.27k|    if
 1789|  5.27k|    (! opj_tcd_dc_level_shift_decode(p_tcd)) {
  ------------------
  |  Branch (1789:6): [True: 0, False: 5.27k]
  ------------------
 1790|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1791|      0|    }
 1792|       |    /* FIXME _ProfStop(PGROUP_DC_SHIFT); */
 1793|       |
 1794|       |
 1795|       |    /*---------------TILE-------------------*/
 1796|  5.27k|    return OPJ_TRUE;
  ------------------
  |  |  117|  5.27k|#define OPJ_TRUE 1
  ------------------
 1797|  5.27k|}
opj_tcd_is_band_empty:
 2776|  1.24M|{
 2777|  1.24M|    return (band->x1 - band->x0 == 0) || (band->y1 - band->y0 == 0);
  ------------------
  |  Branch (2777:12): [True: 114k, False: 1.13M]
  |  Branch (2777:42): [True: 135k, False: 996k]
  ------------------
 2778|  1.24M|}
opj_tcd_is_subband_area_of_interest:
 2788|   508M|{
 2789|       |    /* Note: those values for filter_margin are in part the result of */
 2790|       |    /* experimentation. The value 2 for QMFBID=1 (5x3 filter) can be linked */
 2791|       |    /* to the maximum left/right extension given in tables F.2 and F.3 of the */
 2792|       |    /* standard. The value 3 for QMFBID=0 (9x7 filter) is more suspicious, */
 2793|       |    /* since F.2 and F.3 would lead to 4 instead, so the current 3 might be */
 2794|       |    /* needed to be bumped to 4, in case inconsistencies are found while */
 2795|       |    /* decoding parts of irreversible coded images. */
 2796|       |    /* See opj_dwt_decode_partial_53 and opj_dwt_decode_partial_97 as well */
 2797|   508M|    OPJ_UINT32 filter_margin = (tcd->tcp->tccps[compno].qmfbid == 1) ? 2 : 3;
  ------------------
  |  Branch (2797:32): [True: 68.6M, False: 440M]
  ------------------
 2798|   508M|    opj_tcd_tilecomp_t *tilec = &(tcd->tcd_image->tiles->comps[compno]);
 2799|   508M|    opj_image_comp_t* image_comp = &(tcd->image->comps[compno]);
 2800|       |    /* Compute the intersection of the area of interest, expressed in tile coordinates */
 2801|       |    /* with the tile coordinates */
 2802|   508M|    OPJ_UINT32 tcx0 = opj_uint_max(
 2803|   508M|                          (OPJ_UINT32)tilec->x0,
 2804|   508M|                          opj_uint_ceildiv(tcd->win_x0, image_comp->dx));
 2805|   508M|    OPJ_UINT32 tcy0 = opj_uint_max(
 2806|   508M|                          (OPJ_UINT32)tilec->y0,
 2807|   508M|                          opj_uint_ceildiv(tcd->win_y0, image_comp->dy));
 2808|   508M|    OPJ_UINT32 tcx1 = opj_uint_min(
 2809|   508M|                          (OPJ_UINT32)tilec->x1,
 2810|   508M|                          opj_uint_ceildiv(tcd->win_x1, image_comp->dx));
 2811|   508M|    OPJ_UINT32 tcy1 = opj_uint_min(
 2812|   508M|                          (OPJ_UINT32)tilec->y1,
 2813|   508M|                          opj_uint_ceildiv(tcd->win_y1, image_comp->dy));
 2814|       |    /* Compute number of decomposition for this band. See table F-1 */
 2815|   508M|    OPJ_UINT32 nb = (resno == 0) ?
  ------------------
  |  Branch (2815:21): [True: 55.7M, False: 453M]
  ------------------
 2816|  55.7M|                    tilec->numresolutions - 1 :
 2817|   508M|                    tilec->numresolutions - resno;
 2818|       |    /* Map above tile-based coordinates to sub-band-based coordinates per */
 2819|       |    /* equation B-15 of the standard */
 2820|   508M|    OPJ_UINT32 x0b = bandno & 1;
 2821|   508M|    OPJ_UINT32 y0b = bandno >> 1;
 2822|   508M|    OPJ_UINT32 tbx0 = (nb == 0) ? tcx0 :
  ------------------
  |  Branch (2822:23): [True: 32.5M, False: 476M]
  ------------------
 2823|   508M|                      (tcx0 <= (1U << (nb - 1)) * x0b) ? 0 :
  ------------------
  |  Branch (2823:23): [True: 151M, False: 324M]
  ------------------
 2824|   476M|                      opj_uint_ceildivpow2(tcx0 - (1U << (nb - 1)) * x0b, nb);
 2825|   508M|    OPJ_UINT32 tby0 = (nb == 0) ? tcy0 :
  ------------------
  |  Branch (2825:23): [True: 32.5M, False: 476M]
  ------------------
 2826|   508M|                      (tcy0 <= (1U << (nb - 1)) * y0b) ? 0 :
  ------------------
  |  Branch (2826:23): [True: 148M, False: 327M]
  ------------------
 2827|   476M|                      opj_uint_ceildivpow2(tcy0 - (1U << (nb - 1)) * y0b, nb);
 2828|   508M|    OPJ_UINT32 tbx1 = (nb == 0) ? tcx1 :
  ------------------
  |  Branch (2828:23): [True: 32.5M, False: 476M]
  ------------------
 2829|   508M|                      (tcx1 <= (1U << (nb - 1)) * x0b) ? 0 :
  ------------------
  |  Branch (2829:23): [True: 42.3M, False: 433M]
  ------------------
 2830|   476M|                      opj_uint_ceildivpow2(tcx1 - (1U << (nb - 1)) * x0b, nb);
 2831|   508M|    OPJ_UINT32 tby1 = (nb == 0) ? tcy1 :
  ------------------
  |  Branch (2831:23): [True: 32.5M, False: 476M]
  ------------------
 2832|   508M|                      (tcy1 <= (1U << (nb - 1)) * y0b) ? 0 :
  ------------------
  |  Branch (2832:23): [True: 34.6M, False: 441M]
  ------------------
 2833|   476M|                      opj_uint_ceildivpow2(tcy1 - (1U << (nb - 1)) * y0b, nb);
 2834|   508M|    OPJ_BOOL intersects;
 2835|       |
 2836|   508M|    if (tbx0 < filter_margin) {
  ------------------
  |  Branch (2836:9): [True: 177M, False: 330M]
  ------------------
 2837|   177M|        tbx0 = 0;
 2838|   330M|    } else {
 2839|   330M|        tbx0 -= filter_margin;
 2840|   330M|    }
 2841|   508M|    if (tby0 < filter_margin) {
  ------------------
  |  Branch (2841:9): [True: 174M, False: 334M]
  ------------------
 2842|   174M|        tby0 = 0;
 2843|   334M|    } else {
 2844|   334M|        tby0 -= filter_margin;
 2845|   334M|    }
 2846|   508M|    tbx1 = opj_uint_adds(tbx1, filter_margin);
 2847|   508M|    tby1 = opj_uint_adds(tby1, filter_margin);
 2848|       |
 2849|   508M|    intersects = band_x0 < tbx1 && band_y0 < tby1 && band_x1 > tbx0 &&
  ------------------
  |  Branch (2849:18): [True: 195M, False: 313M]
  |  Branch (2849:36): [True: 177M, False: 18.4M]
  |  Branch (2849:54): [True: 138M, False: 38.4M]
  ------------------
 2850|   508M|                 band_y1 > tby0;
  ------------------
  |  Branch (2850:18): [True: 121M, False: 17.1M]
  ------------------
 2851|       |
 2852|       |#ifdef DEBUG_VERBOSE
 2853|       |    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",
 2854|       |           compno, resno, nb, bandno, x0b, y0b,
 2855|       |           band_x0, band_y0, band_x1, band_y1,
 2856|       |           tbx0, tby0, tbx1, tby1, intersects);
 2857|       |#endif
 2858|   508M|    return intersects;
 2859|   508M|}
tcd.c:opj_tcd_init_tile:
  794|  6.97k|{
  795|  6.97k|    OPJ_UINT32 compno, resno, bandno, precno, cblkno;
  796|  6.97k|    opj_tcp_t * l_tcp = 00;
  797|  6.97k|    opj_cp_t * l_cp = 00;
  798|  6.97k|    opj_tcd_tile_t * l_tile = 00;
  799|  6.97k|    opj_tccp_t *l_tccp = 00;
  800|  6.97k|    opj_tcd_tilecomp_t *l_tilec = 00;
  801|  6.97k|    opj_image_comp_t * l_image_comp = 00;
  802|  6.97k|    opj_tcd_resolution_t *l_res = 00;
  803|  6.97k|    opj_tcd_band_t *l_band = 00;
  804|  6.97k|    opj_stepsize_t * l_step_size = 00;
  805|  6.97k|    opj_tcd_precinct_t *l_current_precinct = 00;
  806|  6.97k|    opj_image_t *l_image = 00;
  807|  6.97k|    OPJ_UINT32 p, q;
  808|  6.97k|    OPJ_UINT32 l_level_no;
  809|  6.97k|    OPJ_UINT32 l_pdx, l_pdy;
  810|  6.97k|    OPJ_INT32 l_x0b, l_y0b;
  811|  6.97k|    OPJ_UINT32 l_tx0, l_ty0;
  812|       |    /* extent of precincts , top left, bottom right**/
  813|  6.97k|    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|  6.97k|    OPJ_UINT32 l_nb_precincts;
  816|       |    /* room needed to store l_nb_precinct precinct for a resolution */
  817|  6.97k|    OPJ_UINT32 l_nb_precinct_size;
  818|       |    /* number of code blocks for a precinct*/
  819|  6.97k|    OPJ_UINT32 l_nb_code_blocks;
  820|       |    /* room needed to store l_nb_code_blocks code blocks for a precinct*/
  821|  6.97k|    OPJ_UINT32 l_nb_code_blocks_size;
  822|       |    /* size of data for a tile */
  823|  6.97k|    OPJ_UINT32 l_data_size;
  824|       |
  825|  6.97k|    l_cp = p_tcd->cp;
  826|  6.97k|    l_tcp = &(l_cp->tcps[p_tile_no]);
  827|  6.97k|    l_tile = p_tcd->tcd_image->tiles;
  828|  6.97k|    l_tccp = l_tcp->tccps;
  829|  6.97k|    l_tilec = l_tile->comps;
  830|  6.97k|    l_image = p_tcd->image;
  831|  6.97k|    l_image_comp = p_tcd->image->comps;
  832|       |
  833|  6.97k|    p = p_tile_no % l_cp->tw;       /* tile coordinates */
  834|  6.97k|    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|  6.97k|    l_tx0 = l_cp->tx0 + p *
  839|  6.97k|            l_cp->tdx; /* can't be greater than l_image->x1 so won't overflow */
  840|  6.97k|    l_tile->x0 = (OPJ_INT32)opj_uint_max(l_tx0, l_image->x0);
  841|  6.97k|    l_tile->x1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_tx0, l_cp->tdx),
  842|  6.97k|                                         l_image->x1);
  843|       |    /* all those OPJ_UINT32 are casted to OPJ_INT32, let's do some sanity check */
  844|  6.97k|    if ((l_tile->x0 < 0) || (l_tile->x1 <= l_tile->x0)) {
  ------------------
  |  Branch (844:9): [True: 5, False: 6.96k]
  |  Branch (844:29): [True: 6, False: 6.96k]
  ------------------
  845|     11|        opj_event_msg(manager, EVT_ERROR, "Tile X coordinates are not supported\n");
  ------------------
  |  |   66|     11|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  846|     11|        return OPJ_FALSE;
  ------------------
  |  |  118|     11|#define OPJ_FALSE 0
  ------------------
  847|     11|    }
  848|  6.96k|    l_ty0 = l_cp->ty0 + q *
  849|  6.96k|            l_cp->tdy; /* can't be greater than l_image->y1 so won't overflow */
  850|  6.96k|    l_tile->y0 = (OPJ_INT32)opj_uint_max(l_ty0, l_image->y0);
  851|  6.96k|    l_tile->y1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_ty0, l_cp->tdy),
  852|  6.96k|                                         l_image->y1);
  853|       |    /* all those OPJ_UINT32 are casted to OPJ_INT32, let's do some sanity check */
  854|  6.96k|    if ((l_tile->y0 < 0) || (l_tile->y1 <= l_tile->y0)) {
  ------------------
  |  Branch (854:9): [True: 0, False: 6.96k]
  |  Branch (854:29): [True: 1, False: 6.96k]
  ------------------
  855|      1|        opj_event_msg(manager, EVT_ERROR, "Tile Y coordinates are not supported\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  856|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
  857|      1|    }
  858|       |
  859|       |
  860|       |    /* testcase 1888.pdf.asan.35.988 */
  861|  6.96k|    if (l_tccp->numresolutions == 0) {
  ------------------
  |  Branch (861:9): [True: 0, False: 6.96k]
  ------------------
  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|  32.7k|    for (compno = 0; compno < l_tile->numcomps; ++compno) {
  ------------------
  |  Branch (868:22): [True: 25.7k, False: 6.95k]
  ------------------
  869|       |        /*fprintf(stderr, "compno = %d/%d\n", compno, l_tile->numcomps);*/
  870|  25.7k|        l_image_comp->resno_decoded = 0;
  871|       |        /* border of each l_tile component (global) */
  872|  25.7k|        l_tilec->x0 = opj_int_ceildiv(l_tile->x0, (OPJ_INT32)l_image_comp->dx);
  873|  25.7k|        l_tilec->y0 = opj_int_ceildiv(l_tile->y0, (OPJ_INT32)l_image_comp->dy);
  874|  25.7k|        l_tilec->x1 = opj_int_ceildiv(l_tile->x1, (OPJ_INT32)l_image_comp->dx);
  875|  25.7k|        l_tilec->y1 = opj_int_ceildiv(l_tile->y1, (OPJ_INT32)l_image_comp->dy);
  876|  25.7k|        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|  25.7k|        l_tilec->numresolutions = l_tccp->numresolutions;
  880|  25.7k|        if (l_tccp->numresolutions < l_cp->m_specific_param.m_dec.m_reduce) {
  ------------------
  |  Branch (880:13): [True: 0, False: 25.7k]
  ------------------
  881|      0|            l_tilec->minimum_num_resolutions = 1;
  882|  25.7k|        } else {
  883|  25.7k|            l_tilec->minimum_num_resolutions = l_tccp->numresolutions -
  884|  25.7k|                                               l_cp->m_specific_param.m_dec.m_reduce;
  885|  25.7k|        }
  886|       |
  887|  25.7k|        if (isEncoder) {
  ------------------
  |  Branch (887:13): [True: 0, False: 25.7k]
  ------------------
  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|  25.7k|        l_data_size = l_tilec->numresolutions * (OPJ_UINT32)sizeof(
  911|  25.7k|                          opj_tcd_resolution_t);
  912|       |
  913|  25.7k|        opj_image_data_free(l_tilec->data_win);
  914|  25.7k|        l_tilec->data_win = NULL;
  915|  25.7k|        l_tilec->win_x0 = 0;
  916|  25.7k|        l_tilec->win_y0 = 0;
  917|  25.7k|        l_tilec->win_x1 = 0;
  918|  25.7k|        l_tilec->win_y1 = 0;
  919|       |
  920|  25.7k|        if (l_tilec->resolutions == 00) {
  ------------------
  |  Branch (920:13): [True: 24.3k, False: 1.46k]
  ------------------
  921|  24.3k|            l_tilec->resolutions = (opj_tcd_resolution_t *) opj_malloc(l_data_size);
  922|  24.3k|            if (! l_tilec->resolutions) {
  ------------------
  |  Branch (922:17): [True: 0, False: 24.3k]
  ------------------
  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|  24.3k|            l_tilec->resolutions_size = l_data_size;
  927|  24.3k|            memset(l_tilec->resolutions, 0, l_data_size);
  928|  24.3k|        } else if (l_data_size > l_tilec->resolutions_size) {
  ------------------
  |  Branch (928:20): [True: 0, False: 1.46k]
  ------------------
  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|  25.7k|        l_level_no = l_tilec->numresolutions;
  946|  25.7k|        l_res = l_tilec->resolutions;
  947|  25.7k|        l_step_size = l_tccp->stepsizes;
  948|       |        /*fprintf(stderr, "\tlevel_no=%d\n",l_level_no);*/
  949|       |
  950|   167k|        for (resno = 0; resno < l_tilec->numresolutions; ++resno) {
  ------------------
  |  Branch (950:25): [True: 142k, False: 25.7k]
  ------------------
  951|       |            /*fprintf(stderr, "\t\tresno = %d/%d\n", resno, l_tilec->numresolutions);*/
  952|   142k|            OPJ_INT32 tlcbgxstart, tlcbgystart /*, brcbgxend, brcbgyend*/;
  953|   142k|            OPJ_UINT32 cbgwidthexpn, cbgheightexpn;
  954|   142k|            OPJ_UINT32 cblkwidthexpn, cblkheightexpn;
  955|       |
  956|   142k|            --l_level_no;
  957|       |
  958|       |            /* border for each resolution level (global) */
  959|   142k|            l_res->x0 = opj_int_ceildivpow2(l_tilec->x0, (OPJ_INT32)l_level_no);
  960|   142k|            l_res->y0 = opj_int_ceildivpow2(l_tilec->y0, (OPJ_INT32)l_level_no);
  961|   142k|            l_res->x1 = opj_int_ceildivpow2(l_tilec->x1, (OPJ_INT32)l_level_no);
  962|   142k|            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|   142k|            l_pdx = l_tccp->prcw[resno];
  967|   142k|            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|   142k|            l_tl_prc_x_start = opj_int_floordivpow2(l_res->x0, (OPJ_INT32)l_pdx) << l_pdx;
  971|   142k|            l_tl_prc_y_start = opj_int_floordivpow2(l_res->y0, (OPJ_INT32)l_pdy) << l_pdy;
  972|   142k|            {
  973|   142k|                OPJ_UINT32 tmp = ((OPJ_UINT32)opj_int_ceildivpow2(l_res->x1,
  974|   142k|                                  (OPJ_INT32)l_pdx)) << l_pdx;
  975|   142k|                if (tmp > (OPJ_UINT32)INT_MAX) {
  ------------------
  |  Branch (975:21): [True: 0, False: 142k]
  ------------------
  976|      0|                    opj_event_msg(manager, EVT_ERROR, "Integer overflow\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  977|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  978|      0|                }
  979|   142k|                l_br_prc_x_end = (OPJ_INT32)tmp;
  980|   142k|            }
  981|      0|            {
  982|   142k|                OPJ_UINT32 tmp = ((OPJ_UINT32)opj_int_ceildivpow2(l_res->y1,
  983|   142k|                                  (OPJ_INT32)l_pdy)) << l_pdy;
  984|   142k|                if (tmp > (OPJ_UINT32)INT_MAX) {
  ------------------
  |  Branch (984:21): [True: 0, False: 142k]
  ------------------
  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|   142k|                l_br_prc_y_end = (OPJ_INT32)tmp;
  989|   142k|            }
  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|   142k|            l_res->pw = (l_res->x0 == l_res->x1) ? 0U : (OPJ_UINT32)((
  ------------------
  |  Branch (992:25): [True: 40.3k, False: 101k]
  ------------------
  993|   101k|                            l_br_prc_x_end - l_tl_prc_x_start) >> l_pdx);
  994|   142k|            l_res->ph = (l_res->y0 == l_res->y1) ? 0U : (OPJ_UINT32)((
  ------------------
  |  Branch (994:25): [True: 43.5k, False: 98.4k]
  ------------------
  995|  98.4k|                            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|   142k|            if ((l_res->pw != 0U) && ((((OPJ_UINT32) - 1) / l_res->pw) < l_res->ph)) {
  ------------------
  |  Branch (998:17): [True: 101k, False: 40.3k]
  |  Branch (998:38): [True: 1, False: 101k]
  ------------------
  999|      1|                opj_event_msg(manager, EVT_ERROR, "Size of tile data exceeds system limits\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1000|      1|                return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 1001|      1|            }
 1002|   142k|            l_nb_precincts = l_res->pw * l_res->ph;
 1003|       |
 1004|   142k|            if ((((OPJ_UINT32) - 1) / (OPJ_UINT32)sizeof(opj_tcd_precinct_t)) <
  ------------------
  |  Branch (1004:17): [True: 3, False: 142k]
  ------------------
 1005|   142k|                    l_nb_precincts) {
 1006|      3|                opj_event_msg(manager, EVT_ERROR, "Size of tile data exceeds system limits\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1007|      3|                return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 1008|      3|            }
 1009|   142k|            l_nb_precinct_size = l_nb_precincts * (OPJ_UINT32)sizeof(opj_tcd_precinct_t);
 1010|       |
 1011|   142k|            if (resno == 0) {
  ------------------
  |  Branch (1011:17): [True: 25.7k, False: 116k]
  ------------------
 1012|  25.7k|                tlcbgxstart = l_tl_prc_x_start;
 1013|  25.7k|                tlcbgystart = l_tl_prc_y_start;
 1014|       |                /*brcbgxend = l_br_prc_x_end;*/
 1015|       |                /* brcbgyend = l_br_prc_y_end;*/
 1016|  25.7k|                cbgwidthexpn = l_pdx;
 1017|  25.7k|                cbgheightexpn = l_pdy;
 1018|  25.7k|                l_res->numbands = 1;
 1019|   116k|            } else {
 1020|   116k|                tlcbgxstart = opj_int_ceildivpow2(l_tl_prc_x_start, 1);
 1021|   116k|                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|   116k|                cbgwidthexpn = l_pdx - 1;
 1025|   116k|                cbgheightexpn = l_pdy - 1;
 1026|   116k|                l_res->numbands = 3;
 1027|   116k|            }
 1028|       |
 1029|   142k|            cblkwidthexpn = opj_uint_min(l_tccp->cblkw, cbgwidthexpn);
 1030|   142k|            cblkheightexpn = opj_uint_min(l_tccp->cblkh, cbgheightexpn);
 1031|   142k|            l_band = l_res->bands;
 1032|       |
 1033|   516k|            for (bandno = 0; bandno < l_res->numbands; ++bandno, ++l_band, ++l_step_size) {
  ------------------
  |  Branch (1033:30): [True: 374k, False: 142k]
  ------------------
 1034|       |                /*fprintf(stderr, "\t\t\tband_no=%d/%d\n", bandno, l_res->numbands );*/
 1035|       |
 1036|   374k|                if (resno == 0) {
  ------------------
  |  Branch (1036:21): [True: 25.7k, False: 348k]
  ------------------
 1037|  25.7k|                    l_band->bandno = 0 ;
 1038|  25.7k|                    l_band->x0 = opj_int_ceildivpow2(l_tilec->x0, (OPJ_INT32)l_level_no);
 1039|  25.7k|                    l_band->y0 = opj_int_ceildivpow2(l_tilec->y0, (OPJ_INT32)l_level_no);
 1040|  25.7k|                    l_band->x1 = opj_int_ceildivpow2(l_tilec->x1, (OPJ_INT32)l_level_no);
 1041|  25.7k|                    l_band->y1 = opj_int_ceildivpow2(l_tilec->y1, (OPJ_INT32)l_level_no);
 1042|   348k|                } else {
 1043|   348k|                    l_band->bandno = bandno + 1;
 1044|       |                    /* x0b = 1 if bandno = 1 or 3 */
 1045|   348k|                    l_x0b = l_band->bandno & 1;
 1046|       |                    /* y0b = 1 if bandno = 2 or 3 */
 1047|   348k|                    l_y0b = (OPJ_INT32)((l_band->bandno) >> 1);
 1048|       |                    /* l_band border (global) */
 1049|   348k|                    l_band->x0 = opj_int64_ceildivpow2(l_tilec->x0 - ((OPJ_INT64)l_x0b <<
 1050|   348k|                                                       l_level_no), (OPJ_INT32)(l_level_no + 1));
 1051|   348k|                    l_band->y0 = opj_int64_ceildivpow2(l_tilec->y0 - ((OPJ_INT64)l_y0b <<
 1052|   348k|                                                       l_level_no), (OPJ_INT32)(l_level_no + 1));
 1053|   348k|                    l_band->x1 = opj_int64_ceildivpow2(l_tilec->x1 - ((OPJ_INT64)l_x0b <<
 1054|   348k|                                                       l_level_no), (OPJ_INT32)(l_level_no + 1));
 1055|   348k|                    l_band->y1 = opj_int64_ceildivpow2(l_tilec->y1 - ((OPJ_INT64)l_y0b <<
 1056|   348k|                                                       l_level_no), (OPJ_INT32)(l_level_no + 1));
 1057|   348k|                }
 1058|       |
 1059|   374k|                if (isEncoder) {
  ------------------
  |  Branch (1059:21): [True: 0, False: 374k]
  ------------------
 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|   374k|                {
 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|   374k|                    const OPJ_INT32 log2_gain = (!isEncoder &&
  ------------------
  |  Branch (1074:50): [True: 374k, False: 0]
  ------------------
 1075|   374k|                                                 l_tccp->qmfbid == 0) ? 0 : (l_band->bandno == 0) ? 0 :
  ------------------
  |  Branch (1075:50): [True: 205k, False: 168k]
  |  Branch (1075:77): [True: 14.8k, False: 153k]
  ------------------
 1076|   168k|                                                (l_band->bandno == 3) ? 2 : 1;
  ------------------
  |  Branch (1076:49): [True: 51.2k, False: 102k]
  ------------------
 1077|       |
 1078|       |                    /* Nominal dynamic range. Equation E-4 */
 1079|   374k|                    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|   374k|                    l_band->stepsize = (OPJ_FLOAT32)(((1.0 + l_step_size->mant / 2048.0) * pow(2.0,
 1084|   374k|                                                      (OPJ_INT32)(Rb - l_step_size->expn))));
 1085|   374k|                }
 1086|       |
 1087|       |                /* Mb value of Equation E-2 in "E.1 Inverse quantization
 1088|       |                 * procedure" of the standard */
 1089|   374k|                l_band->numbps = l_step_size->expn + (OPJ_INT32)l_tccp->numgbits -
 1090|   374k|                                 1;
 1091|       |
 1092|   374k|                if (!l_band->precincts && (l_nb_precincts > 0U)) {
  ------------------
  |  Branch (1092:21): [True: 359k, False: 14.5k]
  |  Branch (1092:43): [True: 184k, False: 175k]
  ------------------
 1093|   184k|                    l_band->precincts = (opj_tcd_precinct_t *) opj_malloc(/*3 * */
 1094|   184k|                                            l_nb_precinct_size);
 1095|   184k|                    if (! l_band->precincts) {
  ------------------
  |  Branch (1095:25): [True: 0, False: 184k]
  ------------------
 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|   184k|                    memset(l_band->precincts, 0, l_nb_precinct_size);
 1102|   184k|                    l_band->precincts_data_size = l_nb_precinct_size;
 1103|   190k|                } else if (l_band->precincts_data_size < l_nb_precinct_size) {
  ------------------
  |  Branch (1103:28): [True: 79, False: 190k]
  ------------------
 1104|       |
 1105|     79|                    opj_tcd_precinct_t * new_precincts = (opj_tcd_precinct_t *) opj_realloc(
 1106|     79|                            l_band->precincts,/*3 * */ l_nb_precinct_size);
 1107|     79|                    if (! new_precincts) {
  ------------------
  |  Branch (1107:25): [True: 0, False: 79]
  ------------------
 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|     79|                    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|     79|                    memset(((OPJ_BYTE *) l_band->precincts) + l_band->precincts_data_size, 0,
 1118|     79|                           l_nb_precinct_size - l_band->precincts_data_size);
 1119|     79|                    l_band->precincts_data_size = l_nb_precinct_size;
 1120|     79|                }
 1121|       |
 1122|   374k|                l_current_precinct = l_band->precincts;
 1123|  2.83M|                for (precno = 0; precno < l_nb_precincts; ++precno) {
  ------------------
  |  Branch (1123:34): [True: 2.45M, False: 374k]
  ------------------
 1124|  2.45M|                    OPJ_INT32 tlcblkxstart, tlcblkystart, brcblkxend, brcblkyend;
 1125|  2.45M|                    OPJ_INT32 cbgxstart = tlcbgxstart + (OPJ_INT32)(precno % l_res->pw) *
 1126|  2.45M|                                          (1 << cbgwidthexpn);
 1127|  2.45M|                    OPJ_INT32 cbgystart = tlcbgystart + (OPJ_INT32)(precno / l_res->pw) *
 1128|  2.45M|                                          (1 << cbgheightexpn);
 1129|  2.45M|                    OPJ_INT32 cbgxend = cbgxstart + (1 << cbgwidthexpn);
 1130|  2.45M|                    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|  2.45M|                    l_current_precinct->x0 = opj_int_max(cbgxstart, l_band->x0);
 1138|  2.45M|                    l_current_precinct->y0 = opj_int_max(cbgystart, l_band->y0);
 1139|  2.45M|                    l_current_precinct->x1 = opj_int_min(cbgxend, l_band->x1);
 1140|  2.45M|                    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|  2.45M|                    tlcblkxstart = opj_int_floordivpow2(l_current_precinct->x0,
 1144|  2.45M|                                                        (OPJ_INT32)cblkwidthexpn) << cblkwidthexpn;
 1145|       |                    /*fprintf(stderr, "\t tlcblkxstart =%d\n",tlcblkxstart );*/
 1146|  2.45M|                    tlcblkystart = opj_int_floordivpow2(l_current_precinct->y0,
 1147|  2.45M|                                                        (OPJ_INT32)cblkheightexpn) << cblkheightexpn;
 1148|       |                    /*fprintf(stderr, "\t tlcblkystart =%d\n",tlcblkystart );*/
 1149|  2.45M|                    brcblkxend = opj_int_ceildivpow2(l_current_precinct->x1,
 1150|  2.45M|                                                     (OPJ_INT32)cblkwidthexpn) << cblkwidthexpn;
 1151|       |                    /*fprintf(stderr, "\t brcblkxend =%d\n",brcblkxend );*/
 1152|  2.45M|                    brcblkyend = opj_int_ceildivpow2(l_current_precinct->y1,
 1153|  2.45M|                                                     (OPJ_INT32)cblkheightexpn) << cblkheightexpn;
 1154|       |                    /*fprintf(stderr, "\t brcblkyend =%d\n",brcblkyend );*/
 1155|  2.45M|                    l_current_precinct->cw = (OPJ_UINT32)((brcblkxend - tlcblkxstart) >>
 1156|  2.45M|                                                          cblkwidthexpn);
 1157|  2.45M|                    l_current_precinct->ch = (OPJ_UINT32)((brcblkyend - tlcblkystart) >>
 1158|  2.45M|                                                          cblkheightexpn);
 1159|       |
 1160|  2.45M|                    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|  2.45M|                    if ((((OPJ_UINT32) - 1) / (OPJ_UINT32)sizeof_block) <
  ------------------
  |  Branch (1162:25): [True: 0, False: 2.45M]
  ------------------
 1163|  2.45M|                            l_nb_code_blocks) {
 1164|      0|                        opj_event_msg(manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1165|      0|                                      "Size of code block data exceeds system limits\n");
 1166|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1167|      0|                    }
 1168|  2.45M|                    l_nb_code_blocks_size = l_nb_code_blocks * (OPJ_UINT32)sizeof_block;
 1169|       |
 1170|  2.45M|                    if (!l_current_precinct->cblks.blocks && (l_nb_code_blocks > 0U)) {
  ------------------
  |  Branch (1170:25): [True: 2.43M, False: 21.3k]
  |  Branch (1170:62): [True: 2.37M, False: 65.0k]
  ------------------
 1171|  2.37M|                        l_current_precinct->cblks.blocks = opj_malloc(l_nb_code_blocks_size);
 1172|  2.37M|                        if (! l_current_precinct->cblks.blocks) {
  ------------------
  |  Branch (1172:29): [True: 0, False: 2.37M]
  ------------------
 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|  2.37M|                        memset(l_current_precinct->cblks.blocks, 0, l_nb_code_blocks_size);
 1178|       |
 1179|  2.37M|                        l_current_precinct->block_size = l_nb_code_blocks_size;
 1180|  2.37M|                    } else if (l_nb_code_blocks_size > l_current_precinct->block_size) {
  ------------------
  |  Branch (1180:32): [True: 800, False: 85.6k]
  ------------------
 1181|    800|                        void *new_blocks = opj_realloc(l_current_precinct->cblks.blocks,
 1182|    800|                                                       l_nb_code_blocks_size);
 1183|    800|                        if (! new_blocks) {
  ------------------
  |  Branch (1183:29): [True: 0, False: 800]
  ------------------
 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|    800|                        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|    800|                        memset(((OPJ_BYTE *) l_current_precinct->cblks.blocks) +
 1195|    800|                               l_current_precinct->block_size
 1196|    800|                               , 0
 1197|    800|                               , l_nb_code_blocks_size - l_current_precinct->block_size);
 1198|       |
 1199|    800|                        l_current_precinct->block_size = l_nb_code_blocks_size;
 1200|    800|                    }
 1201|       |
 1202|  2.45M|                    if (! l_current_precinct->incltree) {
  ------------------
  |  Branch (1202:25): [True: 2.43M, False: 21.1k]
  ------------------
 1203|  2.43M|                        l_current_precinct->incltree = opj_tgt_create(l_current_precinct->cw,
 1204|  2.43M|                                                       l_current_precinct->ch, manager);
 1205|  2.43M|                    } else {
 1206|  21.1k|                        l_current_precinct->incltree = opj_tgt_init(l_current_precinct->incltree,
 1207|  21.1k|                                                       l_current_precinct->cw, l_current_precinct->ch, manager);
 1208|  21.1k|                    }
 1209|       |
 1210|  2.45M|                    if (! l_current_precinct->imsbtree) {
  ------------------
  |  Branch (1210:25): [True: 2.43M, False: 21.1k]
  ------------------
 1211|  2.43M|                        l_current_precinct->imsbtree = opj_tgt_create(l_current_precinct->cw,
 1212|  2.43M|                                                       l_current_precinct->ch, manager);
 1213|  2.43M|                    } else {
 1214|  21.1k|                        l_current_precinct->imsbtree = opj_tgt_init(l_current_precinct->imsbtree,
 1215|  21.1k|                                                       l_current_precinct->cw, l_current_precinct->ch, manager);
 1216|  21.1k|                    }
 1217|       |
 1218|   115M|                    for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
  ------------------
  |  Branch (1218:38): [True: 113M, False: 2.45M]
  ------------------
 1219|   113M|                        OPJ_INT32 cblkxstart = tlcblkxstart + (OPJ_INT32)(cblkno %
 1220|   113M|                                               l_current_precinct->cw) * (1 << cblkwidthexpn);
 1221|   113M|                        OPJ_INT32 cblkystart = tlcblkystart + (OPJ_INT32)(cblkno /
 1222|   113M|                                               l_current_precinct->cw) * (1 << cblkheightexpn);
 1223|   113M|                        OPJ_INT32 cblkxend = cblkxstart + (1 << cblkwidthexpn);
 1224|   113M|                        OPJ_INT32 cblkyend = cblkystart + (1 << cblkheightexpn);
 1225|       |
 1226|   113M|                        if (isEncoder) {
  ------------------
  |  Branch (1226:29): [True: 0, False: 113M]
  ------------------
 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|   113M|                        } else {
 1242|   113M|                            opj_tcd_cblk_dec_t* l_code_block = l_current_precinct->cblks.dec + cblkno;
 1243|       |
 1244|   113M|                            if (! opj_tcd_code_block_dec_allocate(l_code_block)) {
  ------------------
  |  Branch (1244:33): [True: 0, False: 113M]
  ------------------
 1245|      0|                                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1246|      0|                            }
 1247|       |                            /* code-block size (global) */
 1248|   113M|                            l_code_block->x0 = opj_int_max(cblkxstart, l_current_precinct->x0);
 1249|   113M|                            l_code_block->y0 = opj_int_max(cblkystart, l_current_precinct->y0);
 1250|   113M|                            l_code_block->x1 = opj_int_min(cblkxend, l_current_precinct->x1);
 1251|   113M|                            l_code_block->y1 = opj_int_min(cblkyend, l_current_precinct->y1);
 1252|   113M|                        }
 1253|   113M|                    }
 1254|  2.45M|                    ++l_current_precinct;
 1255|  2.45M|                } /* precno */
 1256|   374k|            } /* bandno */
 1257|   142k|            ++l_res;
 1258|   142k|        } /* resno */
 1259|  25.7k|        ++l_tccp;
 1260|  25.7k|        ++l_tilec;
 1261|  25.7k|        ++l_image_comp;
 1262|  25.7k|    } /* compno */
 1263|  6.95k|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.95k|#define OPJ_TRUE 1
  ------------------
 1264|  6.96k|}
tcd.c:opj_tcd_code_block_dec_allocate:
 1358|   113M|{
 1359|   113M|    if (! p_code_block->segs) {
  ------------------
  |  Branch (1359:9): [True: 112M, False: 352k]
  ------------------
 1360|       |
 1361|   112M|        p_code_block->segs = (opj_tcd_seg_t *) opj_calloc(OPJ_J2K_DEFAULT_NB_SEGS,
  ------------------
  |  |  155|   112M|#define OPJ_J2K_DEFAULT_NB_SEGS             10
  ------------------
 1362|   112M|                             sizeof(opj_tcd_seg_t));
 1363|   112M|        if (! p_code_block->segs) {
  ------------------
  |  Branch (1363:13): [True: 0, False: 112M]
  ------------------
 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|   112M|        p_code_block->m_current_max_segs = OPJ_J2K_DEFAULT_NB_SEGS;
  ------------------
  |  |  155|   112M|#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|   112M|    } else {
 1371|       |        /* sanitize */
 1372|   352k|        opj_tcd_seg_t * l_segs = p_code_block->segs;
 1373|   352k|        OPJ_UINT32 l_current_max_segs = p_code_block->m_current_max_segs;
 1374|   352k|        opj_tcd_seg_data_chunk_t* l_chunks = p_code_block->chunks;
 1375|   352k|        OPJ_UINT32 l_numchunksalloc = p_code_block->numchunksalloc;
 1376|   352k|        OPJ_UINT32 i;
 1377|       |
 1378|   352k|        opj_aligned_free(p_code_block->decoded_data);
 1379|   352k|        p_code_block->decoded_data = 00;
 1380|       |
 1381|   352k|        memset(p_code_block, 0, sizeof(opj_tcd_cblk_dec_t));
 1382|   352k|        p_code_block->segs = l_segs;
 1383|   352k|        p_code_block->m_current_max_segs = l_current_max_segs;
 1384|  3.88M|        for (i = 0; i < l_current_max_segs; ++i) {
  ------------------
  |  Branch (1384:21): [True: 3.52M, False: 352k]
  ------------------
 1385|  3.52M|            opj_tcd_reinit_segment(&l_segs[i]);
 1386|  3.52M|        }
 1387|   352k|        p_code_block->chunks = l_chunks;
 1388|   352k|        p_code_block->numchunksalloc = l_numchunksalloc;
 1389|   352k|    }
 1390|       |
 1391|   113M|    return OPJ_TRUE;
  ------------------
  |  |  117|   113M|#define OPJ_TRUE 1
  ------------------
 1392|   113M|}
tcd.c:opj_tcd_free_tile:
 1923|  6.88k|{
 1924|  6.88k|    OPJ_UINT32 compno, resno, bandno, precno;
 1925|  6.88k|    opj_tcd_tile_t *l_tile = 00;
 1926|  6.88k|    opj_tcd_tilecomp_t *l_tile_comp = 00;
 1927|  6.88k|    opj_tcd_resolution_t *l_res = 00;
 1928|  6.88k|    opj_tcd_band_t *l_band = 00;
 1929|  6.88k|    opj_tcd_precinct_t *l_precinct = 00;
 1930|  6.88k|    OPJ_UINT32 l_nb_resolutions, l_nb_precincts;
 1931|  6.88k|    void (* l_tcd_code_block_deallocate)(opj_tcd_precinct_t *) = 00;
 1932|       |
 1933|  6.88k|    if (! p_tcd) {
  ------------------
  |  Branch (1933:9): [True: 0, False: 6.88k]
  ------------------
 1934|      0|        return;
 1935|      0|    }
 1936|       |
 1937|  6.88k|    if (! p_tcd->tcd_image) {
  ------------------
  |  Branch (1937:9): [True: 0, False: 6.88k]
  ------------------
 1938|      0|        return;
 1939|      0|    }
 1940|       |
 1941|  6.88k|    if (p_tcd->m_is_decoder) {
  ------------------
  |  Branch (1941:9): [True: 6.88k, False: 0]
  ------------------
 1942|  6.88k|        l_tcd_code_block_deallocate = opj_tcd_code_block_dec_deallocate;
 1943|  6.88k|    } else {
 1944|      0|        l_tcd_code_block_deallocate = opj_tcd_code_block_enc_deallocate;
 1945|      0|    }
 1946|       |
 1947|  6.88k|    l_tile = p_tcd->tcd_image->tiles;
 1948|  6.88k|    if (! l_tile) {
  ------------------
  |  Branch (1948:9): [True: 0, False: 6.88k]
  ------------------
 1949|      0|        return;
 1950|      0|    }
 1951|       |
 1952|  6.88k|    l_tile_comp = l_tile->comps;
 1953|       |
 1954|  32.8k|    for (compno = 0; compno < l_tile->numcomps; ++compno) {
  ------------------
  |  Branch (1954:22): [True: 25.9k, False: 6.88k]
  ------------------
 1955|  25.9k|        l_res = l_tile_comp->resolutions;
 1956|  25.9k|        if (l_res) {
  ------------------
  |  Branch (1956:13): [True: 24.3k, False: 1.61k]
  ------------------
 1957|       |
 1958|  24.3k|            l_nb_resolutions = l_tile_comp->resolutions_size / (OPJ_UINT32)sizeof(
 1959|  24.3k|                                   opj_tcd_resolution_t);
 1960|   146k|            for (resno = 0; resno < l_nb_resolutions; ++resno) {
  ------------------
  |  Branch (1960:29): [True: 122k, False: 24.3k]
  ------------------
 1961|   122k|                l_band = l_res->bands;
 1962|   489k|                for (bandno = 0; bandno < 3; ++bandno) {
  ------------------
  |  Branch (1962:34): [True: 366k, False: 122k]
  ------------------
 1963|   366k|                    l_precinct = l_band->precincts;
 1964|   366k|                    if (l_precinct) {
  ------------------
  |  Branch (1964:25): [True: 184k, False: 182k]
  ------------------
 1965|       |
 1966|   184k|                        l_nb_precincts = l_band->precincts_data_size / (OPJ_UINT32)sizeof(
 1967|   184k|                                             opj_tcd_precinct_t);
 1968|  2.61M|                        for (precno = 0; precno < l_nb_precincts; ++precno) {
  ------------------
  |  Branch (1968:42): [True: 2.43M, False: 184k]
  ------------------
 1969|  2.43M|                            opj_tgt_destroy(l_precinct->incltree);
 1970|  2.43M|                            l_precinct->incltree = 00;
 1971|  2.43M|                            opj_tgt_destroy(l_precinct->imsbtree);
 1972|  2.43M|                            l_precinct->imsbtree = 00;
 1973|  2.43M|                            (*l_tcd_code_block_deallocate)(l_precinct);
 1974|  2.43M|                            ++l_precinct;
 1975|  2.43M|                        }
 1976|       |
 1977|   184k|                        opj_free(l_band->precincts);
 1978|   184k|                        l_band->precincts = 00;
 1979|   184k|                    }
 1980|   366k|                    ++l_band;
 1981|   366k|                } /* for (resno */
 1982|   122k|                ++l_res;
 1983|   122k|            }
 1984|       |
 1985|  24.3k|            opj_free(l_tile_comp->resolutions);
 1986|  24.3k|            l_tile_comp->resolutions = 00;
 1987|  24.3k|        }
 1988|       |
 1989|  25.9k|        if (l_tile_comp->ownsData && l_tile_comp->data) {
  ------------------
  |  Branch (1989:13): [True: 5.71k, False: 20.2k]
  |  Branch (1989:38): [True: 5.00k, False: 704]
  ------------------
 1990|  5.00k|            opj_image_data_free(l_tile_comp->data);
 1991|  5.00k|            l_tile_comp->data = 00;
 1992|  5.00k|            l_tile_comp->ownsData = 0;
 1993|  5.00k|            l_tile_comp->data_size = 0;
 1994|  5.00k|            l_tile_comp->data_size_needed = 0;
 1995|  5.00k|        }
 1996|       |
 1997|  25.9k|        opj_image_data_free(l_tile_comp->data_win);
 1998|       |
 1999|  25.9k|        ++l_tile_comp;
 2000|  25.9k|    }
 2001|       |
 2002|  6.88k|    opj_free(l_tile->comps);
 2003|  6.88k|    l_tile->comps = 00;
 2004|  6.88k|    opj_free(p_tcd->tcd_image->tiles);
 2005|  6.88k|    p_tcd->tcd_image->tiles = 00;
 2006|  6.88k|}
tcd.c:opj_tcd_code_block_dec_deallocate:
 2359|  2.43M|{
 2360|  2.43M|    OPJ_UINT32 cblkno, l_nb_code_blocks;
 2361|       |
 2362|  2.43M|    opj_tcd_cblk_dec_t * l_code_block = p_precinct->cblks.dec;
 2363|  2.43M|    if (l_code_block) {
  ------------------
  |  Branch (2363:9): [True: 2.37M, False: 64.0k]
  ------------------
 2364|       |        /*fprintf(stderr,"deallocate codeblock:{\n");*/
 2365|       |        /*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);*/
 2366|       |        /*fprintf(stderr,"\t numbps=%d, numlenbits=%d, len=%d, numnewpasses=%d, real_num_segs=%d, m_current_max_segs=%d\n ",
 2367|       |                        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 );*/
 2368|       |
 2369|       |
 2370|  2.37M|        l_nb_code_blocks = p_precinct->block_size / (OPJ_UINT32)sizeof(
 2371|  2.37M|                               opj_tcd_cblk_dec_t);
 2372|       |        /*fprintf(stderr,"nb_code_blocks =%d\t}\n", l_nb_code_blocks);*/
 2373|       |
 2374|   115M|        for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
  ------------------
  |  Branch (2374:26): [True: 112M, False: 2.37M]
  ------------------
 2375|       |
 2376|   112M|            if (l_code_block->segs) {
  ------------------
  |  Branch (2376:17): [True: 112M, False: 0]
  ------------------
 2377|   112M|                opj_free(l_code_block->segs);
 2378|   112M|                l_code_block->segs = 00;
 2379|   112M|            }
 2380|       |
 2381|   112M|            if (l_code_block->chunks) {
  ------------------
  |  Branch (2381:17): [True: 171k, False: 112M]
  ------------------
 2382|   171k|                opj_free(l_code_block->chunks);
 2383|   171k|                l_code_block->chunks = 00;
 2384|   171k|            }
 2385|       |
 2386|   112M|            opj_aligned_free(l_code_block->decoded_data);
 2387|   112M|            l_code_block->decoded_data = NULL;
 2388|       |
 2389|   112M|            ++l_code_block;
 2390|   112M|        }
 2391|       |
 2392|  2.37M|        opj_free(p_precinct->cblks.dec);
 2393|  2.37M|        p_precinct->cblks.dec = 00;
 2394|  2.37M|    }
 2395|  2.43M|}
tcd.c:opj_tcd_t2_decode:
 2016|  6.88k|{
 2017|  6.88k|    opj_t2_t * l_t2;
 2018|       |
 2019|  6.88k|    l_t2 = opj_t2_create(p_tcd->image, p_tcd->cp);
 2020|  6.88k|    if (l_t2 == 00) {
  ------------------
  |  Branch (2020:9): [True: 0, False: 6.88k]
  ------------------
 2021|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2022|      0|    }
 2023|       |
 2024|  6.88k|    if (! opj_t2_decode_packets(
  ------------------
  |  Branch (2024:9): [True: 427, False: 6.45k]
  ------------------
 2025|  6.88k|                p_tcd,
 2026|  6.88k|                l_t2,
 2027|  6.88k|                p_tcd->tcd_tileno,
 2028|  6.88k|                p_tcd->tcd_image->tiles,
 2029|  6.88k|                p_src_data,
 2030|  6.88k|                p_data_read,
 2031|  6.88k|                p_max_src_size,
 2032|  6.88k|                p_cstr_index,
 2033|  6.88k|                p_manager)) {
 2034|    427|        opj_t2_destroy(l_t2);
 2035|    427|        return OPJ_FALSE;
  ------------------
  |  |  118|    427|#define OPJ_FALSE 0
  ------------------
 2036|    427|    }
 2037|       |
 2038|  6.45k|    opj_t2_destroy(l_t2);
 2039|       |
 2040|       |    /*---------------CLEAN-------------------*/
 2041|  6.45k|    return OPJ_TRUE;
  ------------------
  |  |  117|  6.45k|#define OPJ_TRUE 1
  ------------------
 2042|  6.88k|}
tcd.c:opj_tcd_t1_decode:
 2045|  6.45k|{
 2046|  6.45k|    OPJ_UINT32 compno;
 2047|  6.45k|    opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
 2048|  6.45k|    opj_tcd_tilecomp_t* l_tile_comp = l_tile->comps;
 2049|  6.45k|    opj_tccp_t * l_tccp = p_tcd->tcp->tccps;
 2050|  6.45k|    volatile OPJ_BOOL ret = OPJ_TRUE;
  ------------------
  |  |  117|  6.45k|#define OPJ_TRUE 1
  ------------------
 2051|  6.45k|    OPJ_BOOL check_pterm = OPJ_FALSE;
  ------------------
  |  |  118|  6.45k|#define OPJ_FALSE 0
  ------------------
 2052|  6.45k|    opj_mutex_t* p_manager_mutex = NULL;
 2053|       |
 2054|  6.45k|    p_manager_mutex = opj_mutex_create();
 2055|       |
 2056|       |    /* Only enable PTERM check if we decode all layers */
 2057|  6.45k|    if (p_tcd->tcp->num_layers_to_decode == p_tcd->tcp->numlayers &&
  ------------------
  |  Branch (2057:9): [True: 6.45k, False: 0]
  ------------------
 2058|  6.45k|            (l_tccp->cblksty & J2K_CCP_CBLKSTY_PTERM) != 0) {
  ------------------
  |  |   62|  6.45k|#define J2K_CCP_CBLKSTY_PTERM 0x10    /**< Predictable termination */
  ------------------
  |  Branch (2058:13): [True: 3.13k, False: 3.32k]
  ------------------
 2059|  3.13k|        check_pterm = OPJ_TRUE;
  ------------------
  |  |  117|  3.13k|#define OPJ_TRUE 1
  ------------------
 2060|  3.13k|    }
 2061|       |
 2062|  29.2k|    for (compno = 0; compno < l_tile->numcomps;
  ------------------
  |  Branch (2062:22): [True: 23.2k, False: 5.95k]
  ------------------
 2063|  23.2k|            ++compno, ++l_tile_comp, ++l_tccp) {
 2064|  23.2k|        if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (2064:13): [True: 0, False: 23.2k]
  |  Branch (2064:46): [True: 0, False: 0]
  ------------------
 2065|      0|            continue;
 2066|      0|        }
 2067|       |
 2068|  23.2k|        opj_t1_decode_cblks(p_tcd, &ret, l_tile_comp, l_tccp,
 2069|  23.2k|                            p_manager, p_manager_mutex, check_pterm);
 2070|  23.2k|        if (!ret) {
  ------------------
  |  Branch (2070:13): [True: 500, False: 22.7k]
  ------------------
 2071|    500|            break;
 2072|    500|        }
 2073|  23.2k|    }
 2074|       |
 2075|  6.45k|    opj_thread_pool_wait_completion(p_tcd->thread_pool, 0);
 2076|  6.45k|    if (p_manager_mutex) {
  ------------------
  |  Branch (2076:9): [True: 6.45k, False: 0]
  ------------------
 2077|  6.45k|        opj_mutex_destroy(p_manager_mutex);
 2078|  6.45k|    }
 2079|  6.45k|    return ret;
 2080|  6.45k|}
tcd.c:opj_tcd_dwt_decode:
 2084|  5.95k|{
 2085|  5.95k|    OPJ_UINT32 compno;
 2086|  5.95k|    opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
 2087|  5.95k|    opj_tcd_tilecomp_t * l_tile_comp = l_tile->comps;
 2088|  5.95k|    opj_tccp_t * l_tccp = p_tcd->tcp->tccps;
 2089|  5.95k|    opj_image_comp_t * l_img_comp = p_tcd->image->comps;
 2090|       |
 2091|  28.4k|    for (compno = 0; compno < l_tile->numcomps;
  ------------------
  |  Branch (2091:22): [True: 22.4k, False: 5.95k]
  ------------------
 2092|  22.4k|            compno++, ++l_tile_comp, ++l_img_comp, ++l_tccp) {
 2093|  22.4k|        if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (2093:13): [True: 0, False: 22.4k]
  |  Branch (2093:46): [True: 0, False: 0]
  ------------------
 2094|      0|            continue;
 2095|      0|        }
 2096|       |
 2097|  22.4k|        if (l_tccp->qmfbid == 1) {
  ------------------
  |  Branch (2097:13): [True: 13.3k, False: 9.10k]
  ------------------
 2098|  13.3k|            if (! opj_dwt_decode(p_tcd, l_tile_comp,
  ------------------
  |  Branch (2098:17): [True: 0, False: 13.3k]
  ------------------
 2099|  13.3k|                                 l_img_comp->resno_decoded + 1)) {
 2100|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2101|      0|            }
 2102|  13.3k|        } else {
 2103|  9.10k|            if (! opj_dwt_decode_real(p_tcd, l_tile_comp,
  ------------------
  |  Branch (2103:17): [True: 0, False: 9.10k]
  ------------------
 2104|  9.10k|                                      l_img_comp->resno_decoded + 1)) {
 2105|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2106|      0|            }
 2107|  9.10k|        }
 2108|       |
 2109|  22.4k|    }
 2110|       |
 2111|  5.95k|    return OPJ_TRUE;
  ------------------
  |  |  117|  5.95k|#define OPJ_TRUE 1
  ------------------
 2112|  5.95k|}
tcd.c:opj_tcd_mct_decode:
 2115|  5.95k|{
 2116|  5.95k|    opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
 2117|  5.95k|    opj_tcp_t * l_tcp = p_tcd->tcp;
 2118|  5.95k|    opj_tcd_tilecomp_t * l_tile_comp = l_tile->comps;
 2119|  5.95k|    OPJ_SIZE_T l_samples;
 2120|  5.95k|    OPJ_UINT32 i;
 2121|       |
 2122|  5.95k|    if (l_tcp->mct == 0 || p_tcd->used_component != NULL) {
  ------------------
  |  Branch (2122:9): [True: 4.91k, False: 1.04k]
  |  Branch (2122:28): [True: 0, False: 1.04k]
  ------------------
 2123|  4.91k|        return OPJ_TRUE;
  ------------------
  |  |  117|  4.91k|#define OPJ_TRUE 1
  ------------------
 2124|  4.91k|    }
 2125|       |
 2126|  1.04k|    if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (2126:9): [True: 194, False: 850]
  ------------------
 2127|    194|        opj_tcd_resolution_t* res_comp0 = l_tile->comps[0].resolutions +
 2128|    194|                                          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|    194|        l_samples = (OPJ_SIZE_T)(res_comp0->x1 - res_comp0->x0) *
 2134|    194|                    (OPJ_SIZE_T)(res_comp0->y1 - res_comp0->y0);
 2135|    194|        if (l_tile->numcomps >= 3) {
  ------------------
  |  Branch (2135:13): [True: 181, False: 13]
  ------------------
 2136|    181|            if (l_tile_comp->minimum_num_resolutions !=
  ------------------
  |  Branch (2136:17): [True: 3, False: 178]
  ------------------
 2137|    181|                    l_tile->comps[1].minimum_num_resolutions ||
 2138|    181|                    l_tile_comp->minimum_num_resolutions !=
  ------------------
  |  Branch (2138:21): [True: 2, False: 176]
  ------------------
 2139|    178|                    l_tile->comps[2].minimum_num_resolutions) {
 2140|      5|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2141|      5|                              "Tiles don't all have the same dimension. Skip the MCT step.\n");
 2142|      5|                return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 2143|      5|            }
 2144|    181|        }
 2145|    189|        if (l_tile->numcomps >= 3) {
  ------------------
  |  Branch (2145:13): [True: 176, False: 13]
  ------------------
 2146|    176|            opj_tcd_resolution_t* res_comp1 = l_tile->comps[1].resolutions +
 2147|    176|                                              l_tile_comp->minimum_num_resolutions - 1;
 2148|    176|            opj_tcd_resolution_t* res_comp2 = l_tile->comps[2].resolutions +
 2149|    176|                                              l_tile_comp->minimum_num_resolutions - 1;
 2150|       |            /* testcase 1336.pdf.asan.47.376 */
 2151|    176|            if (p_tcd->image->comps[0].resno_decoded !=
  ------------------
  |  Branch (2151:17): [True: 4, False: 172]
  ------------------
 2152|    176|                    p_tcd->image->comps[1].resno_decoded ||
 2153|    176|                    p_tcd->image->comps[0].resno_decoded !=
  ------------------
  |  Branch (2153:21): [True: 2, False: 170]
  ------------------
 2154|    172|                    p_tcd->image->comps[2].resno_decoded ||
 2155|    176|                    (OPJ_SIZE_T)(res_comp1->x1 - res_comp1->x0) *
  ------------------
  |  Branch (2155:21): [True: 129, False: 41]
  ------------------
 2156|    170|                    (OPJ_SIZE_T)(res_comp1->y1 - res_comp1->y0) != l_samples ||
 2157|    176|                    (OPJ_SIZE_T)(res_comp2->x1 - res_comp2->x0) *
  ------------------
  |  Branch (2157:21): [True: 2, False: 39]
  ------------------
 2158|    137|                    (OPJ_SIZE_T)(res_comp2->y1 - res_comp2->y0) != l_samples) {
 2159|    137|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    137|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2160|    137|                              "Tiles don't all have the same dimension. Skip the MCT step.\n");
 2161|    137|                return OPJ_FALSE;
  ------------------
  |  |  118|    137|#define OPJ_FALSE 0
  ------------------
 2162|    137|            }
 2163|    176|        }
 2164|    850|    } else {
 2165|    850|        opj_tcd_resolution_t* res_comp0 = l_tile->comps[0].resolutions +
 2166|    850|                                          p_tcd->image->comps[0].resno_decoded;
 2167|       |
 2168|    850|        l_samples = (OPJ_SIZE_T)(res_comp0->win_x1 - res_comp0->win_x0) *
 2169|    850|                    (OPJ_SIZE_T)(res_comp0->win_y1 - res_comp0->win_y0);
 2170|    850|        if (l_tile->numcomps >= 3) {
  ------------------
  |  Branch (2170:13): [True: 830, False: 20]
  ------------------
 2171|    830|            opj_tcd_resolution_t* res_comp1 = l_tile->comps[1].resolutions +
 2172|    830|                                              p_tcd->image->comps[1].resno_decoded;
 2173|    830|            opj_tcd_resolution_t* res_comp2 = l_tile->comps[2].resolutions +
 2174|    830|                                              p_tcd->image->comps[2].resno_decoded;
 2175|       |            /* testcase 1336.pdf.asan.47.376 */
 2176|    830|            if (p_tcd->image->comps[0].resno_decoded !=
  ------------------
  |  Branch (2176:17): [True: 9, False: 821]
  ------------------
 2177|    830|                    p_tcd->image->comps[1].resno_decoded ||
 2178|    830|                    p_tcd->image->comps[0].resno_decoded !=
  ------------------
  |  Branch (2178:21): [True: 0, False: 821]
  ------------------
 2179|    821|                    p_tcd->image->comps[2].resno_decoded ||
 2180|    830|                    (OPJ_SIZE_T)(res_comp1->win_x1 - res_comp1->win_x0) *
  ------------------
  |  Branch (2180:21): [True: 529, False: 292]
  ------------------
 2181|    821|                    (OPJ_SIZE_T)(res_comp1->win_y1 - res_comp1->win_y0) != l_samples ||
 2182|    830|                    (OPJ_SIZE_T)(res_comp2->win_x1 - res_comp2->win_x0) *
  ------------------
  |  Branch (2182:21): [True: 2, False: 290]
  ------------------
 2183|    540|                    (OPJ_SIZE_T)(res_comp2->win_y1 - res_comp2->win_y0) != l_samples) {
 2184|    540|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|    540|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2185|    540|                              "Tiles don't all have the same dimension. Skip the MCT step.\n");
 2186|    540|                return OPJ_FALSE;
  ------------------
  |  |  118|    540|#define OPJ_FALSE 0
  ------------------
 2187|    540|            }
 2188|    830|        }
 2189|    850|    }
 2190|       |
 2191|    362|    if (l_tile->numcomps >= 3) {
  ------------------
  |  Branch (2191:9): [True: 329, False: 33]
  ------------------
 2192|    329|        if (l_tcp->mct == 2) {
  ------------------
  |  Branch (2192:13): [True: 0, False: 329]
  ------------------
 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|    329|        } else {
 2229|    329|            if (l_tcp->tccps->qmfbid == 1) {
  ------------------
  |  Branch (2229:17): [True: 104, False: 225]
  ------------------
 2230|    104|                if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (2230:21): [True: 25, False: 79]
  ------------------
 2231|     25|                    opj_mct_decode(l_tile->comps[0].data,
 2232|     25|                                   l_tile->comps[1].data,
 2233|     25|                                   l_tile->comps[2].data,
 2234|     25|                                   l_samples);
 2235|     79|                } else {
 2236|     79|                    opj_mct_decode(l_tile->comps[0].data_win,
 2237|     79|                                   l_tile->comps[1].data_win,
 2238|     79|                                   l_tile->comps[2].data_win,
 2239|     79|                                   l_samples);
 2240|     79|                }
 2241|    225|            } else {
 2242|    225|                if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (2242:21): [True: 14, False: 211]
  ------------------
 2243|     14|                    opj_mct_decode_real((OPJ_FLOAT32*)l_tile->comps[0].data,
 2244|     14|                                        (OPJ_FLOAT32*)l_tile->comps[1].data,
 2245|     14|                                        (OPJ_FLOAT32*)l_tile->comps[2].data,
 2246|     14|                                        l_samples);
 2247|    211|                } else {
 2248|    211|                    opj_mct_decode_real((OPJ_FLOAT32*)l_tile->comps[0].data_win,
 2249|    211|                                        (OPJ_FLOAT32*)l_tile->comps[1].data_win,
 2250|    211|                                        (OPJ_FLOAT32*)l_tile->comps[2].data_win,
 2251|    211|                                        l_samples);
 2252|    211|                }
 2253|    225|            }
 2254|    329|        }
 2255|    329|    } else {
 2256|     33|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     33|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2257|     33|                      "Number of components (%d) is inconsistent with a MCT. Skip the MCT step.\n",
 2258|     33|                      l_tile->numcomps);
 2259|     33|    }
 2260|       |
 2261|    362|    return OPJ_TRUE;
  ------------------
  |  |  117|    362|#define OPJ_TRUE 1
  ------------------
 2262|    362|}
tcd.c:opj_tcd_dc_level_shift_decode:
 2266|  5.27k|{
 2267|  5.27k|    OPJ_UINT32 compno;
 2268|  5.27k|    opj_tcd_tilecomp_t * l_tile_comp = 00;
 2269|  5.27k|    opj_tccp_t * l_tccp = 00;
 2270|  5.27k|    opj_image_comp_t * l_img_comp = 00;
 2271|  5.27k|    opj_tcd_resolution_t* l_res = 00;
 2272|  5.27k|    opj_tcd_tile_t * l_tile;
 2273|  5.27k|    OPJ_UINT32 l_width, l_height, i, j;
 2274|  5.27k|    OPJ_INT32 * l_current_ptr;
 2275|  5.27k|    OPJ_INT32 l_min, l_max;
 2276|  5.27k|    OPJ_UINT32 l_stride;
 2277|       |
 2278|  5.27k|    l_tile = p_tcd->tcd_image->tiles;
 2279|  5.27k|    l_tile_comp = l_tile->comps;
 2280|  5.27k|    l_tccp = p_tcd->tcp->tccps;
 2281|  5.27k|    l_img_comp = p_tcd->image->comps;
 2282|       |
 2283|  25.4k|    for (compno = 0; compno < l_tile->numcomps;
  ------------------
  |  Branch (2283:22): [True: 20.1k, False: 5.27k]
  ------------------
 2284|  20.1k|            compno++, ++l_img_comp, ++l_tccp, ++l_tile_comp) {
 2285|       |
 2286|  20.1k|        if (p_tcd->used_component != NULL && !p_tcd->used_component[compno]) {
  ------------------
  |  Branch (2286:13): [True: 0, False: 20.1k]
  |  Branch (2286:46): [True: 0, False: 0]
  ------------------
 2287|      0|            continue;
 2288|      0|        }
 2289|       |
 2290|  20.1k|        l_res = l_tile_comp->resolutions + l_img_comp->resno_decoded;
 2291|       |
 2292|  20.1k|        if (!p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (2292:13): [True: 15.0k, False: 5.17k]
  ------------------
 2293|  15.0k|            l_width = l_res->win_x1 - l_res->win_x0;
 2294|  15.0k|            l_height = l_res->win_y1 - l_res->win_y0;
 2295|  15.0k|            l_stride = 0;
 2296|  15.0k|            l_current_ptr = l_tile_comp->data_win;
 2297|  15.0k|        } else {
 2298|  5.17k|            l_width = (OPJ_UINT32)(l_res->x1 - l_res->x0);
 2299|  5.17k|            l_height = (OPJ_UINT32)(l_res->y1 - l_res->y0);
 2300|  5.17k|            l_stride = (OPJ_UINT32)(
 2301|  5.17k|                           l_tile_comp->resolutions[l_tile_comp->minimum_num_resolutions - 1].x1 -
 2302|  5.17k|                           l_tile_comp->resolutions[l_tile_comp->minimum_num_resolutions - 1].x0)
 2303|  5.17k|                       - l_width;
 2304|  5.17k|            l_current_ptr = l_tile_comp->data;
 2305|       |
 2306|  5.17k|            assert(l_height == 0 ||
 2307|  5.17k|                   l_width + l_stride <= l_tile_comp->data_size / l_height); /*MUPDF*/
 2308|  5.17k|        }
 2309|       |
 2310|  20.1k|        if (l_img_comp->sgnd) {
  ------------------
  |  Branch (2310:13): [True: 6.64k, False: 13.5k]
  ------------------
 2311|  6.64k|            l_min = -(1 << (l_img_comp->prec - 1));
 2312|  6.64k|            l_max = (1 << (l_img_comp->prec - 1)) - 1;
 2313|  13.5k|        } else {
 2314|  13.5k|            l_min = 0;
 2315|  13.5k|            l_max = (OPJ_INT32)((1U << l_img_comp->prec) - 1);
 2316|  13.5k|        }
 2317|       |
 2318|       |
 2319|  20.1k|        if (l_tccp->qmfbid == 1) {
  ------------------
  |  Branch (2319:13): [True: 12.4k, False: 7.79k]
  ------------------
 2320|  2.11M|            for (j = 0; j < l_height; ++j) {
  ------------------
  |  Branch (2320:25): [True: 2.10M, False: 12.4k]
  ------------------
 2321|   346M|                for (i = 0; i < l_width; ++i) {
  ------------------
  |  Branch (2321:29): [True: 344M, False: 2.10M]
  ------------------
 2322|       |                    /* TODO: do addition on int64 ? */
 2323|   344M|                    *l_current_ptr = opj_int_clamp(*l_current_ptr + l_tccp->m_dc_level_shift, l_min,
 2324|   344M|                                                   l_max);
 2325|   344M|                    ++l_current_ptr;
 2326|   344M|                }
 2327|  2.10M|                l_current_ptr += l_stride;
 2328|  2.10M|            }
 2329|  12.4k|        } else {
 2330|  1.06M|            for (j = 0; j < l_height; ++j) {
  ------------------
  |  Branch (2330:25): [True: 1.05M, False: 7.79k]
  ------------------
 2331|   247M|                for (i = 0; i < l_width; ++i) {
  ------------------
  |  Branch (2331:29): [True: 246M, False: 1.05M]
  ------------------
 2332|   246M|                    OPJ_FLOAT32 l_value = *((OPJ_FLOAT32 *) l_current_ptr);
 2333|   246M|                    if (l_value > INT_MAX) {
  ------------------
  |  Branch (2333:25): [True: 13.1k, False: 246M]
  ------------------
 2334|  13.1k|                        *l_current_ptr = l_max;
 2335|   246M|                    } else if (l_value < INT_MIN) {
  ------------------
  |  Branch (2335:32): [True: 14.3k, False: 246M]
  ------------------
 2336|  14.3k|                        *l_current_ptr = l_min;
 2337|   246M|                    } else {
 2338|       |                        /* Do addition on int64 to avoid overflows */
 2339|   246M|                        OPJ_INT64 l_value_int = (OPJ_INT64)opj_lrintf(l_value);
 2340|   246M|                        *l_current_ptr = (OPJ_INT32)opj_int64_clamp(
 2341|   246M|                                             l_value_int + l_tccp->m_dc_level_shift, l_min, l_max);
 2342|   246M|                    }
 2343|   246M|                    ++l_current_ptr;
 2344|   246M|                }
 2345|  1.05M|                l_current_ptr += l_stride;
 2346|  1.05M|            }
 2347|  7.79k|        }
 2348|  20.1k|    }
 2349|       |
 2350|  5.27k|    return OPJ_TRUE;
  ------------------
  |  |  117|  5.27k|#define OPJ_TRUE 1
  ------------------
 2351|  5.27k|}
tcd.c:opj_tcd_is_whole_tilecomp_decoding:
 2870|  11.9k|{
 2871|  11.9k|    opj_tcd_tilecomp_t* tilec = &(p_tcd->tcd_image->tiles->comps[compno]);
 2872|  11.9k|    opj_image_comp_t* image_comp = &(p_tcd->image->comps[compno]);
 2873|       |    /* Compute the intersection of the area of interest, expressed in tile coordinates */
 2874|       |    /* with the tile coordinates */
 2875|  11.9k|    OPJ_UINT32 tcx0 = opj_uint_max(
 2876|  11.9k|                          (OPJ_UINT32)tilec->x0,
 2877|  11.9k|                          opj_uint_ceildiv(p_tcd->win_x0, image_comp->dx));
 2878|  11.9k|    OPJ_UINT32 tcy0 = opj_uint_max(
 2879|  11.9k|                          (OPJ_UINT32)tilec->y0,
 2880|  11.9k|                          opj_uint_ceildiv(p_tcd->win_y0, image_comp->dy));
 2881|  11.9k|    OPJ_UINT32 tcx1 = opj_uint_min(
 2882|  11.9k|                          (OPJ_UINT32)tilec->x1,
 2883|  11.9k|                          opj_uint_ceildiv(p_tcd->win_x1, image_comp->dx));
 2884|  11.9k|    OPJ_UINT32 tcy1 = opj_uint_min(
 2885|  11.9k|                          (OPJ_UINT32)tilec->y1,
 2886|  11.9k|                          opj_uint_ceildiv(p_tcd->win_y1, image_comp->dy));
 2887|       |
 2888|  11.9k|    OPJ_UINT32 shift = tilec->numresolutions - tilec->minimum_num_resolutions;
 2889|       |    /* Tolerate small margin within the reduced resolution factor to consider if */
 2890|       |    /* the whole tile path must be taken */
 2891|  11.9k|    return (tcx0 >= (OPJ_UINT32)tilec->x0 &&
  ------------------
  |  Branch (2891:13): [True: 11.9k, False: 0]
  ------------------
 2892|  11.9k|            tcy0 >= (OPJ_UINT32)tilec->y0 &&
  ------------------
  |  Branch (2892:13): [True: 11.9k, False: 0]
  ------------------
 2893|  11.9k|            tcx1 <= (OPJ_UINT32)tilec->x1 &&
  ------------------
  |  Branch (2893:13): [True: 11.9k, False: 0]
  ------------------
 2894|  11.9k|            tcy1 <= (OPJ_UINT32)tilec->y1 &&
  ------------------
  |  Branch (2894:13): [True: 11.9k, False: 0]
  ------------------
 2895|  11.9k|            (shift >= 32 ||
  ------------------
  |  Branch (2895:14): [True: 0, False: 11.9k]
  ------------------
 2896|  11.9k|             (((tcx0 - (OPJ_UINT32)tilec->x0) >> shift) == 0 &&
  ------------------
  |  Branch (2896:15): [True: 11.9k, False: 0]
  ------------------
 2897|  11.9k|              ((tcy0 - (OPJ_UINT32)tilec->y0) >> shift) == 0 &&
  ------------------
  |  Branch (2897:15): [True: 11.9k, False: 0]
  ------------------
 2898|  11.9k|              (((OPJ_UINT32)tilec->x1 - tcx1) >> shift) == 0 &&
  ------------------
  |  Branch (2898:15): [True: 6.88k, False: 5.04k]
  ------------------
 2899|  11.9k|              (((OPJ_UINT32)tilec->y1 - tcy1) >> shift) == 0)));
  ------------------
  |  Branch (2899:15): [True: 5.95k, False: 926]
  ------------------
 2900|  11.9k|}

opj_tgt_create:
   50|  4.87M|{
   51|  4.87M|    OPJ_INT32 nplh[32];
   52|  4.87M|    OPJ_INT32 nplv[32];
   53|  4.87M|    opj_tgt_node_t *node = 00;
   54|  4.87M|    opj_tgt_node_t *l_parent_node = 00;
   55|  4.87M|    opj_tgt_node_t *l_parent_node0 = 00;
   56|  4.87M|    opj_tgt_tree_t *tree = 00;
   57|  4.87M|    OPJ_UINT32 i;
   58|  4.87M|    OPJ_INT32  j, k;
   59|  4.87M|    OPJ_UINT32 numlvls;
   60|  4.87M|    OPJ_UINT32 n;
   61|       |
   62|  4.87M|    tree = (opj_tgt_tree_t *) opj_calloc(1, sizeof(opj_tgt_tree_t));
   63|  4.87M|    if (!tree) {
  ------------------
  |  Branch (63:9): [True: 0, False: 4.87M]
  ------------------
   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|  4.87M|    tree->numleafsh = numleafsh;
   69|  4.87M|    tree->numleafsv = numleafsv;
   70|       |
   71|  4.87M|    numlvls = 0;
   72|  4.87M|    nplh[0] = (OPJ_INT32)numleafsh;
   73|  4.87M|    nplv[0] = (OPJ_INT32)numleafsv;
   74|  4.87M|    tree->numnodes = 0;
   75|  16.2M|    do {
   76|  16.2M|        n = (OPJ_UINT32)(nplh[numlvls] * nplv[numlvls]);
   77|  16.2M|        nplh[numlvls + 1] = (nplh[numlvls] + 1) / 2;
   78|  16.2M|        nplv[numlvls + 1] = (nplv[numlvls] + 1) / 2;
   79|  16.2M|        tree->numnodes += n;
   80|  16.2M|        ++numlvls;
   81|  16.2M|    } while (n > 1);
  ------------------
  |  Branch (81:14): [True: 11.3M, False: 4.87M]
  ------------------
   82|       |
   83|       |    /* ADD */
   84|  4.87M|    if (tree->numnodes == 0) {
  ------------------
  |  Branch (84:9): [True: 130k, False: 4.74M]
  ------------------
   85|   130k|        opj_free(tree);
   86|   130k|        return 00;
   87|   130k|    }
   88|       |
   89|  4.74M|    tree->nodes = (opj_tgt_node_t*) opj_calloc(tree->numnodes,
   90|  4.74M|                  sizeof(opj_tgt_node_t));
   91|  4.74M|    if (!tree->nodes) {
  ------------------
  |  Branch (91:9): [True: 0, False: 4.74M]
  ------------------
   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|  4.74M|    tree->nodes_size = tree->numnodes * (OPJ_UINT32)sizeof(opj_tgt_node_t);
   98|       |
   99|  4.74M|    node = tree->nodes;
  100|  4.74M|    l_parent_node = &tree->nodes[tree->numleafsh * tree->numleafsv];
  101|  4.74M|    l_parent_node0 = l_parent_node;
  102|       |
  103|  16.1M|    for (i = 0; i < numlvls - 1; ++i) {
  ------------------
  |  Branch (103:17): [True: 11.3M, False: 4.74M]
  ------------------
  104|   146M|        for (j = 0; j < nplv[i]; ++j) {
  ------------------
  |  Branch (104:21): [True: 135M, False: 11.3M]
  ------------------
  105|   135M|            k = nplh[i];
  106|   379M|            while (--k >= 0) {
  ------------------
  |  Branch (106:20): [True: 243M, False: 135M]
  ------------------
  107|   243M|                node->parent = l_parent_node;
  108|   243M|                ++node;
  109|   243M|                if (--k >= 0) {
  ------------------
  |  Branch (109:21): [True: 132M, False: 111M]
  ------------------
  110|   132M|                    node->parent = l_parent_node;
  111|   132M|                    ++node;
  112|   132M|                }
  113|   243M|                ++l_parent_node;
  114|   243M|            }
  115|   135M|            if ((j & 1) || j == nplv[i] - 1) {
  ------------------
  |  Branch (115:17): [True: 63.1M, False: 72.2M]
  |  Branch (115:28): [True: 9.12M, False: 63.1M]
  ------------------
  116|  72.2M|                l_parent_node0 = l_parent_node;
  117|  72.2M|            } else {
  118|  63.1M|                l_parent_node = l_parent_node0;
  119|  63.1M|                l_parent_node0 += nplh[i];
  120|  63.1M|            }
  121|   135M|        }
  122|  11.3M|    }
  123|  4.74M|    node->parent = 0;
  124|  4.74M|    opj_tgt_reset(tree);
  125|  4.74M|    return tree;
  126|  4.74M|}
opj_tgt_init:
  138|  42.2k|{
  139|  42.2k|    OPJ_INT32 l_nplh[32];
  140|  42.2k|    OPJ_INT32 l_nplv[32];
  141|  42.2k|    opj_tgt_node_t *l_node = 00;
  142|  42.2k|    opj_tgt_node_t *l_parent_node = 00;
  143|  42.2k|    opj_tgt_node_t *l_parent_node0 = 00;
  144|  42.2k|    OPJ_UINT32 i;
  145|  42.2k|    OPJ_INT32 j, k;
  146|  42.2k|    OPJ_UINT32 l_num_levels;
  147|  42.2k|    OPJ_UINT32 n;
  148|  42.2k|    OPJ_UINT32 l_node_size;
  149|       |
  150|  42.2k|    if (! p_tree) {
  ------------------
  |  Branch (150:9): [True: 0, False: 42.2k]
  ------------------
  151|      0|        return 00;
  152|      0|    }
  153|       |
  154|  42.2k|    if ((p_tree->numleafsh != p_num_leafs_h) ||
  ------------------
  |  Branch (154:9): [True: 5.13k, False: 37.0k]
  ------------------
  155|  42.2k|            (p_tree->numleafsv != p_num_leafs_v)) {
  ------------------
  |  Branch (155:13): [True: 1.19k, False: 35.8k]
  ------------------
  156|  6.33k|        p_tree->numleafsh = p_num_leafs_h;
  157|  6.33k|        p_tree->numleafsv = p_num_leafs_v;
  158|       |
  159|  6.33k|        l_num_levels = 0;
  160|  6.33k|        l_nplh[0] = (OPJ_INT32)p_num_leafs_h;
  161|  6.33k|        l_nplv[0] = (OPJ_INT32)p_num_leafs_v;
  162|  6.33k|        p_tree->numnodes = 0;
  163|  15.6k|        do {
  164|  15.6k|            n = (OPJ_UINT32)(l_nplh[l_num_levels] * l_nplv[l_num_levels]);
  165|  15.6k|            l_nplh[l_num_levels + 1] = (l_nplh[l_num_levels] + 1) / 2;
  166|  15.6k|            l_nplv[l_num_levels + 1] = (l_nplv[l_num_levels] + 1) / 2;
  167|  15.6k|            p_tree->numnodes += n;
  168|  15.6k|            ++l_num_levels;
  169|  15.6k|        } while (n > 1);
  ------------------
  |  Branch (169:18): [True: 9.27k, False: 6.33k]
  ------------------
  170|       |
  171|       |        /* ADD */
  172|  6.33k|        if (p_tree->numnodes == 0) {
  ------------------
  |  Branch (172:13): [True: 1.72k, False: 4.60k]
  ------------------
  173|  1.72k|            opj_tgt_destroy(p_tree);
  174|  1.72k|            return 00;
  175|  1.72k|        }
  176|  4.60k|        l_node_size = p_tree->numnodes * (OPJ_UINT32)sizeof(opj_tgt_node_t);
  177|       |
  178|  4.60k|        if (l_node_size > p_tree->nodes_size) {
  ------------------
  |  Branch (178:13): [True: 1.59k, False: 3.01k]
  ------------------
  179|  1.59k|            opj_tgt_node_t* new_nodes = (opj_tgt_node_t*) opj_realloc(p_tree->nodes,
  180|  1.59k|                                        l_node_size);
  181|  1.59k|            if (! new_nodes) {
  ------------------
  |  Branch (181:17): [True: 0, False: 1.59k]
  ------------------
  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|  1.59k|            p_tree->nodes = new_nodes;
  188|  1.59k|            memset(((char *) p_tree->nodes) + p_tree->nodes_size, 0,
  189|  1.59k|                   l_node_size - p_tree->nodes_size);
  190|  1.59k|            p_tree->nodes_size = l_node_size;
  191|  1.59k|        }
  192|  4.60k|        l_node = p_tree->nodes;
  193|  4.60k|        l_parent_node = &p_tree->nodes[p_tree->numleafsh * p_tree->numleafsv];
  194|  4.60k|        l_parent_node0 = l_parent_node;
  195|       |
  196|  13.8k|        for (i = 0; i < l_num_levels - 1; ++i) {
  ------------------
  |  Branch (196:21): [True: 9.27k, False: 4.60k]
  ------------------
  197|  20.4k|            for (j = 0; j < l_nplv[i]; ++j) {
  ------------------
  |  Branch (197:25): [True: 11.1k, False: 9.27k]
  ------------------
  198|  11.1k|                k = l_nplh[i];
  199|  50.6k|                while (--k >= 0) {
  ------------------
  |  Branch (199:24): [True: 39.5k, False: 11.1k]
  ------------------
  200|  39.5k|                    l_node->parent = l_parent_node;
  201|  39.5k|                    ++l_node;
  202|  39.5k|                    if (--k >= 0) {
  ------------------
  |  Branch (202:25): [True: 33.4k, False: 6.12k]
  ------------------
  203|  33.4k|                        l_node->parent = l_parent_node;
  204|  33.4k|                        ++l_node;
  205|  33.4k|                    }
  206|  39.5k|                    ++l_parent_node;
  207|  39.5k|                }
  208|  11.1k|                if ((j & 1) || j == l_nplv[i] - 1) {
  ------------------
  |  Branch (208:21): [True: 1.21k, False: 9.95k]
  |  Branch (208:32): [True: 8.73k, False: 1.21k]
  ------------------
  209|  9.95k|                    l_parent_node0 = l_parent_node;
  210|  9.95k|                } else {
  211|  1.21k|                    l_parent_node = l_parent_node0;
  212|  1.21k|                    l_parent_node0 += l_nplh[i];
  213|  1.21k|                }
  214|  11.1k|            }
  215|  9.27k|        }
  216|  4.60k|        l_node->parent = 0;
  217|  4.60k|    }
  218|  40.4k|    opj_tgt_reset(p_tree);
  219|       |
  220|  40.4k|    return p_tree;
  221|  42.2k|}
opj_tgt_destroy:
  224|  4.87M|{
  225|  4.87M|    if (! p_tree) {
  ------------------
  |  Branch (225:9): [True: 129k, False: 4.74M]
  ------------------
  226|   129k|        return;
  227|   129k|    }
  228|       |
  229|  4.74M|    if (p_tree->nodes) {
  ------------------
  |  Branch (229:9): [True: 4.74M, False: 0]
  ------------------
  230|  4.74M|        opj_free(p_tree->nodes);
  231|  4.74M|        p_tree->nodes = 00;
  232|  4.74M|    }
  233|  4.74M|    opj_free(p_tree);
  234|  4.74M|}
opj_tgt_reset:
  237|  5.73M|{
  238|  5.73M|    OPJ_UINT32 i;
  239|  5.73M|    opj_tgt_node_t * l_current_node = 00;;
  240|       |
  241|  5.73M|    if (! p_tree) {
  ------------------
  |  Branch (241:9): [True: 2.00k, False: 5.73M]
  ------------------
  242|  2.00k|        return;
  243|  2.00k|    }
  244|       |
  245|  5.73M|    l_current_node = p_tree->nodes;
  246|   596M|    for (i = 0; i < p_tree->numnodes; ++i) {
  ------------------
  |  Branch (246:17): [True: 590M, False: 5.73M]
  ------------------
  247|   590M|        l_current_node->value = 999;
  248|   590M|        l_current_node->low = 0;
  249|   590M|        l_current_node->known = 0;
  250|   590M|        ++l_current_node;
  251|   590M|    }
  252|  5.73M|}
opj_tgt_decode:
  309|  8.31M|{
  310|  8.31M|    opj_tgt_node_t *stk[31];
  311|  8.31M|    opj_tgt_node_t **stkptr;
  312|  8.31M|    opj_tgt_node_t *node;
  313|  8.31M|    OPJ_INT32 low;
  314|       |
  315|  8.31M|    stkptr = stk;
  316|  8.31M|    node = &tree->nodes[leafno];
  317|  72.6M|    while (node->parent) {
  ------------------
  |  Branch (317:12): [True: 64.3M, False: 8.31M]
  ------------------
  318|  64.3M|        *stkptr++ = node;
  319|  64.3M|        node = node->parent;
  320|  64.3M|    }
  321|       |
  322|  8.31M|    low = 0;
  323|  72.6M|    for (;;) {
  324|  72.6M|        if (low > node->low) {
  ------------------
  |  Branch (324:13): [True: 10.2M, False: 62.4M]
  ------------------
  325|  10.2M|            node->low = low;
  326|  62.4M|        } else {
  327|  62.4M|            low = node->low;
  328|  62.4M|        }
  329|  74.2M|        while (low < threshold && low < node->value) {
  ------------------
  |  Branch (329:16): [True: 15.0M, False: 59.1M]
  |  Branch (329:35): [True: 1.55M, False: 13.5M]
  ------------------
  330|  1.55M|            if (opj_bio_read(bio, 1)) {
  ------------------
  |  Branch (330:17): [True: 622k, False: 931k]
  ------------------
  331|   622k|                node->value = low;
  332|   931k|            } else {
  333|   931k|                ++low;
  334|   931k|            }
  335|  1.55M|        }
  336|  72.6M|        node->low = low;
  337|  72.6M|        if (stkptr == stk) {
  ------------------
  |  Branch (337:13): [True: 8.31M, False: 64.3M]
  ------------------
  338|  8.31M|            break;
  339|  8.31M|        }
  340|  64.3M|        node = *--stkptr;
  341|  64.3M|    }
  342|       |
  343|  8.31M|    return (node->value < threshold) ? 1 : 0;
  ------------------
  |  Branch (343:12): [True: 370k, False: 7.94M]
  ------------------
  344|  8.31M|}

opj_mutex_create:
  314|  6.45k|{
  315|  6.45k|    opj_mutex_t* mutex = (opj_mutex_t*) opj_calloc(1U, sizeof(opj_mutex_t));
  316|  6.45k|    if (mutex != NULL) {
  ------------------
  |  Branch (316:9): [True: 6.45k, False: 0]
  ------------------
  317|  6.45k|        if (pthread_mutex_init(&mutex->mutex, NULL) != 0) {
  ------------------
  |  Branch (317:13): [True: 0, False: 6.45k]
  ------------------
  318|      0|            opj_free(mutex);
  319|      0|            mutex = NULL;
  320|      0|        }
  321|  6.45k|    }
  322|  6.45k|    return mutex;
  323|  6.45k|}
opj_mutex_lock:
  326|  43.9k|{
  327|  43.9k|    pthread_mutex_lock(&(mutex->mutex));
  328|  43.9k|}
opj_mutex_unlock:
  331|  43.9k|{
  332|  43.9k|    pthread_mutex_unlock(&(mutex->mutex));
  333|  43.9k|}
opj_mutex_destroy:
  336|  15.6k|{
  337|  15.6k|    if (!mutex) {
  ------------------
  |  Branch (337:9): [True: 9.22k, False: 6.45k]
  ------------------
  338|  9.22k|        return;
  339|  9.22k|    }
  340|  6.45k|    pthread_mutex_destroy(&(mutex->mutex));
  341|  6.45k|    opj_free(mutex);
  342|  6.45k|}
opj_tls_get:
  530|  1.64M|{
  531|  1.64M|    int i;
  532|  1.64M|    for (i = 0; i < tls->key_val_count; i++) {
  ------------------
  |  Branch (532:17): [True: 1.63M, False: 5.97k]
  ------------------
  533|  1.63M|        if (tls->key_val[i].key == key) {
  ------------------
  |  Branch (533:13): [True: 1.63M, False: 0]
  ------------------
  534|  1.63M|            return tls->key_val[i].value;
  535|  1.63M|        }
  536|  1.63M|    }
  537|  5.97k|    return NULL;
  538|  1.64M|}
opj_tls_set:
  542|  5.97k|{
  543|  5.97k|    opj_tls_key_val_t* new_key_val;
  544|  5.97k|    int i;
  545|       |
  546|  5.97k|    if (tls->key_val_count == INT_MAX) {
  ------------------
  |  Branch (546:9): [True: 0, False: 5.97k]
  ------------------
  547|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  548|      0|    }
  549|  5.97k|    for (i = 0; i < tls->key_val_count; i++) {
  ------------------
  |  Branch (549:17): [True: 0, False: 5.97k]
  ------------------
  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|  5.97k|    new_key_val = (opj_tls_key_val_t*) opj_realloc(tls->key_val,
  560|  5.97k|                  ((size_t)tls->key_val_count + 1U) * sizeof(opj_tls_key_val_t));
  561|  5.97k|    if (!new_key_val) {
  ------------------
  |  Branch (561:9): [True: 0, False: 5.97k]
  ------------------
  562|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  563|      0|    }
  564|  5.97k|    tls->key_val = new_key_val;
  565|  5.97k|    new_key_val[tls->key_val_count].key = key;
  566|  5.97k|    new_key_val[tls->key_val_count].value = value;
  567|  5.97k|    new_key_val[tls->key_val_count].opj_free_func = opj_free_func;
  568|  5.97k|    tls->key_val_count ++;
  569|  5.97k|    return OPJ_TRUE;
  ------------------
  |  |  117|  5.97k|#define OPJ_TRUE 1
  ------------------
  570|  5.97k|}
opj_thread_pool_create:
  626|  9.22k|{
  627|  9.22k|    opj_thread_pool_t* tp;
  628|       |
  629|  9.22k|    tp = (opj_thread_pool_t*) opj_calloc(1, sizeof(opj_thread_pool_t));
  630|  9.22k|    if (!tp) {
  ------------------
  |  Branch (630:9): [True: 0, False: 9.22k]
  ------------------
  631|      0|        return NULL;
  632|      0|    }
  633|  9.22k|    tp->state = OPJWTS_OK;
  634|       |
  635|  9.22k|    if (num_threads <= 0) {
  ------------------
  |  Branch (635:9): [True: 9.22k, False: 0]
  ------------------
  636|  9.22k|        tp->tls = opj_tls_new();
  637|  9.22k|        if (!tp->tls) {
  ------------------
  |  Branch (637:13): [True: 0, False: 9.22k]
  ------------------
  638|      0|            opj_free(tp);
  639|      0|            tp = NULL;
  640|      0|        }
  641|  9.22k|        return tp;
  642|  9.22k|    }
  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.64M|{
  831|  1.64M|    opj_worker_thread_job_t* job;
  832|  1.64M|    opj_job_list_t* item;
  833|       |
  834|  1.64M|    if (tp->mutex == NULL) {
  ------------------
  |  Branch (834:9): [True: 1.64M, False: 0]
  ------------------
  835|  1.64M|        job_fn(user_data, tp->tls);
  836|  1.64M|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.64M|#define OPJ_TRUE 1
  ------------------
  837|  1.64M|    }
  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|  6.45k|{
  897|  6.45k|    if (tp->mutex == NULL) {
  ------------------
  |  Branch (897:9): [True: 6.45k, False: 0]
  ------------------
  898|  6.45k|        return;
  899|  6.45k|    }
  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.64M|{
  916|  1.64M|    return tp->worker_threads_count;
  917|  1.64M|}
opj_thread_pool_destroy:
  920|  9.22k|{
  921|  9.22k|    if (!tp) {
  ------------------
  |  Branch (921:9): [True: 0, False: 9.22k]
  ------------------
  922|      0|        return;
  923|      0|    }
  924|  9.22k|    if (tp->cond) {
  ------------------
  |  Branch (924:9): [True: 0, False: 9.22k]
  ------------------
  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|  9.22k|    opj_mutex_destroy(tp->mutex);
  952|  9.22k|    opj_tls_destroy(tp->tls);
  953|  9.22k|    opj_free(tp);
  954|  9.22k|}
thread.c:opj_tls_new:
  510|  9.22k|{
  511|  9.22k|    return (opj_tls_t*) opj_calloc(1, sizeof(opj_tls_t));
  512|  9.22k|}
thread.c:opj_tls_destroy:
  515|  9.22k|{
  516|  9.22k|    int i;
  517|  9.22k|    if (!tls) {
  ------------------
  |  Branch (517:9): [True: 0, False: 9.22k]
  ------------------
  518|      0|        return;
  519|      0|    }
  520|  15.2k|    for (i = 0; i < tls->key_val_count; i++) {
  ------------------
  |  Branch (520:17): [True: 5.97k, False: 9.22k]
  ------------------
  521|  5.97k|        if (tls->key_val[i].opj_free_func) {
  ------------------
  |  Branch (521:13): [True: 5.97k, False: 0]
  ------------------
  522|  5.97k|            tls->key_val[i].opj_free_func(tls->key_val[i].value);
  523|  5.97k|        }
  524|  5.97k|    }
  525|  9.22k|    opj_free(tls->key_val);
  526|  9.22k|    opj_free(tls);
  527|  9.22k|}

LLVMFuzzerInitialize:
  103|      2|{
  104|      2|    return 0;
  105|      2|}
LLVMFuzzerTestOneInput:
  111|  9.26k|{
  112|       |
  113|  9.26k|    OPJ_CODEC_FORMAT eCodecFormat;
  114|  9.26k|    if (len >= 4 + sizeof(jp2_box_jp) &&
  ------------------
  |  Branch (114:9): [True: 9.25k, False: 4]
  ------------------
  115|  9.26k|            memcmp(buf + 4, jp2_box_jp, sizeof(jp2_box_jp)) == 0) {
  ------------------
  |  Branch (115:13): [True: 9.22k, False: 32]
  ------------------
  116|  9.22k|        eCodecFormat = OPJ_CODEC_JP2;
  117|  9.22k|    } else {
  118|     36|        return 0;
  119|     36|    }
  120|       |
  121|  9.22k|    opj_codec_t* pCodec = opj_create_decompress(eCodecFormat);
  122|  9.22k|    opj_set_info_handler(pCodec, InfoCallback, NULL);
  123|  9.22k|    opj_set_warning_handler(pCodec, WarningCallback, NULL);
  124|  9.22k|    opj_set_error_handler(pCodec, ErrorCallback, NULL);
  125|       |
  126|  9.22k|    opj_dparameters_t parameters;
  127|  9.22k|    opj_set_default_decoder_parameters(&parameters);
  128|       |
  129|  9.22k|    opj_setup_decoder(pCodec, &parameters);
  130|       |
  131|  9.22k|    opj_stream_t *pStream = opj_stream_create(1024, OPJ_TRUE);
  ------------------
  |  |  117|  9.22k|#define OPJ_TRUE 1
  ------------------
  132|  9.22k|    MemFile memFile;
  133|  9.22k|    memFile.pabyData = buf;
  134|  9.22k|    memFile.nLength = len;
  135|  9.22k|    memFile.nCurPos = 0;
  136|  9.22k|    opj_stream_set_user_data_length(pStream, len);
  137|  9.22k|    opj_stream_set_read_function(pStream, ReadCallback);
  138|  9.22k|    opj_stream_set_seek_function(pStream, SeekCallback);
  139|  9.22k|    opj_stream_set_skip_function(pStream, SkipCallback);
  140|  9.22k|    opj_stream_set_user_data(pStream, &memFile, NULL);
  141|       |
  142|  9.22k|    opj_image_t * psImage = NULL;
  143|  9.22k|    if (!opj_read_header(pStream, pCodec, &psImage)) {
  ------------------
  |  Branch (143:9): [True: 2.34k, False: 6.88k]
  ------------------
  144|  2.34k|        opj_destroy_codec(pCodec);
  145|  2.34k|        opj_stream_destroy(pStream);
  146|  2.34k|        opj_image_destroy(psImage);
  147|  2.34k|        return 0;
  148|  2.34k|    }
  149|       |
  150|  6.88k|    OPJ_UINT32 width = psImage->x1 - psImage->x0;
  151|  6.88k|    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|  6.88k|    OPJ_UINT32 width_to_read = width;
  184|  6.88k|    if (width_to_read > 1024) {
  ------------------
  |  Branch (184:9): [True: 6.87k, False: 1]
  ------------------
  185|  6.87k|        width_to_read = 1024;
  186|  6.87k|    }
  187|  6.88k|    OPJ_UINT32 height_to_read = height;
  188|  6.88k|    if (height_to_read > 1024) {
  ------------------
  |  Branch (188:9): [True: 6.41k, False: 461]
  ------------------
  189|  6.41k|        height_to_read = 1024;
  190|  6.41k|    }
  191|       |
  192|  6.88k|    if (opj_set_decode_area(pCodec, psImage,
  ------------------
  |  Branch (192:9): [True: 6.88k, False: 0]
  ------------------
  193|  6.88k|                            psImage->x0, psImage->y0,
  194|  6.88k|                            psImage->x0 + width_to_read,
  195|  6.88k|                            psImage->y0 + height_to_read)) {
  196|  6.88k|        if (opj_decode(pCodec, pStream, psImage)) {
  ------------------
  |  Branch (196:13): [True: 4.38k, False: 2.49k]
  ------------------
  197|       |            //printf("success\n");
  198|  4.38k|        }
  199|  6.88k|    }
  200|       |
  201|  6.88k|    opj_end_decompress(pCodec, pStream);
  202|  6.88k|    opj_stream_destroy(pStream);
  203|  6.88k|    opj_destroy_codec(pCodec);
  204|  6.88k|    opj_image_destroy(psImage);
  205|       |
  206|  6.88k|    return 0;
  207|  9.22k|}
opj_decompress_fuzzer_JP2.cpp:_ZL12InfoCallbackPKcPv:
   61|  59.9k|{
   62|  59.9k|}
opj_decompress_fuzzer_JP2.cpp:_ZL15WarningCallbackPKcPv:
   57|  20.4M|{
   58|  20.4M|}
opj_decompress_fuzzer_JP2.cpp:_ZL13ErrorCallbackPKcPv:
   50|  16.1k|{
   51|  16.1k|    (void)msg;
   52|       |    //fprintf(stderr, "%s\n", msg);
   53|  16.1k|}
opj_decompress_fuzzer_JP2.cpp:_ZL12ReadCallbackPvmS_:
   66|  23.6k|{
   67|  23.6k|    MemFile* memFile = (MemFile*)pUserData;
   68|       |    //printf("want to read %d bytes at %d\n", (int)memFile->nCurPos, (int)nBytes);
   69|  23.6k|    if (memFile->nCurPos >= memFile->nLength) {
  ------------------
  |  Branch (69:9): [True: 7.15k, False: 16.4k]
  ------------------
   70|  7.15k|        return -1;
   71|  7.15k|    }
   72|  16.4k|    if (memFile->nCurPos + nBytes >= memFile->nLength) {
  ------------------
  |  Branch (72:9): [True: 10.0k, False: 6.40k]
  ------------------
   73|  10.0k|        size_t nToRead = memFile->nLength - memFile->nCurPos;
   74|  10.0k|        memcpy(pBuffer, memFile->pabyData + memFile->nCurPos, nToRead);
   75|  10.0k|        memFile->nCurPos = memFile->nLength;
   76|  10.0k|        return nToRead;
   77|  10.0k|    }
   78|  6.40k|    if (nBytes == 0) {
  ------------------
  |  Branch (78:9): [True: 0, False: 6.40k]
  ------------------
   79|      0|        return -1;
   80|      0|    }
   81|  6.40k|    memcpy(pBuffer, memFile->pabyData + memFile->nCurPos, nBytes);
   82|  6.40k|    memFile->nCurPos += nBytes;
   83|  6.40k|    return nBytes;
   84|  6.40k|}
opj_decompress_fuzzer_JP2.cpp:_ZL12SeekCallbacklPv:
   87|  1.49k|{
   88|  1.49k|    MemFile* memFile = (MemFile*)pUserData;
   89|       |    //printf("seek to %d\n", (int)nBytes);
   90|  1.49k|    memFile->nCurPos = nBytes;
   91|  1.49k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.49k|#define OPJ_TRUE 1
  ------------------
   92|  1.49k|}
opj_decompress_fuzzer_JP2.cpp:_ZL12SkipCallbacklPv:
   95|    187|{
   96|    187|    MemFile* memFile = (MemFile*)pUserData;
   97|    187|    memFile->nCurPos += nBytes;
   98|    187|    return nBytes;
   99|    187|}

