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

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

opj_dwt_decode:
 2125|      8|{
 2126|      8|    if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (2126:9): [True: 5, False: 3]
  ------------------
 2127|      5|        return opj_dwt_decode_tile(p_tcd->thread_pool, tilec, numres);
 2128|      5|    } else {
 2129|      3|        return opj_dwt_decode_partial_tile(tilec, numres);
 2130|      3|    }
 2131|      8|}
opj_dwt_decode_real:
 3973|     28|{
 3974|     28|    if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (3974:9): [True: 13, False: 15]
  ------------------
 3975|     13|        return opj_dwt_decode_tile_97(p_tcd->thread_pool, tilec, numres);
 3976|     15|    } else {
 3977|     15|        return opj_dwt_decode_partial_97(tilec, numres);
 3978|     15|    }
 3979|     28|}
dwt.c:opj_dwt_max_resolution:
 2205|     20|{
 2206|     20|    OPJ_UINT32 mr   = 0;
 2207|     20|    OPJ_UINT32 w;
 2208|    492|    while (--i) {
  ------------------
  |  Branch (2208:12): [True: 472, False: 20]
  ------------------
 2209|    472|        ++r;
 2210|    472|        if (mr < (w = (OPJ_UINT32)(r->x1 - r->x0))) {
  ------------------
  |  Branch (2210:13): [True: 78, False: 394]
  ------------------
 2211|     78|            mr = w ;
 2212|     78|        }
 2213|    472|        if (mr < (w = (OPJ_UINT32)(r->y1 - r->y0))) {
  ------------------
  |  Branch (2213:13): [True: 24, False: 448]
  ------------------
 2214|     24|            mr = w ;
 2215|     24|        }
 2216|    472|    }
 2217|     20|    return mr ;
 2218|     20|}
dwt.c:opj_dwt_decode_tile:
 2279|      5|{
 2280|      5|    opj_dwt_t h;
 2281|      5|    opj_dwt_t v;
 2282|       |
 2283|      5|    opj_tcd_resolution_t* tr = tilec->resolutions;
 2284|       |
 2285|      5|    OPJ_UINT32 rw = (OPJ_UINT32)(tr->x1 -
 2286|      5|                                 tr->x0);  /* width of the resolution level computed */
 2287|      5|    OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 -
 2288|      5|                                 tr->y0);  /* height of the resolution level computed */
 2289|       |
 2290|      5|    OPJ_UINT32 w = (OPJ_UINT32)(tilec->resolutions[tilec->minimum_num_resolutions -
 2291|      5|                                                               1].x1 -
 2292|      5|                                tilec->resolutions[tilec->minimum_num_resolutions - 1].x0);
 2293|      5|    OPJ_SIZE_T h_mem_size;
 2294|      5|    int num_threads;
 2295|       |
 2296|       |    /* Not entirely sure for the return code of w == 0 which is triggered per */
 2297|       |    /* https://github.com/uclouvain/openjpeg/issues/1505 */
 2298|      5|    if (numres == 1U || w == 0) {
  ------------------
  |  Branch (2298:9): [True: 0, False: 5]
  |  Branch (2298:25): [True: 0, False: 5]
  ------------------
 2299|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 2300|      0|    }
 2301|      5|    num_threads = opj_thread_pool_get_thread_count(tp);
 2302|      5|    h_mem_size = opj_dwt_max_resolution(tr, numres);
 2303|       |    /* overflow check */
 2304|      5|    if (h_mem_size > (SIZE_MAX / PARALLEL_COLS_53 / sizeof(OPJ_INT32))) {
  ------------------
  |  |   81|      5|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|      5|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
  |  Branch (2304:9): [True: 0, False: 5]
  ------------------
 2305|       |        /* FIXME event manager error callback */
 2306|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2307|      0|    }
 2308|       |    /* We need PARALLEL_COLS_53 times the height of the array, */
 2309|       |    /* since for the vertical pass */
 2310|       |    /* we process PARALLEL_COLS_53 columns at a time */
 2311|      5|    h_mem_size *= PARALLEL_COLS_53 * sizeof(OPJ_INT32);
  ------------------
  |  |   81|      5|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|      5|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
 2312|      5|    h.mem = (OPJ_INT32*)opj_aligned_32_malloc(h_mem_size);
 2313|      5|    if (! h.mem) {
  ------------------
  |  Branch (2313:9): [True: 0, False: 5]
  ------------------
 2314|       |        /* FIXME event manager error callback */
 2315|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2316|      0|    }
 2317|       |
 2318|      5|    v.mem = h.mem;
 2319|       |
 2320|     87|    while (--numres) {
  ------------------
  |  Branch (2320:12): [True: 82, False: 5]
  ------------------
 2321|     82|        OPJ_INT32 * OPJ_RESTRICT tiledp = tilec->data;
 2322|     82|        OPJ_UINT32 j;
 2323|       |
 2324|     82|        ++tr;
 2325|     82|        h.sn = (OPJ_INT32)rw;
 2326|     82|        v.sn = (OPJ_INT32)rh;
 2327|       |
 2328|     82|        rw = (OPJ_UINT32)(tr->x1 - tr->x0);
 2329|     82|        rh = (OPJ_UINT32)(tr->y1 - tr->y0);
 2330|       |
 2331|     82|        h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
 2332|     82|        h.cas = tr->x0 % 2;
 2333|       |
 2334|     82|        if (num_threads <= 1 || rh <= 1) {
  ------------------
  |  Branch (2334:13): [True: 82, False: 0]
  |  Branch (2334:33): [True: 0, False: 0]
  ------------------
 2335|    867|            for (j = 0; j < rh; ++j) {
  ------------------
  |  Branch (2335:25): [True: 785, False: 82]
  ------------------
 2336|    785|                opj_idwt53_h(&h, &tiledp[(OPJ_SIZE_T)j * w]);
 2337|    785|            }
 2338|     82|        } else {
 2339|      0|            OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
 2340|      0|            OPJ_UINT32 step_j;
 2341|       |
 2342|      0|            if (rh < num_jobs) {
  ------------------
  |  Branch (2342:17): [True: 0, False: 0]
  ------------------
 2343|      0|                num_jobs = rh;
 2344|      0|            }
 2345|      0|            step_j = (rh / num_jobs);
 2346|       |
 2347|      0|            for (j = 0; j < num_jobs; j++) {
  ------------------
  |  Branch (2347:25): [True: 0, False: 0]
  ------------------
 2348|      0|                opj_dwt_decode_h_job_t* job;
 2349|       |
 2350|      0|                job = (opj_dwt_decode_h_job_t*) opj_malloc(sizeof(opj_dwt_decode_h_job_t));
 2351|      0|                if (!job) {
  ------------------
  |  Branch (2351:21): [True: 0, False: 0]
  ------------------
 2352|       |                    /* It would be nice to fallback to single thread case, but */
 2353|       |                    /* unfortunately some jobs may be launched and have modified */
 2354|       |                    /* tiledp, so it is not practical to recover from that error */
 2355|       |                    /* FIXME event manager error callback */
 2356|      0|                    opj_thread_pool_wait_completion(tp, 0);
 2357|      0|                    opj_aligned_free(h.mem);
 2358|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2359|      0|                }
 2360|      0|                job->h = h;
 2361|      0|                job->rw = rw;
 2362|      0|                job->w = w;
 2363|      0|                job->tiledp = tiledp;
 2364|      0|                job->min_j = j * step_j;
 2365|      0|                job->max_j = (j + 1U) * step_j; /* this can overflow */
 2366|      0|                if (j == (num_jobs - 1U)) {  /* this will take care of the overflow */
  ------------------
  |  Branch (2366:21): [True: 0, False: 0]
  ------------------
 2367|      0|                    job->max_j = rh;
 2368|      0|                }
 2369|      0|                job->h.mem = (OPJ_INT32*)opj_aligned_32_malloc(h_mem_size);
 2370|      0|                if (!job->h.mem) {
  ------------------
  |  Branch (2370:21): [True: 0, False: 0]
  ------------------
 2371|       |                    /* FIXME event manager error callback */
 2372|      0|                    opj_thread_pool_wait_completion(tp, 0);
 2373|      0|                    opj_free(job);
 2374|      0|                    opj_aligned_free(h.mem);
 2375|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2376|      0|                }
 2377|      0|                opj_thread_pool_submit_job(tp, opj_dwt_decode_h_func, job);
 2378|      0|            }
 2379|      0|            opj_thread_pool_wait_completion(tp, 0);
 2380|      0|        }
 2381|       |
 2382|     82|        v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
 2383|     82|        v.cas = tr->y0 % 2;
 2384|       |
 2385|     82|        if (num_threads <= 1 || rw <= 1) {
  ------------------
  |  Branch (2385:13): [True: 82, False: 0]
  |  Branch (2385:33): [True: 0, False: 0]
  ------------------
 2386|     82|            for (j = 0; j + PARALLEL_COLS_53 <= rw;
  ------------------
  |  |   81|     82|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|     82|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
  |  Branch (2386:25): [True: 0, False: 82]
  ------------------
 2387|     82|                    j += PARALLEL_COLS_53) {
  ------------------
  |  |   81|      0|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|      0|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
 2388|      0|                opj_idwt53_v(&v, &tiledp[j], (OPJ_SIZE_T)w, PARALLEL_COLS_53);
  ------------------
  |  |   81|      0|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|      0|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
 2389|      0|            }
 2390|     82|            if (j < rw) {
  ------------------
  |  Branch (2390:17): [True: 24, False: 58]
  ------------------
 2391|     24|                opj_idwt53_v(&v, &tiledp[j], (OPJ_SIZE_T)w, (OPJ_INT32)(rw - j));
 2392|     24|            }
 2393|     82|        } else {
 2394|      0|            OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
 2395|      0|            OPJ_UINT32 step_j;
 2396|       |
 2397|      0|            if (rw < num_jobs) {
  ------------------
  |  Branch (2397:17): [True: 0, False: 0]
  ------------------
 2398|      0|                num_jobs = rw;
 2399|      0|            }
 2400|      0|            step_j = (rw / num_jobs);
 2401|       |
 2402|      0|            for (j = 0; j < num_jobs; j++) {
  ------------------
  |  Branch (2402:25): [True: 0, False: 0]
  ------------------
 2403|      0|                opj_dwt_decode_v_job_t* job;
 2404|       |
 2405|      0|                job = (opj_dwt_decode_v_job_t*) opj_malloc(sizeof(opj_dwt_decode_v_job_t));
 2406|      0|                if (!job) {
  ------------------
  |  Branch (2406:21): [True: 0, False: 0]
  ------------------
 2407|       |                    /* It would be nice to fallback to single thread case, but */
 2408|       |                    /* unfortunately some jobs may be launched and have modified */
 2409|       |                    /* tiledp, so it is not practical to recover from that error */
 2410|       |                    /* FIXME event manager error callback */
 2411|      0|                    opj_thread_pool_wait_completion(tp, 0);
 2412|      0|                    opj_aligned_free(v.mem);
 2413|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2414|      0|                }
 2415|      0|                job->v = v;
 2416|      0|                job->rh = rh;
 2417|      0|                job->w = w;
 2418|      0|                job->tiledp = tiledp;
 2419|      0|                job->min_j = j * step_j;
 2420|      0|                job->max_j = (j + 1U) * step_j; /* this can overflow */
 2421|      0|                if (j == (num_jobs - 1U)) {  /* this will take care of the overflow */
  ------------------
  |  Branch (2421:21): [True: 0, False: 0]
  ------------------
 2422|      0|                    job->max_j = rw;
 2423|      0|                }
 2424|      0|                job->v.mem = (OPJ_INT32*)opj_aligned_32_malloc(h_mem_size);
 2425|      0|                if (!job->v.mem) {
  ------------------
  |  Branch (2425:21): [True: 0, False: 0]
  ------------------
 2426|       |                    /* FIXME event manager error callback */
 2427|      0|                    opj_thread_pool_wait_completion(tp, 0);
 2428|      0|                    opj_free(job);
 2429|      0|                    opj_aligned_free(v.mem);
 2430|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2431|      0|                }
 2432|      0|                opj_thread_pool_submit_job(tp, opj_dwt_decode_v_func, job);
 2433|      0|            }
 2434|      0|            opj_thread_pool_wait_completion(tp, 0);
 2435|      0|        }
 2436|     82|    }
 2437|      5|    opj_aligned_free(h.mem);
 2438|      5|    return OPJ_TRUE;
  ------------------
  |  |  117|      5|#define OPJ_TRUE 1
  ------------------
 2439|      5|}
dwt.c:opj_idwt53_h:
  670|    785|{
  671|       |#ifdef STANDARD_SLOW_VERSION
  672|       |    /* For documentation purpose */
  673|       |    opj_dwt_interleave_h(dwt, tiledp);
  674|       |    opj_dwt_decode_1(dwt);
  675|       |    memcpy(tiledp, dwt->mem, (OPJ_UINT32)(dwt->sn + dwt->dn) * sizeof(OPJ_INT32));
  676|       |#else
  677|    785|    const OPJ_INT32 sn = dwt->sn;
  678|    785|    const OPJ_INT32 len = sn + dwt->dn;
  679|    785|    if (dwt->cas == 0) { /* Left-most sample is on even coordinate */
  ------------------
  |  Branch (679:9): [True: 713, False: 72]
  ------------------
  680|    713|        if (len > 1) {
  ------------------
  |  Branch (680:13): [True: 2, False: 711]
  ------------------
  681|      2|            opj_idwt53_h_cas0(dwt->mem, sn, len, tiledp);
  682|    711|        } else {
  683|       |            /* Unmodified value */
  684|    711|        }
  685|    713|    } else { /* Left-most sample is on odd coordinate */
  686|     72|        if (len == 1) {
  ------------------
  |  Branch (686:13): [True: 35, False: 37]
  ------------------
  687|     35|            tiledp[0] /= 2;
  688|     37|        } else if (len == 2) {
  ------------------
  |  Branch (688:20): [True: 0, False: 37]
  ------------------
  689|      0|            OPJ_INT32* out = dwt->mem;
  690|      0|            const OPJ_INT32* in_even = &tiledp[sn];
  691|      0|            const OPJ_INT32* in_odd = &tiledp[0];
  692|      0|            out[1] = in_odd[0] - ((in_even[0] + 1) >> 1);
  693|      0|            out[0] = in_even[0] + out[1];
  694|      0|            memcpy(tiledp, dwt->mem, (OPJ_UINT32)len * sizeof(OPJ_INT32));
  695|     37|        } else if (len > 2) {
  ------------------
  |  Branch (695:20): [True: 0, False: 37]
  ------------------
  696|      0|            opj_idwt53_h_cas1(dwt->mem, sn, len, tiledp);
  697|      0|        }
  698|     72|    }
  699|    785|#endif
  700|    785|}
dwt.c:opj_idwt53_h_cas0:
  387|      2|{
  388|      2|    OPJ_INT32 i, j;
  389|      2|    const OPJ_INT32* in_even = &tiledp[0];
  390|      2|    const OPJ_INT32* in_odd = &tiledp[sn];
  391|       |
  392|       |#ifdef TWO_PASS_VERSION
  393|       |    /* For documentation purpose: performs lifting in two iterations, */
  394|       |    /* but without explicit interleaving */
  395|       |
  396|       |    assert(len > 1);
  397|       |
  398|       |    /* Even */
  399|       |    tmp[0] = in_even[0] - ((in_odd[0] + 1) >> 1);
  400|       |    for (i = 2, j = 0; i <= len - 2; i += 2, j++) {
  401|       |        tmp[i] = in_even[j + 1] - ((in_odd[j] + in_odd[j + 1] + 2) >> 2);
  402|       |    }
  403|       |    if (len & 1) { /* if len is odd */
  404|       |        tmp[len - 1] = in_even[(len - 1) / 2] - ((in_odd[(len - 2) / 2] + 1) >> 1);
  405|       |    }
  406|       |
  407|       |    /* Odd */
  408|       |    for (i = 1, j = 0; i < len - 1; i += 2, j++) {
  409|       |        tmp[i] = in_odd[j] + ((tmp[i - 1] + tmp[i + 1]) >> 1);
  410|       |    }
  411|       |    if (!(len & 1)) { /* if len is even */
  412|       |        tmp[len - 1] = in_odd[(len - 1) / 2] + tmp[len - 2];
  413|       |    }
  414|       |#else
  415|       |#if defined(__AVX512F__)
  416|       |    OPJ_INT32* out_ptr = tmp;
  417|       |    int32_t prev_even = in_even[0] - ((in_odd[0] + 1) >> 1);
  418|       |
  419|       |    const __m512i permutevar_mask = _mm512_setr_epi32(
  420|       |                                        0x10, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
  421|       |                                        0x0c, 0x0d, 0x0e);
  422|       |    const __m512i store1_perm = _mm512_setr_epi64(0x00, 0x01, 0x08, 0x09, 0x02,
  423|       |                                0x03, 0x0a, 0x0b);
  424|       |    const __m512i store2_perm = _mm512_setr_epi64(0x04, 0x05, 0x0c, 0x0d, 0x06,
  425|       |                                0x07, 0x0e, 0x0f);
  426|       |
  427|       |    const __m512i two = _mm512_set1_epi32(2);
  428|       |
  429|       |    int32_t simd_batch_512 = (len - 2) / 32;
  430|       |    int32_t leftover;
  431|       |
  432|       |    for (i = 0; i < simd_batch_512; i++) {
  433|       |        const __m512i lf_avx2 = _mm512_loadu_si512((__m512i*)(in_even + 1));
  434|       |        const __m512i hf1_avx2 = _mm512_loadu_si512((__m512i*)(in_odd));
  435|       |        const __m512i hf2_avx2 = _mm512_loadu_si512((__m512i*)(in_odd + 1));
  436|       |        int32_t next_even;
  437|       |        __m512i duplicate, even_m1, odd, unpack1, unpack2, store1, store2;
  438|       |
  439|       |        __m512i even = _mm512_add_epi32(hf1_avx2, hf2_avx2);
  440|       |        even = _mm512_add_epi32(even, two);
  441|       |        even = _mm512_srai_epi32(even, 2);
  442|       |        even = _mm512_sub_epi32(lf_avx2, even);
  443|       |
  444|       |        next_even = _mm_extract_epi32(_mm512_extracti32x4_epi32(even, 3), 3);
  445|       |
  446|       |        duplicate = _mm512_set1_epi32(prev_even);
  447|       |        even_m1 = _mm512_permutex2var_epi32(even, permutevar_mask, duplicate);
  448|       |
  449|       |        //out[0] + out[2]
  450|       |        odd = _mm512_add_epi32(even_m1, even);
  451|       |        odd = _mm512_srai_epi32(odd, 1);
  452|       |        odd = _mm512_add_epi32(odd, hf1_avx2);
  453|       |
  454|       |        unpack1 = _mm512_unpacklo_epi32(even_m1, odd);
  455|       |        unpack2 = _mm512_unpackhi_epi32(even_m1, odd);
  456|       |
  457|       |        store1 = _mm512_permutex2var_epi64(unpack1, store1_perm, unpack2);
  458|       |        store2 = _mm512_permutex2var_epi64(unpack1, store2_perm, unpack2);
  459|       |
  460|       |        _mm512_storeu_si512(out_ptr, store1);
  461|       |        _mm512_storeu_si512(out_ptr + 16, store2);
  462|       |
  463|       |        prev_even = next_even;
  464|       |
  465|       |        out_ptr += 32;
  466|       |        in_even += 16;
  467|       |        in_odd += 16;
  468|       |    }
  469|       |
  470|       |    leftover = len - simd_batch_512 * 32;
  471|       |    if (leftover > 8) {
  472|       |        leftover -= 8 * loop_short_sse(leftover, &in_even, &in_odd, &out_ptr,
  473|       |                                       &prev_even);
  474|       |    }
  475|       |    out_ptr[0] = prev_even;
  476|       |
  477|       |    for (j = 1; j < (leftover - 2); j += 2) {
  478|       |        out_ptr[2] = in_even[1] - ((in_odd[0] + (in_odd[1]) + 2) >> 2);
  479|       |        out_ptr[1] = in_odd[0] + ((out_ptr[0] + out_ptr[2]) >> 1);
  480|       |        in_even++;
  481|       |        in_odd++;
  482|       |        out_ptr += 2;
  483|       |    }
  484|       |
  485|       |    if (len & 1) {
  486|       |        out_ptr[2] = in_even[1] - ((in_odd[0] + 1) >> 1);
  487|       |        out_ptr[1] = in_odd[0] + ((out_ptr[0] + out_ptr[2]) >> 1);
  488|       |    } else { //!(len & 1)
  489|       |        out_ptr[1] = in_odd[0] + out_ptr[0];
  490|       |    }
  491|       |#elif  defined(__AVX2__)
  492|       |    OPJ_INT32* out_ptr = tmp;
  493|       |    int32_t prev_even = in_even[0] - ((in_odd[0] + 1) >> 1);
  494|       |
  495|       |    const __m256i reg_permutevar_mask_move_right = _mm256_setr_epi32(0x00, 0x00,
  496|       |            0x01, 0x02, 0x03, 0x04, 0x05, 0x06);
  497|       |    const __m256i two = _mm256_set1_epi32(2);
  498|       |
  499|       |    int32_t simd_batch = (len - 2) / 16;
  500|       |    int32_t next_even;
  501|       |    __m256i even_m1, odd, unpack1_avx2, unpack2_avx2;
  502|       |
  503|       |    for (i = 0; i < simd_batch; i++) {
  504|       |        const __m256i lf_avx2 = _mm256_loadu_si256((__m256i*)(in_even + 1));
  505|       |        const __m256i hf1_avx2 = _mm256_loadu_si256((__m256i*)(in_odd));
  506|       |        const __m256i hf2_avx2 = _mm256_loadu_si256((__m256i*)(in_odd + 1));
  507|       |
  508|       |        __m256i even = _mm256_add_epi32(hf1_avx2, hf2_avx2);
  509|       |        even = _mm256_add_epi32(even, two);
  510|       |        even = _mm256_srai_epi32(even, 2);
  511|       |        even = _mm256_sub_epi32(lf_avx2, even);
  512|       |
  513|       |        next_even = _mm_extract_epi32(_mm256_extracti128_si256(even, 1), 3);
  514|       |        even_m1 = _mm256_permutevar8x32_epi32(even, reg_permutevar_mask_move_right);
  515|       |        even_m1 = _mm256_blend_epi32(even_m1, _mm256_set1_epi32(prev_even), (1 << 0));
  516|       |
  517|       |        //out[0] + out[2]
  518|       |        odd = _mm256_add_epi32(even_m1, even);
  519|       |        odd = _mm256_srai_epi32(odd, 1);
  520|       |        odd = _mm256_add_epi32(odd, hf1_avx2);
  521|       |
  522|       |        unpack1_avx2 = _mm256_unpacklo_epi32(even_m1, odd);
  523|       |        unpack2_avx2 = _mm256_unpackhi_epi32(even_m1, odd);
  524|       |
  525|       |        _mm_storeu_si128((__m128i*)(out_ptr + 0), _mm256_castsi256_si128(unpack1_avx2));
  526|       |        _mm_storeu_si128((__m128i*)(out_ptr + 4), _mm256_castsi256_si128(unpack2_avx2));
  527|       |        _mm_storeu_si128((__m128i*)(out_ptr + 8), _mm256_extracti128_si256(unpack1_avx2,
  528|       |                         0x1));
  529|       |        _mm_storeu_si128((__m128i*)(out_ptr + 12),
  530|       |                         _mm256_extracti128_si256(unpack2_avx2, 0x1));
  531|       |
  532|       |        prev_even = next_even;
  533|       |
  534|       |        out_ptr += 16;
  535|       |        in_even += 8;
  536|       |        in_odd += 8;
  537|       |    }
  538|       |    out_ptr[0] = prev_even;
  539|       |    for (j = simd_batch * 16 + 1; j < (len - 2); j += 2) {
  540|       |        out_ptr[2] = in_even[1] - ((in_odd[0] + in_odd[1] + 2) >> 2);
  541|       |        out_ptr[1] = in_odd[0] + ((out_ptr[0] + out_ptr[2]) >> 1);
  542|       |        in_even++;
  543|       |        in_odd++;
  544|       |        out_ptr += 2;
  545|       |    }
  546|       |
  547|       |    if (len & 1) {
  548|       |        out_ptr[2] = in_even[1] - ((in_odd[0] + 1) >> 1);
  549|       |        out_ptr[1] = in_odd[0] + ((out_ptr[0] + out_ptr[2]) >> 1);
  550|       |    } else { //!(len & 1)
  551|       |        out_ptr[1] = in_odd[0] + out_ptr[0];
  552|       |    }
  553|       |#else
  554|      2|    OPJ_INT32 d1c, d1n, s1n, s0c, s0n;
  555|       |
  556|      2|    assert(len > 1);
  557|       |
  558|       |    /* Improved version of the TWO_PASS_VERSION: */
  559|       |    /* Performs lifting in one single iteration. Saves memory */
  560|       |    /* accesses and explicit interleaving. */
  561|      2|    s1n = in_even[0];
  562|      2|    d1n = in_odd[0];
  563|      2|    s0n = s1n - ((d1n + 1) >> 1);
  564|       |
  565|      2|    for (i = 0, j = 1; i < (len - 3); i += 2, j++) {
  ------------------
  |  Branch (565:24): [True: 0, False: 2]
  ------------------
  566|      0|        d1c = d1n;
  567|      0|        s0c = s0n;
  568|       |
  569|      0|        s1n = in_even[j];
  570|      0|        d1n = in_odd[j];
  571|       |
  572|      0|        s0n = s1n - ((d1c + d1n + 2) >> 2);
  573|       |
  574|      0|        tmp[i  ] = s0c;
  575|      0|        tmp[i + 1] = opj_int_add_no_overflow(d1c, opj_int_add_no_overflow(s0c,
  576|      0|                                             s0n) >> 1);
  577|      0|    }
  578|       |
  579|      2|    tmp[i] = s0n;
  580|       |
  581|      2|    if (len & 1) {
  ------------------
  |  Branch (581:9): [True: 0, False: 2]
  ------------------
  582|      0|        tmp[len - 1] = in_even[(len - 1) / 2] - ((d1n + 1) >> 1);
  583|      0|        tmp[len - 2] = d1n + ((s0n + tmp[len - 1]) >> 1);
  584|      2|    } else {
  585|      2|        tmp[len - 1] = d1n + s0n;
  586|      2|    }
  587|      2|#endif /*(__AVX512F__ || __AVX2__)*/
  588|      2|#endif /*TWO_PASS_VERSION*/
  589|      2|    memcpy(tiledp, tmp, (OPJ_UINT32)len * sizeof(OPJ_INT32));
  590|      2|}
dwt.c:opj_idwt53_v:
 1090|     24|{
 1091|       |#ifdef STANDARD_SLOW_VERSION
 1092|       |    /* For documentation purpose */
 1093|       |    OPJ_INT32 k, c;
 1094|       |    for (c = 0; c < nb_cols; c ++) {
 1095|       |        opj_dwt_interleave_v(dwt, tiledp_col + c, stride);
 1096|       |        opj_dwt_decode_1(dwt);
 1097|       |        for (k = 0; k < dwt->sn + dwt->dn; ++k) {
 1098|       |            tiledp_col[c + k * stride] = dwt->mem[k];
 1099|       |        }
 1100|       |    }
 1101|       |#else
 1102|     24|    const OPJ_INT32 sn = dwt->sn;
 1103|     24|    const OPJ_INT32 len = sn + dwt->dn;
 1104|     24|    if (dwt->cas == 0) {
  ------------------
  |  Branch (1104:9): [True: 20, False: 4]
  ------------------
 1105|       |        /* If len == 1, unmodified value */
 1106|       |
 1107|     20|#if (defined(__SSE2__) || defined(__AVX2__))
 1108|     20|        if (len > 1 && nb_cols == PARALLEL_COLS_53) {
  ------------------
  |  |   81|     13|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|     13|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
  |  Branch (1108:13): [True: 13, False: 7]
  |  Branch (1108:24): [True: 0, False: 13]
  ------------------
 1109|       |            /* Same as below general case, except that thanks to SSE2/AVX2 */
 1110|       |            /* we can efficiently process 8/16 columns in parallel */
 1111|      0|            opj_idwt53_v_cas0_mcols_SSE2_OR_AVX2(dwt->mem, sn, len, tiledp_col, stride);
 1112|      0|            return;
 1113|      0|        }
 1114|     20|#endif
 1115|     20|        if (len > 1) {
  ------------------
  |  Branch (1115:13): [True: 13, False: 7]
  ------------------
 1116|     13|            OPJ_INT32 c;
 1117|     27|            for (c = 0; c < nb_cols; c++, tiledp_col++) {
  ------------------
  |  Branch (1117:25): [True: 14, False: 13]
  ------------------
 1118|     14|                opj_idwt3_v_cas0(dwt->mem, sn, len, tiledp_col, stride);
 1119|     14|            }
 1120|     13|            return;
 1121|     13|        }
 1122|     20|    } else {
 1123|      4|        if (len == 1) {
  ------------------
  |  Branch (1123:13): [True: 0, False: 4]
  ------------------
 1124|      0|            OPJ_INT32 c;
 1125|      0|            for (c = 0; c < nb_cols; c++, tiledp_col++) {
  ------------------
  |  Branch (1125:25): [True: 0, False: 0]
  ------------------
 1126|      0|                tiledp_col[0] /= 2;
 1127|      0|            }
 1128|      0|            return;
 1129|      0|        }
 1130|       |
 1131|      4|        if (len == 2) {
  ------------------
  |  Branch (1131:13): [True: 0, False: 4]
  ------------------
 1132|      0|            OPJ_INT32 c;
 1133|      0|            OPJ_INT32* out = dwt->mem;
 1134|      0|            for (c = 0; c < nb_cols; c++, tiledp_col++) {
  ------------------
  |  Branch (1134:25): [True: 0, False: 0]
  ------------------
 1135|      0|                OPJ_INT32 i;
 1136|      0|                const OPJ_INT32* in_even = &tiledp_col[(OPJ_SIZE_T)sn * stride];
 1137|      0|                const OPJ_INT32* in_odd = &tiledp_col[0];
 1138|       |
 1139|      0|                out[1] = in_odd[0] - ((in_even[0] + 1) >> 1);
 1140|      0|                out[0] = in_even[0] + out[1];
 1141|       |
 1142|      0|                for (i = 0; i < len; ++i) {
  ------------------
  |  Branch (1142:29): [True: 0, False: 0]
  ------------------
 1143|      0|                    tiledp_col[(OPJ_SIZE_T)i * stride] = out[i];
 1144|      0|                }
 1145|      0|            }
 1146|       |
 1147|      0|            return;
 1148|      0|        }
 1149|       |
 1150|      4|#if (defined(__SSE2__) || defined(__AVX2__))
 1151|      4|        if (len > 2 && nb_cols == PARALLEL_COLS_53) {
  ------------------
  |  |   81|      4|#define PARALLEL_COLS_53     (2*VREG_INT_COUNT)
  |  |  ------------------
  |  |  |  |   77|      4|#define VREG_INT_COUNT       4
  |  |  ------------------
  ------------------
  |  Branch (1151:13): [True: 4, False: 0]
  |  Branch (1151:24): [True: 0, False: 4]
  ------------------
 1152|       |            /* Same as below general case, except that thanks to SSE2/AVX2 */
 1153|       |            /* we can efficiently process 8/16 columns in parallel */
 1154|      0|            opj_idwt53_v_cas1_mcols_SSE2_OR_AVX2(dwt->mem, sn, len, tiledp_col, stride);
 1155|      0|            return;
 1156|      0|        }
 1157|      4|#endif
 1158|      4|        if (len > 2) {
  ------------------
  |  Branch (1158:13): [True: 4, False: 0]
  ------------------
 1159|      4|            OPJ_INT32 c;
 1160|      8|            for (c = 0; c < nb_cols; c++, tiledp_col++) {
  ------------------
  |  Branch (1160:25): [True: 4, False: 4]
  ------------------
 1161|      4|                opj_idwt3_v_cas1(dwt->mem, sn, len, tiledp_col, stride);
 1162|      4|            }
 1163|      4|            return;
 1164|      4|        }
 1165|      4|    }
 1166|     24|#endif
 1167|     24|}
dwt.c:opj_idwt3_v_cas0:
  990|     14|{
  991|     14|    OPJ_INT32 i, j;
  992|     14|    OPJ_INT32 d1c, d1n, s1n, s0c, s0n;
  993|       |
  994|     14|    assert(len > 1);
  995|       |
  996|       |    /* Performs lifting in one single iteration. Saves memory */
  997|       |    /* accesses and explicit interleaving. */
  998|       |
  999|     14|    s1n = tiledp_col[0];
 1000|     14|    d1n = tiledp_col[(OPJ_SIZE_T)sn * stride];
 1001|     14|    s0n = s1n - ((d1n + 1) >> 1);
 1002|       |
 1003|    309|    for (i = 0, j = 0; i < (len - 3); i += 2, j++) {
  ------------------
  |  Branch (1003:24): [True: 295, False: 14]
  ------------------
 1004|    295|        d1c = d1n;
 1005|    295|        s0c = s0n;
 1006|       |
 1007|    295|        s1n = tiledp_col[(OPJ_SIZE_T)(j + 1) * stride];
 1008|    295|        d1n = tiledp_col[(OPJ_SIZE_T)(sn + j + 1) * stride];
 1009|       |
 1010|    295|        s0n = opj_int_sub_no_overflow(s1n,
 1011|    295|                                      opj_int_add_no_overflow(opj_int_add_no_overflow(d1c, d1n), 2) >> 2);
 1012|       |
 1013|    295|        tmp[i  ] = s0c;
 1014|    295|        tmp[i + 1] = opj_int_add_no_overflow(d1c, opj_int_add_no_overflow(s0c,
 1015|    295|                                             s0n) >> 1);
 1016|    295|    }
 1017|       |
 1018|     14|    tmp[i] = s0n;
 1019|       |
 1020|     14|    if (len & 1) {
  ------------------
  |  Branch (1020:9): [True: 5, False: 9]
  ------------------
 1021|      5|        tmp[len - 1] =
 1022|      5|            tiledp_col[(OPJ_SIZE_T)((len - 1) / 2) * stride] -
 1023|      5|            ((d1n + 1) >> 1);
 1024|      5|        tmp[len - 2] = d1n + ((s0n + tmp[len - 1]) >> 1);
 1025|      9|    } else {
 1026|      9|        tmp[len - 1] = d1n + s0n;
 1027|      9|    }
 1028|       |
 1029|    637|    for (i = 0; i < len; ++i) {
  ------------------
  |  Branch (1029:17): [True: 623, False: 14]
  ------------------
 1030|    623|        tiledp_col[(OPJ_SIZE_T)i * stride] = tmp[i];
 1031|    623|    }
 1032|     14|}
dwt.c:opj_idwt3_v_cas1:
 1042|      4|{
 1043|      4|    OPJ_INT32 i, j;
 1044|      4|    OPJ_INT32 s1, s2, dc, dn;
 1045|      4|    const OPJ_INT32* in_even = &tiledp_col[(OPJ_SIZE_T)sn * stride];
 1046|      4|    const OPJ_INT32* in_odd = &tiledp_col[0];
 1047|       |
 1048|      4|    assert(len > 2);
 1049|       |
 1050|       |    /* Performs lifting in one single iteration. Saves memory */
 1051|       |    /* accesses and explicit interleaving. */
 1052|       |
 1053|      4|    s1 = in_even[stride];
 1054|      4|    dc = in_odd[0] - ((in_even[0] + s1 + 2) >> 2);
 1055|      4|    tmp[0] = in_even[0] + dc;
 1056|     56|    for (i = 1, j = 1; i < (len - 2 - !(len & 1)); i += 2, j++) {
  ------------------
  |  Branch (1056:24): [True: 52, False: 4]
  ------------------
 1057|       |
 1058|     52|        s2 = in_even[(OPJ_SIZE_T)(j + 1) * stride];
 1059|       |
 1060|     52|        dn = in_odd[(OPJ_SIZE_T)j * stride] - ((s1 + s2 + 2) >> 2);
 1061|     52|        tmp[i  ] = dc;
 1062|     52|        tmp[i + 1] = s1 + ((dn + dc) >> 1);
 1063|       |
 1064|     52|        dc = dn;
 1065|     52|        s1 = s2;
 1066|     52|    }
 1067|      4|    tmp[i] = dc;
 1068|      4|    if (!(len & 1)) {
  ------------------
  |  Branch (1068:9): [True: 4, False: 0]
  ------------------
 1069|      4|        dn = in_odd[(OPJ_SIZE_T)(len / 2 - 1) * stride] - ((s1 + 1) >> 1);
 1070|      4|        tmp[len - 2] = s1 + ((dn + dc) >> 1);
 1071|      4|        tmp[len - 1] = dn;
 1072|      4|    } else {
 1073|      0|        tmp[len - 1] = s1 + dc;
 1074|      0|    }
 1075|       |
 1076|    124|    for (i = 0; i < len; ++i) {
  ------------------
  |  Branch (1076:17): [True: 120, False: 4]
  ------------------
 1077|    120|        tiledp_col[(OPJ_SIZE_T)i * stride] = tmp[i];
 1078|    120|    }
 1079|      4|}
dwt.c:opj_dwt_decode_partial_tile:
 2834|      3|{
 2835|      3|    opj_sparse_array_int32_t* sa;
 2836|      3|    opj_dwt_t h;
 2837|      3|    opj_dwt_t v;
 2838|      3|    OPJ_UINT32 resno;
 2839|       |    /* This value matches the maximum left/right extension given in tables */
 2840|       |    /* F.2 and F.3 of the standard. */
 2841|      3|    const OPJ_UINT32 filter_width = 2U;
 2842|       |
 2843|      3|    opj_tcd_resolution_t* tr = tilec->resolutions;
 2844|      3|    opj_tcd_resolution_t* tr_max = &(tilec->resolutions[numres - 1]);
 2845|       |
 2846|      3|    OPJ_UINT32 rw = (OPJ_UINT32)(tr->x1 -
 2847|      3|                                 tr->x0);  /* width of the resolution level computed */
 2848|      3|    OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 -
 2849|      3|                                 tr->y0);  /* height of the resolution level computed */
 2850|       |
 2851|      3|    OPJ_SIZE_T h_mem_size;
 2852|       |
 2853|       |    /* Compute the intersection of the area of interest, expressed in tile coordinates */
 2854|       |    /* with the tile coordinates */
 2855|      3|    OPJ_UINT32 win_tcx0 = tilec->win_x0;
 2856|      3|    OPJ_UINT32 win_tcy0 = tilec->win_y0;
 2857|      3|    OPJ_UINT32 win_tcx1 = tilec->win_x1;
 2858|      3|    OPJ_UINT32 win_tcy1 = tilec->win_y1;
 2859|       |
 2860|      3|    if (tr_max->x0 == tr_max->x1 || tr_max->y0 == tr_max->y1) {
  ------------------
  |  Branch (2860:9): [True: 0, False: 3]
  |  Branch (2860:37): [True: 0, False: 3]
  ------------------
 2861|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 2862|      0|    }
 2863|       |
 2864|      3|    sa = opj_dwt_init_sparse_array(tilec, numres);
 2865|      3|    if (sa == NULL) {
  ------------------
  |  Branch (2865:9): [True: 0, False: 3]
  ------------------
 2866|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2867|      0|    }
 2868|       |
 2869|      3|    if (numres == 1U) {
  ------------------
  |  Branch (2869:9): [True: 3, False: 0]
  ------------------
 2870|      3|        OPJ_BOOL ret = opj_sparse_array_int32_read(sa,
 2871|      3|                       tr_max->win_x0 - (OPJ_UINT32)tr_max->x0,
 2872|      3|                       tr_max->win_y0 - (OPJ_UINT32)tr_max->y0,
 2873|      3|                       tr_max->win_x1 - (OPJ_UINT32)tr_max->x0,
 2874|      3|                       tr_max->win_y1 - (OPJ_UINT32)tr_max->y0,
 2875|      3|                       tilec->data_win,
 2876|      3|                       1, tr_max->win_x1 - tr_max->win_x0,
 2877|      3|                       OPJ_TRUE);
  ------------------
  |  |  117|      3|#define OPJ_TRUE 1
  ------------------
 2878|      3|        assert(ret);
 2879|      3|        OPJ_UNUSED(ret);
  ------------------
  |  |  221|      3|#define OPJ_UNUSED(x) (void)x
  ------------------
 2880|      3|        opj_sparse_array_int32_free(sa);
 2881|      3|        return OPJ_TRUE;
  ------------------
  |  |  117|      3|#define OPJ_TRUE 1
  ------------------
 2882|      3|    }
 2883|      0|    h_mem_size = opj_dwt_max_resolution(tr, numres);
 2884|       |    /* overflow check */
 2885|       |    /* in vertical pass, we process 4 columns at a time */
 2886|      0|    if (h_mem_size > (SIZE_MAX / (4 * sizeof(OPJ_INT32)))) {
  ------------------
  |  Branch (2886:9): [True: 0, False: 0]
  ------------------
 2887|       |        /* FIXME event manager error callback */
 2888|      0|        opj_sparse_array_int32_free(sa);
 2889|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2890|      0|    }
 2891|       |
 2892|      0|    h_mem_size *= 4 * sizeof(OPJ_INT32);
 2893|      0|    h.mem = (OPJ_INT32*)opj_aligned_32_malloc(h_mem_size);
 2894|      0|    if (! h.mem) {
  ------------------
  |  Branch (2894:9): [True: 0, False: 0]
  ------------------
 2895|       |        /* FIXME event manager error callback */
 2896|      0|        opj_sparse_array_int32_free(sa);
 2897|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2898|      0|    }
 2899|       |
 2900|      0|    v.mem = h.mem;
 2901|       |
 2902|      0|    for (resno = 1; resno < numres; resno ++) {
  ------------------
  |  Branch (2902:21): [True: 0, False: 0]
  ------------------
 2903|      0|        OPJ_UINT32 i, j;
 2904|       |        /* Window of interest subband-based coordinates */
 2905|      0|        OPJ_UINT32 win_ll_x0, win_ll_y0, win_ll_x1, win_ll_y1;
 2906|      0|        OPJ_UINT32 win_hl_x0, win_hl_x1;
 2907|      0|        OPJ_UINT32 win_lh_y0, win_lh_y1;
 2908|       |        /* Window of interest tile-resolution-based coordinates */
 2909|      0|        OPJ_UINT32 win_tr_x0, win_tr_x1, win_tr_y0, win_tr_y1;
 2910|       |        /* Tile-resolution subband-based coordinates */
 2911|      0|        OPJ_UINT32 tr_ll_x0, tr_ll_y0, tr_hl_x0, tr_lh_y0;
 2912|       |
 2913|      0|        ++tr;
 2914|       |
 2915|      0|        h.sn = (OPJ_INT32)rw;
 2916|      0|        v.sn = (OPJ_INT32)rh;
 2917|       |
 2918|      0|        rw = (OPJ_UINT32)(tr->x1 - tr->x0);
 2919|      0|        rh = (OPJ_UINT32)(tr->y1 - tr->y0);
 2920|       |
 2921|      0|        h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
 2922|      0|        h.cas = tr->x0 % 2;
 2923|       |
 2924|      0|        v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
 2925|      0|        v.cas = tr->y0 % 2;
 2926|       |
 2927|       |        /* Get the subband coordinates for the window of interest */
 2928|       |        /* LL band */
 2929|      0|        opj_dwt_get_band_coordinates(tilec, resno, 0,
 2930|      0|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 2931|      0|                                     &win_ll_x0, &win_ll_y0,
 2932|      0|                                     &win_ll_x1, &win_ll_y1);
 2933|       |
 2934|       |        /* HL band */
 2935|      0|        opj_dwt_get_band_coordinates(tilec, resno, 1,
 2936|      0|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 2937|      0|                                     &win_hl_x0, NULL, &win_hl_x1, NULL);
 2938|       |
 2939|       |        /* LH band */
 2940|      0|        opj_dwt_get_band_coordinates(tilec, resno, 2,
 2941|      0|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 2942|      0|                                     NULL, &win_lh_y0, NULL, &win_lh_y1);
 2943|       |
 2944|       |        /* Beware: band index for non-LL0 resolution are 0=HL, 1=LH and 2=HH */
 2945|      0|        tr_ll_x0 = (OPJ_UINT32)tr->bands[1].x0;
 2946|      0|        tr_ll_y0 = (OPJ_UINT32)tr->bands[0].y0;
 2947|      0|        tr_hl_x0 = (OPJ_UINT32)tr->bands[0].x0;
 2948|      0|        tr_lh_y0 = (OPJ_UINT32)tr->bands[1].y0;
 2949|       |
 2950|       |        /* Subtract the origin of the bands for this tile, to the subwindow */
 2951|       |        /* of interest band coordinates, so as to get them relative to the */
 2952|       |        /* tile */
 2953|      0|        win_ll_x0 = opj_uint_subs(win_ll_x0, tr_ll_x0);
 2954|      0|        win_ll_y0 = opj_uint_subs(win_ll_y0, tr_ll_y0);
 2955|      0|        win_ll_x1 = opj_uint_subs(win_ll_x1, tr_ll_x0);
 2956|      0|        win_ll_y1 = opj_uint_subs(win_ll_y1, tr_ll_y0);
 2957|      0|        win_hl_x0 = opj_uint_subs(win_hl_x0, tr_hl_x0);
 2958|      0|        win_hl_x1 = opj_uint_subs(win_hl_x1, tr_hl_x0);
 2959|      0|        win_lh_y0 = opj_uint_subs(win_lh_y0, tr_lh_y0);
 2960|      0|        win_lh_y1 = opj_uint_subs(win_lh_y1, tr_lh_y0);
 2961|       |
 2962|      0|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)h.sn, &win_ll_x0, &win_ll_x1);
 2963|      0|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)h.dn, &win_hl_x0, &win_hl_x1);
 2964|       |
 2965|      0|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)v.sn, &win_ll_y0, &win_ll_y1);
 2966|      0|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)v.dn, &win_lh_y0, &win_lh_y1);
 2967|       |
 2968|       |        /* Compute the tile-resolution-based coordinates for the window of interest */
 2969|      0|        if (h.cas == 0) {
  ------------------
  |  Branch (2969:13): [True: 0, False: 0]
  ------------------
 2970|      0|            win_tr_x0 = opj_uint_min(2 * win_ll_x0, 2 * win_hl_x0 + 1);
 2971|      0|            win_tr_x1 = opj_uint_min(opj_uint_max(2 * win_ll_x1, 2 * win_hl_x1 + 1), rw);
 2972|      0|        } else {
 2973|      0|            win_tr_x0 = opj_uint_min(2 * win_hl_x0, 2 * win_ll_x0 + 1);
 2974|      0|            win_tr_x1 = opj_uint_min(opj_uint_max(2 * win_hl_x1, 2 * win_ll_x1 + 1), rw);
 2975|      0|        }
 2976|       |
 2977|      0|        if (v.cas == 0) {
  ------------------
  |  Branch (2977:13): [True: 0, False: 0]
  ------------------
 2978|      0|            win_tr_y0 = opj_uint_min(2 * win_ll_y0, 2 * win_lh_y0 + 1);
 2979|      0|            win_tr_y1 = opj_uint_min(opj_uint_max(2 * win_ll_y1, 2 * win_lh_y1 + 1), rh);
 2980|      0|        } else {
 2981|      0|            win_tr_y0 = opj_uint_min(2 * win_lh_y0, 2 * win_ll_y0 + 1);
 2982|      0|            win_tr_y1 = opj_uint_min(opj_uint_max(2 * win_lh_y1, 2 * win_ll_y1 + 1), rh);
 2983|      0|        }
 2984|       |
 2985|      0|        for (j = 0; j < rh; ++j) {
  ------------------
  |  Branch (2985:21): [True: 0, False: 0]
  ------------------
 2986|      0|            if ((j >= win_ll_y0 && j < win_ll_y1) ||
  ------------------
  |  Branch (2986:18): [True: 0, False: 0]
  |  Branch (2986:36): [True: 0, False: 0]
  ------------------
 2987|      0|                    (j >= win_lh_y0 + (OPJ_UINT32)v.sn && j < win_lh_y1 + (OPJ_UINT32)v.sn)) {
  ------------------
  |  Branch (2987:22): [True: 0, False: 0]
  |  Branch (2987:59): [True: 0, False: 0]
  ------------------
 2988|       |
 2989|       |                /* Avoids dwt.c:1584:44 (in opj_dwt_decode_partial_1): runtime error: */
 2990|       |                /* signed integer overflow: -1094795586 + -1094795586 cannot be represented in type 'int' */
 2991|       |                /* on opj_decompress -i  ../../openjpeg/MAPA.jp2 -o out.tif -d 0,0,256,256 */
 2992|       |                /* This is less extreme than memsetting the whole buffer to 0 */
 2993|       |                /* although we could potentially do better with better handling of edge conditions */
 2994|      0|                if (win_tr_x1 >= 1 && win_tr_x1 < rw) {
  ------------------
  |  Branch (2994:21): [True: 0, False: 0]
  |  Branch (2994:39): [True: 0, False: 0]
  ------------------
 2995|      0|                    h.mem[win_tr_x1 - 1] = 0;
 2996|      0|                }
 2997|      0|                if (win_tr_x1 < rw) {
  ------------------
  |  Branch (2997:21): [True: 0, False: 0]
  ------------------
 2998|      0|                    h.mem[win_tr_x1] = 0;
 2999|      0|                }
 3000|       |
 3001|      0|                opj_dwt_interleave_partial_h(h.mem,
 3002|      0|                                             h.cas,
 3003|      0|                                             sa,
 3004|      0|                                             j,
 3005|      0|                                             (OPJ_UINT32)h.sn,
 3006|      0|                                             win_ll_x0,
 3007|      0|                                             win_ll_x1,
 3008|      0|                                             win_hl_x0,
 3009|      0|                                             win_hl_x1);
 3010|      0|                opj_dwt_decode_partial_1(h.mem, h.dn, h.sn, h.cas,
 3011|      0|                                         (OPJ_INT32)win_ll_x0,
 3012|      0|                                         (OPJ_INT32)win_ll_x1,
 3013|      0|                                         (OPJ_INT32)win_hl_x0,
 3014|      0|                                         (OPJ_INT32)win_hl_x1);
 3015|      0|                if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (3015:21): [True: 0, False: 0]
  ------------------
 3016|      0|                                                  win_tr_x0, j,
 3017|      0|                                                  win_tr_x1, j + 1,
 3018|      0|                                                  h.mem + win_tr_x0,
 3019|      0|                                                  1, 0, OPJ_TRUE)) {
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 3020|       |                    /* FIXME event manager error callback */
 3021|      0|                    opj_sparse_array_int32_free(sa);
 3022|      0|                    opj_aligned_free(h.mem);
 3023|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3024|      0|                }
 3025|      0|            }
 3026|      0|        }
 3027|       |
 3028|      0|        for (i = win_tr_x0; i < win_tr_x1;) {
  ------------------
  |  Branch (3028:29): [True: 0, False: 0]
  ------------------
 3029|      0|            OPJ_UINT32 nb_cols = opj_uint_min(4U, win_tr_x1 - i);
 3030|      0|            opj_dwt_interleave_partial_v(v.mem,
 3031|      0|                                         v.cas,
 3032|      0|                                         sa,
 3033|      0|                                         i,
 3034|      0|                                         nb_cols,
 3035|      0|                                         (OPJ_UINT32)v.sn,
 3036|      0|                                         win_ll_y0,
 3037|      0|                                         win_ll_y1,
 3038|      0|                                         win_lh_y0,
 3039|      0|                                         win_lh_y1);
 3040|      0|            opj_dwt_decode_partial_1_parallel(v.mem, nb_cols, v.dn, v.sn, v.cas,
 3041|      0|                                              (OPJ_INT32)win_ll_y0,
 3042|      0|                                              (OPJ_INT32)win_ll_y1,
 3043|      0|                                              (OPJ_INT32)win_lh_y0,
 3044|      0|                                              (OPJ_INT32)win_lh_y1);
 3045|      0|            if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (3045:17): [True: 0, False: 0]
  ------------------
 3046|      0|                                              i, win_tr_y0,
 3047|      0|                                              i + nb_cols, win_tr_y1,
 3048|      0|                                              v.mem + 4 * win_tr_y0,
 3049|      0|                                              1, 4, OPJ_TRUE)) {
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 3050|       |                /* FIXME event manager error callback */
 3051|      0|                opj_sparse_array_int32_free(sa);
 3052|      0|                opj_aligned_free(h.mem);
 3053|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3054|      0|            }
 3055|       |
 3056|      0|            i += nb_cols;
 3057|      0|        }
 3058|      0|    }
 3059|      0|    opj_aligned_free(h.mem);
 3060|       |
 3061|      0|    {
 3062|      0|        OPJ_BOOL ret = opj_sparse_array_int32_read(sa,
 3063|      0|                       tr_max->win_x0 - (OPJ_UINT32)tr_max->x0,
 3064|      0|                       tr_max->win_y0 - (OPJ_UINT32)tr_max->y0,
 3065|      0|                       tr_max->win_x1 - (OPJ_UINT32)tr_max->x0,
 3066|      0|                       tr_max->win_y1 - (OPJ_UINT32)tr_max->y0,
 3067|      0|                       tilec->data_win,
 3068|      0|                       1, tr_max->win_x1 - tr_max->win_x0,
 3069|      0|                       OPJ_TRUE);
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 3070|      0|        assert(ret);
 3071|      0|        OPJ_UNUSED(ret);
  ------------------
  |  |  221|      0|#define OPJ_UNUSED(x) (void)x
  ------------------
 3072|      0|    }
 3073|      0|    opj_sparse_array_int32_free(sa);
 3074|      0|    return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 3075|      0|}
dwt.c:opj_dwt_init_sparse_array:
 2778|     18|{
 2779|     18|    opj_tcd_resolution_t* tr_max = &(tilec->resolutions[numres - 1]);
 2780|     18|    OPJ_UINT32 w = (OPJ_UINT32)(tr_max->x1 - tr_max->x0);
 2781|     18|    OPJ_UINT32 h = (OPJ_UINT32)(tr_max->y1 - tr_max->y0);
 2782|     18|    OPJ_UINT32 resno, bandno, precno, cblkno;
 2783|     18|    opj_sparse_array_int32_t* sa = opj_sparse_array_int32_create(
 2784|     18|                                       w, h, opj_uint_min(w, 64), opj_uint_min(h, 64));
 2785|     18|    if (sa == NULL) {
  ------------------
  |  Branch (2785:9): [True: 0, False: 18]
  ------------------
 2786|      0|        return NULL;
 2787|      0|    }
 2788|       |
 2789|    426|    for (resno = 0; resno < numres; ++resno) {
  ------------------
  |  Branch (2789:21): [True: 408, False: 18]
  ------------------
 2790|    408|        opj_tcd_resolution_t* res = &tilec->resolutions[resno];
 2791|       |
 2792|  1.59k|        for (bandno = 0; bandno < res->numbands; ++bandno) {
  ------------------
  |  Branch (2792:26): [True: 1.18k, False: 408]
  ------------------
 2793|  1.18k|            opj_tcd_band_t* band = &res->bands[bandno];
 2794|       |
 2795|  1.42k|            for (precno = 0; precno < res->pw * res->ph; ++precno) {
  ------------------
  |  Branch (2795:30): [True: 240, False: 1.18k]
  ------------------
 2796|    240|                opj_tcd_precinct_t* precinct = &band->precincts[precno];
 2797|  1.48k|                for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) {
  ------------------
  |  Branch (2797:34): [True: 1.24k, False: 240]
  ------------------
 2798|  1.24k|                    opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno];
 2799|  1.24k|                    if (cblk->decoded_data != NULL) {
  ------------------
  |  Branch (2799:25): [True: 1.10k, False: 131]
  ------------------
 2800|  1.10k|                        OPJ_UINT32 x = (OPJ_UINT32)(cblk->x0 - band->x0);
 2801|  1.10k|                        OPJ_UINT32 y = (OPJ_UINT32)(cblk->y0 - band->y0);
 2802|  1.10k|                        OPJ_UINT32 cblk_w = (OPJ_UINT32)(cblk->x1 - cblk->x0);
 2803|  1.10k|                        OPJ_UINT32 cblk_h = (OPJ_UINT32)(cblk->y1 - cblk->y0);
 2804|       |
 2805|  1.10k|                        if (band->bandno & 1) {
  ------------------
  |  Branch (2805:29): [True: 506, False: 603]
  ------------------
 2806|    506|                            opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
 2807|    506|                            x += (OPJ_UINT32)(pres->x1 - pres->x0);
 2808|    506|                        }
 2809|  1.10k|                        if (band->bandno & 2) {
  ------------------
  |  Branch (2809:29): [True: 524, False: 585]
  ------------------
 2810|    524|                            opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
 2811|    524|                            y += (OPJ_UINT32)(pres->y1 - pres->y0);
 2812|    524|                        }
 2813|       |
 2814|  1.10k|                        if (!opj_sparse_array_int32_write(sa, x, y,
  ------------------
  |  Branch (2814:29): [True: 0, False: 1.10k]
  ------------------
 2815|  1.10k|                                                          x + cblk_w, y + cblk_h,
 2816|  1.10k|                                                          cblk->decoded_data,
 2817|  1.10k|                                                          1, cblk_w, OPJ_TRUE)) {
  ------------------
  |  |  117|  1.10k|#define OPJ_TRUE 1
  ------------------
 2818|      0|                            opj_sparse_array_int32_free(sa);
 2819|      0|                            return NULL;
 2820|      0|                        }
 2821|  1.10k|                    }
 2822|  1.24k|                }
 2823|    240|            }
 2824|  1.18k|        }
 2825|    408|    }
 2826|       |
 2827|     18|    return sa;
 2828|     18|}
dwt.c:opj_dwt_get_band_coordinates:
 2733|  1.17k|{
 2734|       |    /* Compute number of decomposition for this band. See table F-1 */
 2735|  1.17k|    OPJ_UINT32 nb = (resno == 0) ?
  ------------------
  |  Branch (2735:21): [True: 0, False: 1.17k]
  ------------------
 2736|      0|                    tilec->numresolutions - 1 :
 2737|  1.17k|                    tilec->numresolutions - resno;
 2738|       |    /* Map above tile-based coordinates to sub-band-based coordinates per */
 2739|       |    /* equation B-15 of the standard */
 2740|  1.17k|    OPJ_UINT32 x0b = bandno & 1;
 2741|  1.17k|    OPJ_UINT32 y0b = bandno >> 1;
 2742|  1.17k|    if (tbx0) {
  ------------------
  |  Branch (2742:9): [True: 780, False: 390]
  ------------------
 2743|    780|        *tbx0 = (nb == 0) ? tcx0 :
  ------------------
  |  Branch (2743:17): [True: 0, False: 780]
  ------------------
 2744|    780|                (tcx0 <= (1U << (nb - 1)) * x0b) ? 0 :
  ------------------
  |  Branch (2744:17): [True: 780, False: 0]
  ------------------
 2745|    780|                opj_uint_ceildivpow2(tcx0 - (1U << (nb - 1)) * x0b, nb);
 2746|    780|    }
 2747|  1.17k|    if (tby0) {
  ------------------
  |  Branch (2747:9): [True: 780, False: 390]
  ------------------
 2748|    780|        *tby0 = (nb == 0) ? tcy0 :
  ------------------
  |  Branch (2748:17): [True: 0, False: 780]
  ------------------
 2749|    780|                (tcy0 <= (1U << (nb - 1)) * y0b) ? 0 :
  ------------------
  |  Branch (2749:17): [True: 300, False: 480]
  ------------------
 2750|    780|                opj_uint_ceildivpow2(tcy0 - (1U << (nb - 1)) * y0b, nb);
 2751|    780|    }
 2752|  1.17k|    if (tbx1) {
  ------------------
  |  Branch (2752:9): [True: 780, False: 390]
  ------------------
 2753|    780|        *tbx1 = (nb == 0) ? tcx1 :
  ------------------
  |  Branch (2753:17): [True: 0, False: 780]
  ------------------
 2754|    780|                (tcx1 <= (1U << (nb - 1)) * x0b) ? 0 :
  ------------------
  |  Branch (2754:17): [True: 348, False: 432]
  ------------------
 2755|    780|                opj_uint_ceildivpow2(tcx1 - (1U << (nb - 1)) * x0b, nb);
 2756|    780|    }
 2757|  1.17k|    if (tby1) {
  ------------------
  |  Branch (2757:9): [True: 780, False: 390]
  ------------------
 2758|    780|        *tby1 = (nb == 0) ? tcy1 :
  ------------------
  |  Branch (2758:17): [True: 0, False: 780]
  ------------------
 2759|    780|                (tcy1 <= (1U << (nb - 1)) * y0b) ? 0 :
  ------------------
  |  Branch (2759:17): [True: 288, False: 492]
  ------------------
 2760|    780|                opj_uint_ceildivpow2(tcy1 - (1U << (nb - 1)) * y0b, nb);
 2761|    780|    }
 2762|  1.17k|}
dwt.c:opj_dwt_segment_grow:
 2768|  1.56k|{
 2769|  1.56k|    *start = opj_uint_subs(*start, filter_width);
 2770|  1.56k|    *end = opj_uint_adds(*end, filter_width);
 2771|  1.56k|    *end = opj_uint_min(*end, max_size);
 2772|  1.56k|}
dwt.c:opj_dwt_decode_tile_97:
 3516|     13|{
 3517|     13|    opj_v8dwt_t h;
 3518|     13|    opj_v8dwt_t v;
 3519|       |
 3520|     13|    opj_tcd_resolution_t* res = tilec->resolutions;
 3521|       |
 3522|     13|    OPJ_UINT32 rw = (OPJ_UINT32)(res->x1 -
 3523|     13|                                 res->x0);    /* width of the resolution level computed */
 3524|     13|    OPJ_UINT32 rh = (OPJ_UINT32)(res->y1 -
 3525|     13|                                 res->y0);    /* height of the resolution level computed */
 3526|       |
 3527|     13|    OPJ_UINT32 w = (OPJ_UINT32)(tilec->resolutions[tilec->minimum_num_resolutions -
 3528|     13|                                                               1].x1 -
 3529|     13|                                tilec->resolutions[tilec->minimum_num_resolutions - 1].x0);
 3530|       |
 3531|     13|    OPJ_SIZE_T l_data_size;
 3532|     13|    const int num_threads = opj_thread_pool_get_thread_count(tp);
 3533|       |
 3534|     13|    if (numres == 1) {
  ------------------
  |  Branch (3534:9): [True: 13, False: 0]
  ------------------
 3535|     13|        return OPJ_TRUE;
  ------------------
  |  |  117|     13|#define OPJ_TRUE 1
  ------------------
 3536|     13|    }
 3537|       |
 3538|      0|    l_data_size = opj_dwt_max_resolution(res, numres);
 3539|       |    /* overflow check */
 3540|      0|    if (l_data_size > (SIZE_MAX / sizeof(opj_v8_t))) {
  ------------------
  |  Branch (3540:9): [True: 0, False: 0]
  ------------------
 3541|       |        /* FIXME event manager error callback */
 3542|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3543|      0|    }
 3544|      0|    h.wavelet = (opj_v8_t*) opj_aligned_malloc(l_data_size * sizeof(opj_v8_t));
 3545|      0|    if (!h.wavelet) {
  ------------------
  |  Branch (3545:9): [True: 0, False: 0]
  ------------------
 3546|       |        /* FIXME event manager error callback */
 3547|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3548|      0|    }
 3549|      0|    v.wavelet = h.wavelet;
 3550|       |
 3551|      0|    while (--numres) {
  ------------------
  |  Branch (3551:12): [True: 0, False: 0]
  ------------------
 3552|      0|        OPJ_FLOAT32 * OPJ_RESTRICT aj = (OPJ_FLOAT32*) tilec->data;
 3553|      0|        OPJ_UINT32 j;
 3554|       |
 3555|      0|        h.sn = (OPJ_INT32)rw;
 3556|      0|        v.sn = (OPJ_INT32)rh;
 3557|       |
 3558|      0|        ++res;
 3559|       |
 3560|      0|        rw = (OPJ_UINT32)(res->x1 -
 3561|      0|                          res->x0);   /* width of the resolution level computed */
 3562|      0|        rh = (OPJ_UINT32)(res->y1 -
 3563|      0|                          res->y0);   /* height of the resolution level computed */
 3564|       |
 3565|      0|        h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
 3566|      0|        h.cas = res->x0 % 2;
 3567|       |
 3568|      0|        h.win_l_x0 = 0;
 3569|      0|        h.win_l_x1 = (OPJ_UINT32)h.sn;
 3570|      0|        h.win_h_x0 = 0;
 3571|      0|        h.win_h_x1 = (OPJ_UINT32)h.dn;
 3572|       |
 3573|      0|        if (num_threads <= 1 || rh < 2 * NB_ELTS_V8) {
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3573:13): [True: 0, False: 0]
  |  Branch (3573:33): [True: 0, False: 0]
  ------------------
 3574|      0|            for (j = 0; j + (NB_ELTS_V8 - 1) < rh; j += NB_ELTS_V8) {
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
                          for (j = 0; j + (NB_ELTS_V8 - 1) < rh; j += NB_ELTS_V8) {
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3574:25): [True: 0, False: 0]
  ------------------
 3575|      0|                OPJ_UINT32 k;
 3576|      0|                opj_v8dwt_interleave_h(&h, aj, w, NB_ELTS_V8);
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3577|      0|                opj_v8dwt_decode(&h);
 3578|       |
 3579|       |                /* To be adapted if NB_ELTS_V8 changes */
 3580|      0|                for (k = 0; k < rw; k++) {
  ------------------
  |  Branch (3580:29): [True: 0, False: 0]
  ------------------
 3581|      0|                    aj[k      ] = h.wavelet[k].f[0];
 3582|      0|                    aj[k + (OPJ_SIZE_T)w  ] = h.wavelet[k].f[1];
 3583|      0|                    aj[k + (OPJ_SIZE_T)w * 2] = h.wavelet[k].f[2];
 3584|      0|                    aj[k + (OPJ_SIZE_T)w * 3] = h.wavelet[k].f[3];
 3585|      0|                }
 3586|      0|                for (k = 0; k < rw; k++) {
  ------------------
  |  Branch (3586:29): [True: 0, False: 0]
  ------------------
 3587|      0|                    aj[k + (OPJ_SIZE_T)w * 4] = h.wavelet[k].f[4];
 3588|      0|                    aj[k + (OPJ_SIZE_T)w * 5] = h.wavelet[k].f[5];
 3589|      0|                    aj[k + (OPJ_SIZE_T)w * 6] = h.wavelet[k].f[6];
 3590|      0|                    aj[k + (OPJ_SIZE_T)w * 7] = h.wavelet[k].f[7];
 3591|      0|                }
 3592|       |
 3593|      0|                aj += w * NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3594|      0|            }
 3595|      0|        } else {
 3596|      0|            OPJ_UINT32 num_jobs = (OPJ_UINT32)num_threads;
 3597|      0|            OPJ_UINT32 step_j;
 3598|       |
 3599|      0|            if ((rh / NB_ELTS_V8) < num_jobs) {
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3599:17): [True: 0, False: 0]
  ------------------
 3600|      0|                num_jobs = rh / NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3601|      0|            }
 3602|      0|            step_j = ((rh / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
                          step_j = ((rh / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3603|      0|            for (j = 0; j < num_jobs; j++) {
  ------------------
  |  Branch (3603:25): [True: 0, False: 0]
  ------------------
 3604|      0|                opj_dwt97_decode_h_job_t* job;
 3605|       |
 3606|      0|                job = (opj_dwt97_decode_h_job_t*) opj_malloc(sizeof(opj_dwt97_decode_h_job_t));
 3607|      0|                if (!job) {
  ------------------
  |  Branch (3607:21): [True: 0, False: 0]
  ------------------
 3608|      0|                    opj_thread_pool_wait_completion(tp, 0);
 3609|      0|                    opj_aligned_free(h.wavelet);
 3610|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3611|      0|                }
 3612|      0|                job->h.wavelet = (opj_v8_t*)opj_aligned_malloc(l_data_size * sizeof(opj_v8_t));
 3613|      0|                if (!job->h.wavelet) {
  ------------------
  |  Branch (3613:21): [True: 0, False: 0]
  ------------------
 3614|      0|                    opj_thread_pool_wait_completion(tp, 0);
 3615|      0|                    opj_free(job);
 3616|      0|                    opj_aligned_free(h.wavelet);
 3617|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3618|      0|                }
 3619|      0|                job->h.dn = h.dn;
 3620|      0|                job->h.sn = h.sn;
 3621|      0|                job->h.cas = h.cas;
 3622|      0|                job->h.win_l_x0 = h.win_l_x0;
 3623|      0|                job->h.win_l_x1 = h.win_l_x1;
 3624|      0|                job->h.win_h_x0 = h.win_h_x0;
 3625|      0|                job->h.win_h_x1 = h.win_h_x1;
 3626|      0|                job->rw = rw;
 3627|      0|                job->w = w;
 3628|      0|                job->aj = aj;
 3629|      0|                job->nb_rows = (j + 1 == num_jobs) ? (rh & (OPJ_UINT32)~
  ------------------
  |  Branch (3629:32): [True: 0, False: 0]
  ------------------
 3630|      0|                                                      (NB_ELTS_V8 - 1)) - j * step_j : step_j;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3631|      0|                aj += w * job->nb_rows;
 3632|      0|                opj_thread_pool_submit_job(tp, opj_dwt97_decode_h_func, job);
 3633|      0|            }
 3634|      0|            opj_thread_pool_wait_completion(tp, 0);
 3635|      0|            j = rh & (OPJ_UINT32)~(NB_ELTS_V8 - 1);
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3636|      0|        }
 3637|       |
 3638|      0|        if (j < rh) {
  ------------------
  |  Branch (3638:13): [True: 0, False: 0]
  ------------------
 3639|      0|            OPJ_UINT32 k;
 3640|      0|            opj_v8dwt_interleave_h(&h, aj, w, rh - j);
 3641|      0|            opj_v8dwt_decode(&h);
 3642|      0|            for (k = 0; k < rw; k++) {
  ------------------
  |  Branch (3642:25): [True: 0, False: 0]
  ------------------
 3643|      0|                OPJ_UINT32 l;
 3644|      0|                for (l = 0; l < rh - j; l++) {
  ------------------
  |  Branch (3644:29): [True: 0, False: 0]
  ------------------
 3645|      0|                    aj[k + (OPJ_SIZE_T)w  * l ] = h.wavelet[k].f[l];
 3646|      0|                }
 3647|      0|            }
 3648|      0|        }
 3649|       |
 3650|      0|        v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
 3651|      0|        v.cas = res->y0 % 2;
 3652|      0|        v.win_l_x0 = 0;
 3653|      0|        v.win_l_x1 = (OPJ_UINT32)v.sn;
 3654|      0|        v.win_h_x0 = 0;
 3655|      0|        v.win_h_x1 = (OPJ_UINT32)v.dn;
 3656|       |
 3657|      0|        aj = (OPJ_FLOAT32*) tilec->data;
 3658|      0|        if (num_threads <= 1 || rw < 2 * NB_ELTS_V8) {
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3658:13): [True: 0, False: 0]
  |  Branch (3658:33): [True: 0, False: 0]
  ------------------
 3659|      0|            for (j = rw; j > (NB_ELTS_V8 - 1); j -= NB_ELTS_V8) {
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
                          for (j = rw; j > (NB_ELTS_V8 - 1); j -= NB_ELTS_V8) {
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3659:26): [True: 0, False: 0]
  ------------------
 3660|      0|                OPJ_UINT32 k;
 3661|       |
 3662|      0|                opj_v8dwt_interleave_v(&v, aj, w, NB_ELTS_V8);
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3663|      0|                opj_v8dwt_decode(&v);
 3664|       |
 3665|      0|                for (k = 0; k < rh; ++k) {
  ------------------
  |  Branch (3665:29): [True: 0, False: 0]
  ------------------
 3666|      0|                    memcpy(&aj[k * (OPJ_SIZE_T)w], &v.wavelet[k], NB_ELTS_V8 * sizeof(OPJ_FLOAT32));
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3667|      0|                }
 3668|      0|                aj += NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3669|      0|            }
 3670|      0|        } else {
 3671|       |            /* "bench_dwt -I" shows that scaling is poor, likely due to RAM
 3672|       |                transfer being the limiting factor. So limit the number of
 3673|       |                threads.
 3674|       |             */
 3675|      0|            OPJ_UINT32 num_jobs = opj_uint_max((OPJ_UINT32)num_threads / 2, 2U);
 3676|      0|            OPJ_UINT32 step_j;
 3677|       |
 3678|      0|            if ((rw / NB_ELTS_V8) < num_jobs) {
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3678:17): [True: 0, False: 0]
  ------------------
 3679|      0|                num_jobs = rw / NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3680|      0|            }
 3681|      0|            step_j = ((rw / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
                          step_j = ((rw / num_jobs) / NB_ELTS_V8) * NB_ELTS_V8;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3682|      0|            for (j = 0; j < num_jobs; j++) {
  ------------------
  |  Branch (3682:25): [True: 0, False: 0]
  ------------------
 3683|      0|                opj_dwt97_decode_v_job_t* job;
 3684|       |
 3685|      0|                job = (opj_dwt97_decode_v_job_t*) opj_malloc(sizeof(opj_dwt97_decode_v_job_t));
 3686|      0|                if (!job) {
  ------------------
  |  Branch (3686:21): [True: 0, False: 0]
  ------------------
 3687|      0|                    opj_thread_pool_wait_completion(tp, 0);
 3688|      0|                    opj_aligned_free(h.wavelet);
 3689|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3690|      0|                }
 3691|      0|                job->v.wavelet = (opj_v8_t*)opj_aligned_malloc(l_data_size * sizeof(opj_v8_t));
 3692|      0|                if (!job->v.wavelet) {
  ------------------
  |  Branch (3692:21): [True: 0, False: 0]
  ------------------
 3693|      0|                    opj_thread_pool_wait_completion(tp, 0);
 3694|      0|                    opj_free(job);
 3695|      0|                    opj_aligned_free(h.wavelet);
 3696|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3697|      0|                }
 3698|      0|                job->v.dn = v.dn;
 3699|      0|                job->v.sn = v.sn;
 3700|      0|                job->v.cas = v.cas;
 3701|      0|                job->v.win_l_x0 = v.win_l_x0;
 3702|      0|                job->v.win_l_x1 = v.win_l_x1;
 3703|      0|                job->v.win_h_x0 = v.win_h_x0;
 3704|      0|                job->v.win_h_x1 = v.win_h_x1;
 3705|      0|                job->rh = rh;
 3706|      0|                job->w = w;
 3707|      0|                job->aj = aj;
 3708|      0|                job->nb_columns = (j + 1 == num_jobs) ? (rw & (OPJ_UINT32)~
  ------------------
  |  Branch (3708:35): [True: 0, False: 0]
  ------------------
 3709|      0|                                  (NB_ELTS_V8 - 1)) - j * step_j : step_j;
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3710|      0|                aj += job->nb_columns;
 3711|      0|                opj_thread_pool_submit_job(tp, opj_dwt97_decode_v_func, job);
 3712|      0|            }
 3713|      0|            opj_thread_pool_wait_completion(tp, 0);
 3714|      0|        }
 3715|       |
 3716|      0|        if (rw & (NB_ELTS_V8 - 1)) {
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3716:13): [True: 0, False: 0]
  ------------------
 3717|      0|            OPJ_UINT32 k;
 3718|       |
 3719|      0|            j = rw & (NB_ELTS_V8 - 1);
  ------------------
  |  |   93|      0|#define NB_ELTS_V8  8
  ------------------
 3720|       |
 3721|      0|            opj_v8dwt_interleave_v(&v, aj, w, j);
 3722|      0|            opj_v8dwt_decode(&v);
 3723|       |
 3724|      0|            for (k = 0; k < rh; ++k) {
  ------------------
  |  Branch (3724:25): [True: 0, False: 0]
  ------------------
 3725|      0|                memcpy(&aj[k * (OPJ_SIZE_T)w], &v.wavelet[k],
 3726|      0|                       (OPJ_SIZE_T)j * sizeof(OPJ_FLOAT32));
 3727|      0|            }
 3728|      0|        }
 3729|      0|    }
 3730|       |
 3731|      0|    opj_aligned_free(h.wavelet);
 3732|      0|    return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 3733|      0|}
dwt.c:opj_v8dwt_decode:
 3354|  1.00k|{
 3355|  1.00k|    OPJ_INT32 a, b;
 3356|       |    /* BUG_WEIRD_TWO_INVK (look for this identifier in tcd.c) */
 3357|       |    /* Historic value for 2 / opj_invK */
 3358|       |    /* Normally, we should use invK, but if we do so, we have failures in the */
 3359|       |    /* conformance test, due to MSE and peak errors significantly higher than */
 3360|       |    /* accepted value */
 3361|       |    /* Due to using two_invK instead of invK, we have to compensate in tcd.c */
 3362|       |    /* the computation of the stepsize for the non LL subbands */
 3363|  1.00k|    const float two_invK = 1.625732422f;
 3364|  1.00k|    if (dwt->cas == 0) {
  ------------------
  |  Branch (3364:9): [True: 683, False: 324]
  ------------------
 3365|    683|        if (!((dwt->dn > 0) || (dwt->sn > 1))) {
  ------------------
  |  Branch (3365:15): [True: 631, False: 52]
  |  Branch (3365:32): [True: 0, False: 52]
  ------------------
 3366|     52|            return;
 3367|     52|        }
 3368|    631|        a = 0;
 3369|    631|        b = 1;
 3370|    631|    } else {
 3371|    324|        if (!((dwt->sn > 0) || (dwt->dn > 1))) {
  ------------------
  |  Branch (3371:15): [True: 12, False: 312]
  |  Branch (3371:32): [True: 0, False: 312]
  ------------------
 3372|    312|            return;
 3373|    312|        }
 3374|     12|        a = 1;
 3375|     12|        b = 0;
 3376|     12|    }
 3377|    643|#ifdef __SSE__
 3378|    643|    opj_v8dwt_decode_step1_sse(dwt->wavelet + a, dwt->win_l_x0, dwt->win_l_x1,
 3379|    643|                               _mm_set1_ps(opj_K));
 3380|    643|    opj_v8dwt_decode_step1_sse(dwt->wavelet + b, dwt->win_h_x0, dwt->win_h_x1,
 3381|    643|                               _mm_set1_ps(two_invK));
 3382|    643|    opj_v8dwt_decode_step2_sse(dwt->wavelet + b, dwt->wavelet + a + 1,
 3383|    643|                               dwt->win_l_x0, dwt->win_l_x1,
 3384|    643|                               (OPJ_UINT32)opj_int_min(dwt->sn, dwt->dn - a),
 3385|    643|                               _mm_set1_ps(-opj_dwt_delta));
 3386|    643|    opj_v8dwt_decode_step2_sse(dwt->wavelet + a, dwt->wavelet + b + 1,
 3387|    643|                               dwt->win_h_x0, dwt->win_h_x1,
 3388|    643|                               (OPJ_UINT32)opj_int_min(dwt->dn, dwt->sn - b),
 3389|    643|                               _mm_set1_ps(-opj_dwt_gamma));
 3390|    643|    opj_v8dwt_decode_step2_sse(dwt->wavelet + b, dwt->wavelet + a + 1,
 3391|    643|                               dwt->win_l_x0, dwt->win_l_x1,
 3392|    643|                               (OPJ_UINT32)opj_int_min(dwt->sn, dwt->dn - a),
 3393|    643|                               _mm_set1_ps(-opj_dwt_beta));
 3394|    643|    opj_v8dwt_decode_step2_sse(dwt->wavelet + a, dwt->wavelet + b + 1,
 3395|    643|                               dwt->win_h_x0, dwt->win_h_x1,
 3396|    643|                               (OPJ_UINT32)opj_int_min(dwt->dn, dwt->sn - b),
 3397|    643|                               _mm_set1_ps(-opj_dwt_alpha));
 3398|       |#else
 3399|       |    opj_v8dwt_decode_step1(dwt->wavelet + a, dwt->win_l_x0, dwt->win_l_x1,
 3400|       |                           opj_K);
 3401|       |    opj_v8dwt_decode_step1(dwt->wavelet + b, dwt->win_h_x0, dwt->win_h_x1,
 3402|       |                           two_invK);
 3403|       |    opj_v8dwt_decode_step2(dwt->wavelet + b, dwt->wavelet + a + 1,
 3404|       |                           dwt->win_l_x0, dwt->win_l_x1,
 3405|       |                           (OPJ_UINT32)opj_int_min(dwt->sn, dwt->dn - a),
 3406|       |                           -opj_dwt_delta);
 3407|       |    opj_v8dwt_decode_step2(dwt->wavelet + a, dwt->wavelet + b + 1,
 3408|       |                           dwt->win_h_x0, dwt->win_h_x1,
 3409|       |                           (OPJ_UINT32)opj_int_min(dwt->dn, dwt->sn - b),
 3410|       |                           -opj_dwt_gamma);
 3411|       |    opj_v8dwt_decode_step2(dwt->wavelet + b, dwt->wavelet + a + 1,
 3412|       |                           dwt->win_l_x0, dwt->win_l_x1,
 3413|       |                           (OPJ_UINT32)opj_int_min(dwt->sn, dwt->dn - a),
 3414|       |                           -opj_dwt_beta);
 3415|       |    opj_v8dwt_decode_step2(dwt->wavelet + a, dwt->wavelet + b + 1,
 3416|       |                           dwt->win_h_x0, dwt->win_h_x1,
 3417|       |                           (OPJ_UINT32)opj_int_min(dwt->dn, dwt->sn - b),
 3418|       |                           -opj_dwt_alpha);
 3419|       |#endif
 3420|    643|}
dwt.c:opj_v8dwt_decode_step1_sse:
 3236|  1.28k|{
 3237|  1.28k|    __m128* OPJ_RESTRICT vw = (__m128*) w;
 3238|  1.28k|    OPJ_UINT32 i = start;
 3239|       |    /* To be adapted if NB_ELTS_V8 changes */
 3240|  1.28k|    vw += 4 * start;
 3241|       |    /* Note: attempt at loop unrolling x2 doesn't help */
 3242|   116k|    for (; i < end; ++i, vw += 4) {
  ------------------
  |  Branch (3242:12): [True: 115k, False: 1.28k]
  ------------------
 3243|   115k|        vw[0] = _mm_mul_ps(vw[0], c);
 3244|   115k|        vw[1] = _mm_mul_ps(vw[1], c);
 3245|   115k|    }
 3246|  1.28k|}
dwt.c:opj_v8dwt_decode_step2_sse:
 3253|  2.57k|{
 3254|  2.57k|    __m128* OPJ_RESTRICT vl = (__m128*) l;
 3255|  2.57k|    __m128* OPJ_RESTRICT vw = (__m128*) w;
 3256|       |    /* To be adapted if NB_ELTS_V8 changes */
 3257|  2.57k|    OPJ_UINT32 i;
 3258|  2.57k|    OPJ_UINT32 imax = opj_uint_min(end, m);
 3259|  2.57k|    if (start == 0) {
  ------------------
  |  Branch (3259:9): [True: 2.57k, False: 0]
  ------------------
 3260|  2.57k|        if (imax >= 1) {
  ------------------
  |  Branch (3260:13): [True: 2.54k, False: 24]
  ------------------
 3261|  2.54k|            vw[-2] = _mm_add_ps(vw[-2], _mm_mul_ps(_mm_add_ps(vl[0], vw[0]), c));
 3262|  2.54k|            vw[-1] = _mm_add_ps(vw[-1], _mm_mul_ps(_mm_add_ps(vl[1], vw[1]), c));
 3263|  2.54k|            vw += 4;
 3264|  2.54k|            start = 1;
 3265|  2.54k|        }
 3266|  2.57k|    } else {
 3267|      0|        vw += start * 4;
 3268|      0|    }
 3269|       |
 3270|  2.57k|    i = start;
 3271|       |    /* Note: attempt at loop unrolling x2 doesn't help */
 3272|   230k|    for (; i < imax; ++i) {
  ------------------
  |  Branch (3272:12): [True: 227k, False: 2.57k]
  ------------------
 3273|   227k|        vw[-2] = _mm_add_ps(vw[-2], _mm_mul_ps(_mm_add_ps(vw[-4], vw[0]), c));
 3274|   227k|        vw[-1] = _mm_add_ps(vw[-1], _mm_mul_ps(_mm_add_ps(vw[-3], vw[1]), c));
 3275|   227k|        vw += 4;
 3276|   227k|    }
 3277|  2.57k|    if (m < end) {
  ------------------
  |  Branch (3277:9): [True: 926, False: 1.64k]
  ------------------
 3278|    926|        assert(m + 1 == end);
 3279|    926|        c = _mm_add_ps(c, c);
 3280|    926|        vw[-2] = _mm_add_ps(vw[-2], _mm_mul_ps(c, vw[-4]));
 3281|    926|        vw[-1] = _mm_add_ps(vw[-1], _mm_mul_ps(c, vw[-3]));
 3282|    926|    }
 3283|  2.57k|}
dwt.c:opj_dwt_decode_partial_97:
 3738|     15|{
 3739|     15|    opj_sparse_array_int32_t* sa;
 3740|     15|    opj_v8dwt_t h;
 3741|     15|    opj_v8dwt_t v;
 3742|     15|    OPJ_UINT32 resno;
 3743|       |    /* This value matches the maximum left/right extension given in tables */
 3744|       |    /* F.2 and F.3 of the standard. Note: in opj_tcd_is_subband_area_of_interest() */
 3745|       |    /* we currently use 3. */
 3746|     15|    const OPJ_UINT32 filter_width = 4U;
 3747|       |
 3748|     15|    opj_tcd_resolution_t* tr = tilec->resolutions;
 3749|     15|    opj_tcd_resolution_t* tr_max = &(tilec->resolutions[numres - 1]);
 3750|       |
 3751|     15|    OPJ_UINT32 rw = (OPJ_UINT32)(tr->x1 -
 3752|     15|                                 tr->x0);    /* width of the resolution level computed */
 3753|     15|    OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 -
 3754|     15|                                 tr->y0);    /* height of the resolution level computed */
 3755|       |
 3756|     15|    OPJ_SIZE_T l_data_size;
 3757|       |
 3758|       |    /* Compute the intersection of the area of interest, expressed in tile coordinates */
 3759|       |    /* with the tile coordinates */
 3760|     15|    OPJ_UINT32 win_tcx0 = tilec->win_x0;
 3761|     15|    OPJ_UINT32 win_tcy0 = tilec->win_y0;
 3762|     15|    OPJ_UINT32 win_tcx1 = tilec->win_x1;
 3763|     15|    OPJ_UINT32 win_tcy1 = tilec->win_y1;
 3764|       |
 3765|     15|    if (tr_max->x0 == tr_max->x1 || tr_max->y0 == tr_max->y1) {
  ------------------
  |  Branch (3765:9): [True: 0, False: 15]
  |  Branch (3765:37): [True: 0, False: 15]
  ------------------
 3766|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 3767|      0|    }
 3768|       |
 3769|     15|    sa = opj_dwt_init_sparse_array(tilec, numres);
 3770|     15|    if (sa == NULL) {
  ------------------
  |  Branch (3770:9): [True: 0, False: 15]
  ------------------
 3771|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3772|      0|    }
 3773|       |
 3774|     15|    if (numres == 1U) {
  ------------------
  |  Branch (3774:9): [True: 0, False: 15]
  ------------------
 3775|      0|        OPJ_BOOL ret = opj_sparse_array_int32_read(sa,
 3776|      0|                       tr_max->win_x0 - (OPJ_UINT32)tr_max->x0,
 3777|      0|                       tr_max->win_y0 - (OPJ_UINT32)tr_max->y0,
 3778|      0|                       tr_max->win_x1 - (OPJ_UINT32)tr_max->x0,
 3779|      0|                       tr_max->win_y1 - (OPJ_UINT32)tr_max->y0,
 3780|      0|                       tilec->data_win,
 3781|      0|                       1, tr_max->win_x1 - tr_max->win_x0,
 3782|      0|                       OPJ_TRUE);
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 3783|      0|        assert(ret);
 3784|      0|        OPJ_UNUSED(ret);
  ------------------
  |  |  221|      0|#define OPJ_UNUSED(x) (void)x
  ------------------
 3785|      0|        opj_sparse_array_int32_free(sa);
 3786|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 3787|      0|    }
 3788|       |
 3789|     15|    l_data_size = opj_dwt_max_resolution(tr, numres);
 3790|       |    /* overflow check */
 3791|     15|    if (l_data_size > (SIZE_MAX / sizeof(opj_v8_t))) {
  ------------------
  |  Branch (3791:9): [True: 0, False: 15]
  ------------------
 3792|       |        /* FIXME event manager error callback */
 3793|      0|        opj_sparse_array_int32_free(sa);
 3794|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3795|      0|    }
 3796|     15|    h.wavelet = (opj_v8_t*) opj_aligned_malloc(l_data_size * sizeof(opj_v8_t));
 3797|     15|    if (!h.wavelet) {
  ------------------
  |  Branch (3797:9): [True: 0, False: 15]
  ------------------
 3798|       |        /* FIXME event manager error callback */
 3799|      0|        opj_sparse_array_int32_free(sa);
 3800|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3801|      0|    }
 3802|     15|    v.wavelet = h.wavelet;
 3803|       |
 3804|    405|    for (resno = 1; resno < numres; resno ++) {
  ------------------
  |  Branch (3804:21): [True: 390, False: 15]
  ------------------
 3805|    390|        OPJ_UINT32 j;
 3806|       |        /* Window of interest subband-based coordinates */
 3807|    390|        OPJ_UINT32 win_ll_x0, win_ll_y0, win_ll_x1, win_ll_y1;
 3808|    390|        OPJ_UINT32 win_hl_x0, win_hl_x1;
 3809|    390|        OPJ_UINT32 win_lh_y0, win_lh_y1;
 3810|       |        /* Window of interest tile-resolution-based coordinates */
 3811|    390|        OPJ_UINT32 win_tr_x0, win_tr_x1, win_tr_y0, win_tr_y1;
 3812|       |        /* Tile-resolution subband-based coordinates */
 3813|    390|        OPJ_UINT32 tr_ll_x0, tr_ll_y0, tr_hl_x0, tr_lh_y0;
 3814|       |
 3815|    390|        ++tr;
 3816|       |
 3817|    390|        h.sn = (OPJ_INT32)rw;
 3818|    390|        v.sn = (OPJ_INT32)rh;
 3819|       |
 3820|    390|        rw = (OPJ_UINT32)(tr->x1 - tr->x0);
 3821|    390|        rh = (OPJ_UINT32)(tr->y1 - tr->y0);
 3822|       |
 3823|    390|        h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
 3824|    390|        h.cas = tr->x0 % 2;
 3825|       |
 3826|    390|        v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
 3827|    390|        v.cas = tr->y0 % 2;
 3828|       |
 3829|       |        /* Get the subband coordinates for the window of interest */
 3830|       |        /* LL band */
 3831|    390|        opj_dwt_get_band_coordinates(tilec, resno, 0,
 3832|    390|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 3833|    390|                                     &win_ll_x0, &win_ll_y0,
 3834|    390|                                     &win_ll_x1, &win_ll_y1);
 3835|       |
 3836|       |        /* HL band */
 3837|    390|        opj_dwt_get_band_coordinates(tilec, resno, 1,
 3838|    390|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 3839|    390|                                     &win_hl_x0, NULL, &win_hl_x1, NULL);
 3840|       |
 3841|       |        /* LH band */
 3842|    390|        opj_dwt_get_band_coordinates(tilec, resno, 2,
 3843|    390|                                     win_tcx0, win_tcy0, win_tcx1, win_tcy1,
 3844|    390|                                     NULL, &win_lh_y0, NULL, &win_lh_y1);
 3845|       |
 3846|       |        /* Beware: band index for non-LL0 resolution are 0=HL, 1=LH and 2=HH */
 3847|    390|        tr_ll_x0 = (OPJ_UINT32)tr->bands[1].x0;
 3848|    390|        tr_ll_y0 = (OPJ_UINT32)tr->bands[0].y0;
 3849|    390|        tr_hl_x0 = (OPJ_UINT32)tr->bands[0].x0;
 3850|    390|        tr_lh_y0 = (OPJ_UINT32)tr->bands[1].y0;
 3851|       |
 3852|       |        /* Subtract the origin of the bands for this tile, to the subwindow */
 3853|       |        /* of interest band coordinates, so as to get them relative to the */
 3854|       |        /* tile */
 3855|    390|        win_ll_x0 = opj_uint_subs(win_ll_x0, tr_ll_x0);
 3856|    390|        win_ll_y0 = opj_uint_subs(win_ll_y0, tr_ll_y0);
 3857|    390|        win_ll_x1 = opj_uint_subs(win_ll_x1, tr_ll_x0);
 3858|    390|        win_ll_y1 = opj_uint_subs(win_ll_y1, tr_ll_y0);
 3859|    390|        win_hl_x0 = opj_uint_subs(win_hl_x0, tr_hl_x0);
 3860|    390|        win_hl_x1 = opj_uint_subs(win_hl_x1, tr_hl_x0);
 3861|    390|        win_lh_y0 = opj_uint_subs(win_lh_y0, tr_lh_y0);
 3862|    390|        win_lh_y1 = opj_uint_subs(win_lh_y1, tr_lh_y0);
 3863|       |
 3864|    390|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)h.sn, &win_ll_x0, &win_ll_x1);
 3865|    390|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)h.dn, &win_hl_x0, &win_hl_x1);
 3866|       |
 3867|    390|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)v.sn, &win_ll_y0, &win_ll_y1);
 3868|    390|        opj_dwt_segment_grow(filter_width, (OPJ_UINT32)v.dn, &win_lh_y0, &win_lh_y1);
 3869|       |
 3870|       |        /* Compute the tile-resolution-based coordinates for the window of interest */
 3871|    390|        if (h.cas == 0) {
  ------------------
  |  Branch (3871:13): [True: 390, False: 0]
  ------------------
 3872|    390|            win_tr_x0 = opj_uint_min(2 * win_ll_x0, 2 * win_hl_x0 + 1);
 3873|    390|            win_tr_x1 = opj_uint_min(opj_uint_max(2 * win_ll_x1, 2 * win_hl_x1 + 1), rw);
 3874|    390|        } else {
 3875|      0|            win_tr_x0 = opj_uint_min(2 * win_hl_x0, 2 * win_ll_x0 + 1);
 3876|      0|            win_tr_x1 = opj_uint_min(opj_uint_max(2 * win_hl_x1, 2 * win_ll_x1 + 1), rw);
 3877|      0|        }
 3878|       |
 3879|    390|        if (v.cas == 0) {
  ------------------
  |  Branch (3879:13): [True: 66, False: 324]
  ------------------
 3880|     66|            win_tr_y0 = opj_uint_min(2 * win_ll_y0, 2 * win_lh_y0 + 1);
 3881|     66|            win_tr_y1 = opj_uint_min(opj_uint_max(2 * win_ll_y1, 2 * win_lh_y1 + 1), rh);
 3882|    324|        } else {
 3883|    324|            win_tr_y0 = opj_uint_min(2 * win_lh_y0, 2 * win_ll_y0 + 1);
 3884|    324|            win_tr_y1 = opj_uint_min(opj_uint_max(2 * win_lh_y1, 2 * win_ll_y1 + 1), rh);
 3885|    324|        }
 3886|       |
 3887|    390|        h.win_l_x0 = win_ll_x0;
 3888|    390|        h.win_l_x1 = win_ll_x1;
 3889|    390|        h.win_h_x0 = win_hl_x0;
 3890|    390|        h.win_h_x1 = win_hl_x1;
 3891|    552|        for (j = 0; j + (NB_ELTS_V8 - 1) < rh; j += NB_ELTS_V8) {
  ------------------
  |  |   93|    552|#define NB_ELTS_V8  8
  ------------------
                      for (j = 0; j + (NB_ELTS_V8 - 1) < rh; j += NB_ELTS_V8) {
  ------------------
  |  |   93|    162|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3891:21): [True: 162, False: 390]
  ------------------
 3892|    162|            if ((j + (NB_ELTS_V8 - 1) >= win_ll_y0 && j < win_ll_y1) ||
  ------------------
  |  |   93|    162|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3892:18): [True: 162, False: 0]
  |  Branch (3892:55): [True: 90, False: 72]
  ------------------
 3893|    162|                    (j + (NB_ELTS_V8 - 1) >= win_lh_y0 + (OPJ_UINT32)v.sn &&
  ------------------
  |  |   93|     72|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3893:22): [True: 72, False: 0]
  ------------------
 3894|    162|                     j < win_lh_y1 + (OPJ_UINT32)v.sn)) {
  ------------------
  |  Branch (3894:22): [True: 72, False: 0]
  ------------------
 3895|    162|                opj_v8dwt_interleave_partial_h(&h, sa, j, opj_uint_min(NB_ELTS_V8, rh - j));
  ------------------
  |  |   93|    162|#define NB_ELTS_V8  8
  ------------------
 3896|    162|                opj_v8dwt_decode(&h);
 3897|    162|                if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (3897:21): [True: 0, False: 162]
  ------------------
 3898|    162|                                                  win_tr_x0, j,
 3899|    162|                                                  win_tr_x1, j + NB_ELTS_V8,
  ------------------
  |  |   93|    162|#define NB_ELTS_V8  8
  ------------------
 3900|    162|                                                  (OPJ_INT32*)&h.wavelet[win_tr_x0].f[0],
 3901|    162|                                                  NB_ELTS_V8, 1, OPJ_TRUE)) {
  ------------------
  |  |   93|    162|#define NB_ELTS_V8  8
  ------------------
                                                                NB_ELTS_V8, 1, OPJ_TRUE)) {
  ------------------
  |  |  117|    162|#define OPJ_TRUE 1
  ------------------
 3902|       |                    /* FIXME event manager error callback */
 3903|      0|                    opj_sparse_array_int32_free(sa);
 3904|      0|                    opj_aligned_free(h.wavelet);
 3905|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3906|      0|                }
 3907|    162|            }
 3908|    162|        }
 3909|       |
 3910|    390|        if (j < rh &&
  ------------------
  |  Branch (3910:13): [True: 78, False: 312]
  ------------------
 3911|    390|                ((j + (NB_ELTS_V8 - 1) >= win_ll_y0 && j < win_ll_y1) ||
  ------------------
  |  |   93|     78|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3911:19): [True: 78, False: 0]
  |  Branch (3911:56): [True: 50, False: 28]
  ------------------
 3912|     78|                 (j + (NB_ELTS_V8 - 1) >= win_lh_y0 + (OPJ_UINT32)v.sn &&
  ------------------
  |  |   93|     28|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3912:19): [True: 28, False: 0]
  ------------------
 3913|     78|                  j < win_lh_y1 + (OPJ_UINT32)v.sn))) {
  ------------------
  |  Branch (3913:19): [True: 28, False: 0]
  ------------------
 3914|     78|            opj_v8dwt_interleave_partial_h(&h, sa, j, rh - j);
 3915|     78|            opj_v8dwt_decode(&h);
 3916|     78|            if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (3916:17): [True: 0, False: 78]
  ------------------
 3917|     78|                                              win_tr_x0, j,
 3918|     78|                                              win_tr_x1, rh,
 3919|     78|                                              (OPJ_INT32*)&h.wavelet[win_tr_x0].f[0],
 3920|     78|                                              NB_ELTS_V8, 1, OPJ_TRUE)) {
  ------------------
  |  |   93|     78|#define NB_ELTS_V8  8
  ------------------
                                                            NB_ELTS_V8, 1, OPJ_TRUE)) {
  ------------------
  |  |  117|     78|#define OPJ_TRUE 1
  ------------------
 3921|       |                /* FIXME event manager error callback */
 3922|      0|                opj_sparse_array_int32_free(sa);
 3923|      0|                opj_aligned_free(h.wavelet);
 3924|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3925|      0|            }
 3926|     78|        }
 3927|       |
 3928|    390|        v.win_l_x0 = win_ll_y0;
 3929|    390|        v.win_l_x1 = win_ll_y1;
 3930|    390|        v.win_h_x0 = win_lh_y0;
 3931|    390|        v.win_h_x1 = win_lh_y1;
 3932|  1.15k|        for (j = win_tr_x0; j < win_tr_x1; j += NB_ELTS_V8) {
  ------------------
  |  |   93|    767|#define NB_ELTS_V8  8
  ------------------
  |  Branch (3932:29): [True: 767, False: 390]
  ------------------
 3933|    767|            OPJ_UINT32 nb_elts = opj_uint_min(NB_ELTS_V8, win_tr_x1 - j);
  ------------------
  |  |   93|    767|#define NB_ELTS_V8  8
  ------------------
 3934|       |
 3935|    767|            opj_v8dwt_interleave_partial_v(&v, sa, j, nb_elts);
 3936|    767|            opj_v8dwt_decode(&v);
 3937|       |
 3938|    767|            if (!opj_sparse_array_int32_write(sa,
  ------------------
  |  Branch (3938:17): [True: 0, False: 767]
  ------------------
 3939|    767|                                              j, win_tr_y0,
 3940|    767|                                              j + nb_elts, win_tr_y1,
 3941|    767|                                              (OPJ_INT32*)&h.wavelet[win_tr_y0].f[0],
 3942|    767|                                              1, NB_ELTS_V8, OPJ_TRUE)) {
  ------------------
  |  |   93|    767|#define NB_ELTS_V8  8
  ------------------
                                                            1, NB_ELTS_V8, OPJ_TRUE)) {
  ------------------
  |  |  117|    767|#define OPJ_TRUE 1
  ------------------
 3943|       |                /* FIXME event manager error callback */
 3944|      0|                opj_sparse_array_int32_free(sa);
 3945|      0|                opj_aligned_free(h.wavelet);
 3946|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3947|      0|            }
 3948|    767|        }
 3949|    390|    }
 3950|       |
 3951|     15|    {
 3952|     15|        OPJ_BOOL ret = opj_sparse_array_int32_read(sa,
 3953|     15|                       tr_max->win_x0 - (OPJ_UINT32)tr_max->x0,
 3954|     15|                       tr_max->win_y0 - (OPJ_UINT32)tr_max->y0,
 3955|     15|                       tr_max->win_x1 - (OPJ_UINT32)tr_max->x0,
 3956|     15|                       tr_max->win_y1 - (OPJ_UINT32)tr_max->y0,
 3957|     15|                       tilec->data_win,
 3958|     15|                       1, tr_max->win_x1 - tr_max->win_x0,
 3959|     15|                       OPJ_TRUE);
  ------------------
  |  |  117|     15|#define OPJ_TRUE 1
  ------------------
 3960|     15|        assert(ret);
 3961|     15|        OPJ_UNUSED(ret);
  ------------------
  |  |  221|     15|#define OPJ_UNUSED(x) (void)x
  ------------------
 3962|     15|    }
 3963|     15|    opj_sparse_array_int32_free(sa);
 3964|       |
 3965|     15|    opj_aligned_free(h.wavelet);
 3966|     15|    return OPJ_TRUE;
  ------------------
  |  |  117|     15|#define OPJ_TRUE 1
  ------------------
 3967|     15|}
dwt.c:opj_v8dwt_interleave_partial_h:
 3165|    240|{
 3166|    240|    OPJ_UINT32 i;
 3167|  1.74k|    for (i = 0; i < remaining_height; i++) {
  ------------------
  |  Branch (3167:17): [True: 1.50k, False: 240]
  ------------------
 3168|  1.50k|        OPJ_BOOL ret;
 3169|  1.50k|        ret = opj_sparse_array_int32_read(sa,
 3170|  1.50k|                                          dwt->win_l_x0, sa_line + i,
 3171|  1.50k|                                          dwt->win_l_x1, sa_line + i + 1,
 3172|       |                                          /* Nasty cast from float* to int32* */
 3173|  1.50k|                                          (OPJ_INT32*)(dwt->wavelet + dwt->cas + 2 * dwt->win_l_x0) + i,
 3174|  1.50k|                                          2 * NB_ELTS_V8, 0, OPJ_TRUE);
  ------------------
  |  |   93|  1.50k|#define NB_ELTS_V8  8
  ------------------
                                                        2 * NB_ELTS_V8, 0, OPJ_TRUE);
  ------------------
  |  |  117|  1.50k|#define OPJ_TRUE 1
  ------------------
 3175|  1.50k|        assert(ret);
 3176|  1.50k|        ret = opj_sparse_array_int32_read(sa,
 3177|  1.50k|                                          (OPJ_UINT32)dwt->sn + dwt->win_h_x0, sa_line + i,
 3178|  1.50k|                                          (OPJ_UINT32)dwt->sn + dwt->win_h_x1, sa_line + i + 1,
 3179|       |                                          /* Nasty cast from float* to int32* */
 3180|  1.50k|                                          (OPJ_INT32*)(dwt->wavelet + 1 - dwt->cas + 2 * dwt->win_h_x0) + i,
 3181|  1.50k|                                          2 * NB_ELTS_V8, 0, OPJ_TRUE);
  ------------------
  |  |   93|  1.50k|#define NB_ELTS_V8  8
  ------------------
                                                        2 * NB_ELTS_V8, 0, OPJ_TRUE);
  ------------------
  |  |  117|  1.50k|#define OPJ_TRUE 1
  ------------------
 3182|  1.50k|        assert(ret);
 3183|  1.50k|        OPJ_UNUSED(ret);
  ------------------
  |  |  221|  1.50k|#define OPJ_UNUSED(x) (void)x
  ------------------
 3184|  1.50k|    }
 3185|    240|}
dwt.c:opj_v8dwt_interleave_partial_v:
 3213|    767|{
 3214|    767|    OPJ_BOOL ret;
 3215|    767|    ret = opj_sparse_array_int32_read(sa,
 3216|    767|                                      sa_col, dwt->win_l_x0,
 3217|    767|                                      sa_col + nb_elts_read, dwt->win_l_x1,
 3218|    767|                                      (OPJ_INT32*)(dwt->wavelet + dwt->cas + 2 * dwt->win_l_x0),
 3219|    767|                                      1, 2 * NB_ELTS_V8, OPJ_TRUE);
  ------------------
  |  |   93|    767|#define NB_ELTS_V8  8
  ------------------
                                                    1, 2 * NB_ELTS_V8, OPJ_TRUE);
  ------------------
  |  |  117|    767|#define OPJ_TRUE 1
  ------------------
 3220|    767|    assert(ret);
 3221|    767|    ret = opj_sparse_array_int32_read(sa,
 3222|    767|                                      sa_col, (OPJ_UINT32)dwt->sn + dwt->win_h_x0,
 3223|    767|                                      sa_col + nb_elts_read, (OPJ_UINT32)dwt->sn + dwt->win_h_x1,
 3224|    767|                                      (OPJ_INT32*)(dwt->wavelet + 1 - dwt->cas + 2 * dwt->win_h_x0),
 3225|    767|                                      1, 2 * NB_ELTS_V8, OPJ_TRUE);
  ------------------
  |  |   93|    767|#define NB_ELTS_V8  8
  ------------------
                                                    1, 2 * NB_ELTS_V8, OPJ_TRUE);
  ------------------
  |  |  117|    767|#define OPJ_TRUE 1
  ------------------
 3226|    767|    assert(ret);
 3227|    767|    OPJ_UNUSED(ret);
  ------------------
  |  |  221|    767|#define OPJ_UNUSED(x) (void)x
  ------------------
 3228|    767|}

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

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

opj_t1_ht_decode_cblk:
 1140|     23|{
 1141|     23|    OPJ_BYTE* cblkdata = NULL;
 1142|     23|    OPJ_UINT8* coded_data;
 1143|     23|    OPJ_UINT32* decoded_data;
 1144|     23|    OPJ_UINT32 zero_bplanes;
 1145|     23|    OPJ_UINT32 num_passes;
 1146|     23|    OPJ_UINT32 lengths1;
 1147|     23|    OPJ_UINT32 lengths2;
 1148|     23|    OPJ_INT32 width;
 1149|     23|    OPJ_INT32 height;
 1150|     23|    OPJ_INT32 stride;
 1151|     23|    OPJ_UINT32 *pflags, *sigma1, *sigma2, *mbr1, *mbr2, *sip, sip_shift;
 1152|     23|    OPJ_UINT32 p;
 1153|     23|    OPJ_UINT32 zero_bplanes_p1;
 1154|     23|    int lcup, scup;
 1155|     23|    dec_mel_t mel;
 1156|     23|    rev_struct_t vlc;
 1157|     23|    frwd_struct_t magsgn;
 1158|     23|    frwd_struct_t sigprop;
 1159|     23|    rev_struct_t magref;
 1160|     23|    OPJ_UINT8 *lsp, *line_state;
 1161|     23|    int run;
 1162|     23|    OPJ_UINT32 vlc_val;              // fetched data from VLC bitstream
 1163|     23|    OPJ_UINT32 qinf[2];
 1164|     23|    OPJ_UINT32 c_q;
 1165|     23|    OPJ_UINT32* sp;
 1166|     23|    OPJ_INT32 x, y; // loop indices
 1167|     23|    OPJ_BOOL stripe_causal = (cblksty & J2K_CCP_CBLKSTY_VSC) != 0;
  ------------------
  |  |   61|     23|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
 1168|     23|    OPJ_UINT32 cblk_len = 0;
 1169|       |
 1170|     23|    (void)(orient);      // stops unused parameter message
 1171|     23|    (void)(check_pterm); // stops unused parameter message
 1172|       |
 1173|       |    // We ignor orient, because the same decoder is used for all subbands
 1174|       |    // We also ignore check_pterm, because I am not sure how it applies
 1175|     23|    if (roishift != 0) {
  ------------------
  |  Branch (1175:9): [True: 0, False: 23]
  ------------------
 1176|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1176:13): [True: 0, False: 0]
  ------------------
 1177|      0|            opj_mutex_lock(p_manager_mutex);
 1178|      0|        }
 1179|      0|        opj_event_msg(p_manager, EVT_ERROR, "We do not support ROI in decoding "
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1180|      0|                      "HT codeblocks\n");
 1181|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1181:13): [True: 0, False: 0]
  ------------------
 1182|      0|            opj_mutex_unlock(p_manager_mutex);
 1183|      0|        }
 1184|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1185|      0|    }
 1186|       |
 1187|     23|    if (!opj_t1_allocate_buffers(
  ------------------
  |  Branch (1187:9): [True: 0, False: 23]
  ------------------
 1188|     23|                t1,
 1189|     23|                (OPJ_UINT32)(cblk->x1 - cblk->x0),
 1190|     23|                (OPJ_UINT32)(cblk->y1 - cblk->y0))) {
 1191|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1192|      0|    }
 1193|       |
 1194|     23|    if (cblk->Mb == 0) {
  ------------------
  |  Branch (1194:9): [True: 21, False: 2]
  ------------------
 1195|     21|        return OPJ_TRUE;
  ------------------
  |  |  117|     21|#define OPJ_TRUE 1
  ------------------
 1196|     21|    }
 1197|       |
 1198|       |    /* numbps = Mb + 1 - zero_bplanes, Mb = Kmax, zero_bplanes = missing_msbs */
 1199|      2|    zero_bplanes = (cblk->Mb + 1) - cblk->numbps;
 1200|       |
 1201|       |    /* Compute whole codeblock length from chunk lengths */
 1202|      2|    cblk_len = 0;
 1203|      2|    {
 1204|      2|        OPJ_UINT32 i;
 1205|  11.3k|        for (i = 0; i < cblk->numchunks; i++) {
  ------------------
  |  Branch (1205:21): [True: 11.3k, False: 2]
  ------------------
 1206|  11.3k|            cblk_len += cblk->chunks[i].len;
 1207|  11.3k|        }
 1208|      2|    }
 1209|       |
 1210|      2|    if (cblk->numchunks > 1 || t1->mustuse_cblkdatabuffer) {
  ------------------
  |  Branch (1210:9): [True: 2, False: 0]
  |  Branch (1210:32): [True: 0, False: 0]
  ------------------
 1211|      2|        OPJ_UINT32 i;
 1212|       |
 1213|       |        /* Allocate temporary memory if needed */
 1214|      2|        if (cblk_len > t1->cblkdatabuffersize) {
  ------------------
  |  Branch (1214:13): [True: 2, False: 0]
  ------------------
 1215|      2|            cblkdata = (OPJ_BYTE*)opj_realloc(
 1216|      2|                           t1->cblkdatabuffer, cblk_len);
 1217|      2|            if (cblkdata == NULL) {
  ------------------
  |  Branch (1217:17): [True: 0, False: 2]
  ------------------
 1218|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1219|      0|            }
 1220|      2|            t1->cblkdatabuffer = cblkdata;
 1221|      2|            t1->cblkdatabuffersize = cblk_len;
 1222|      2|        }
 1223|       |
 1224|       |        /* Concatenate all chunks */
 1225|      2|        cblkdata = t1->cblkdatabuffer;
 1226|      2|        if (cblkdata == NULL) {
  ------------------
  |  Branch (1226:13): [True: 0, False: 2]
  ------------------
 1227|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1228|      0|        }
 1229|      2|        cblk_len = 0;
 1230|  11.3k|        for (i = 0; i < cblk->numchunks; i++) {
  ------------------
  |  Branch (1230:21): [True: 11.3k, False: 2]
  ------------------
 1231|  11.3k|            memcpy(cblkdata + cblk_len, cblk->chunks[i].data, cblk->chunks[i].len);
 1232|  11.3k|            cblk_len += cblk->chunks[i].len;
 1233|  11.3k|        }
 1234|      2|    } else if (cblk->numchunks == 1) {
  ------------------
  |  Branch (1234:16): [True: 0, False: 0]
  ------------------
 1235|      0|        cblkdata = cblk->chunks[0].data;
 1236|      0|    } else {
 1237|       |        /* Not sure if that can happen in practice, but avoid Coverity to */
 1238|       |        /* think we will dereference a null cblkdta pointer */
 1239|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1240|      0|    }
 1241|       |
 1242|       |    // OPJ_BYTE* coded_data is a pointer to bitstream
 1243|      2|    coded_data = cblkdata;
 1244|       |    // OPJ_UINT32* decoded_data is a pointer to decoded codeblock data buf.
 1245|      2|    decoded_data = (OPJ_UINT32*)t1->data;
 1246|       |    // OPJ_UINT32 num_passes is the number of passes: 1 if CUP only, 2 for
 1247|       |    // CUP+SPP, and 3 for CUP+SPP+MRP
 1248|      2|    num_passes = cblk->numsegs > 0 ? cblk->segs[0].real_num_passes : 0;
  ------------------
  |  Branch (1248:18): [True: 2, False: 0]
  ------------------
 1249|      2|    num_passes += cblk->numsegs > 1 ? cblk->segs[1].real_num_passes : 0;
  ------------------
  |  Branch (1249:19): [True: 2, False: 0]
  ------------------
 1250|       |    // OPJ_UINT32 lengths1 is the length of cleanup pass
 1251|      2|    lengths1 = num_passes > 0 ? cblk->segs[0].len : 0;
  ------------------
  |  Branch (1251:16): [True: 2, False: 0]
  ------------------
 1252|       |    // OPJ_UINT32 lengths2 is the length of refinement passes (either SPP only or SPP+MRP)
 1253|      2|    lengths2 = num_passes > 1 ? cblk->segs[1].len : 0;
  ------------------
  |  Branch (1253:16): [True: 2, False: 0]
  ------------------
 1254|       |    // OPJ_INT32 width is the decoded codeblock width
 1255|      2|    width = cblk->x1 - cblk->x0;
 1256|       |    // OPJ_INT32 height is the decoded codeblock height
 1257|      2|    height = cblk->y1 - cblk->y0;
 1258|       |    // OPJ_INT32 stride is the decoded codeblock buffer stride
 1259|      2|    stride = width;
 1260|       |
 1261|       |    /*  sigma1 and sigma2 contains significant (i.e., non-zero) pixel
 1262|       |     *  locations.  The buffers are used interchangeably, because we need
 1263|       |     *  more than 4 rows of significance information at a given time.
 1264|       |     *  Each 32 bits contain significance information for 4 rows of 8
 1265|       |     *  columns each.  If we denote 32 bits by 0xaaaaaaaa, the each "a" is
 1266|       |     *  called a nibble and has significance information for 4 rows.
 1267|       |     *  The least significant nibble has information for the first column,
 1268|       |     *  and so on. The nibble's LSB is for the first row, and so on.
 1269|       |     *  Since, at most, we can have 1024 columns in a quad, we need 128
 1270|       |     *  entries; we added 1 for convenience when propagation of signifcance
 1271|       |     *  goes outside the structure
 1272|       |     *  To work in OpenJPEG these buffers has been expanded to 132.
 1273|       |     */
 1274|       |    // OPJ_UINT32 *pflags, *sigma1, *sigma2, *mbr1, *mbr2, *sip, sip_shift;
 1275|      2|    pflags = (OPJ_UINT32 *)t1->flags;
 1276|      2|    sigma1 = pflags;
 1277|      2|    sigma2 = sigma1 + 132;
 1278|       |    // mbr arrangement is similar to sigma; mbr contains locations
 1279|       |    // that become significant during significance propagation pass
 1280|      2|    mbr1 = sigma2 + 132;
 1281|      2|    mbr2 = mbr1 + 132;
 1282|       |    //a pointer to sigma
 1283|      2|    sip = sigma1;  //pointers to arrays to be used interchangeably
 1284|      2|    sip_shift = 0; //the amount of shift needed for sigma
 1285|       |
 1286|      2|    if (num_passes > 1 && lengths2 == 0) {
  ------------------
  |  Branch (1286:9): [True: 2, False: 0]
  |  Branch (1286:27): [True: 0, False: 2]
  ------------------
 1287|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1287:13): [True: 0, False: 0]
  ------------------
 1288|      0|            opj_mutex_lock(p_manager_mutex);
 1289|      0|        }
 1290|      0|        opj_event_msg(p_manager, EVT_WARNING, "A malformed codeblock that has "
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1291|      0|                      "more than one coding pass, but zero length for "
 1292|      0|                      "2nd and potentially the 3rd pass in an HT codeblock.\n");
 1293|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1293:13): [True: 0, False: 0]
  ------------------
 1294|      0|            opj_mutex_unlock(p_manager_mutex);
 1295|      0|        }
 1296|      0|        num_passes = 1;
 1297|      0|    }
 1298|      2|    if (num_passes > 3) {
  ------------------
  |  Branch (1298:9): [True: 2, False: 0]
  ------------------
 1299|      2|        if (p_manager_mutex) {
  ------------------
  |  Branch (1299:13): [True: 2, False: 0]
  ------------------
 1300|      2|            opj_mutex_lock(p_manager_mutex);
 1301|      2|        }
 1302|      2|        opj_event_msg(p_manager, EVT_ERROR, "We do not support more than 3 "
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1303|      2|                      "coding passes in an HT codeblock; This codeblocks has "
 1304|      2|                      "%d passes.\n", num_passes);
 1305|      2|        if (p_manager_mutex) {
  ------------------
  |  Branch (1305:13): [True: 2, False: 0]
  ------------------
 1306|      2|            opj_mutex_unlock(p_manager_mutex);
 1307|      2|        }
 1308|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 1309|      2|    }
 1310|       |
 1311|      0|    if (cblk->Mb > 30) {
  ------------------
  |  Branch (1311:9): [True: 0, False: 0]
  ------------------
 1312|       |        /* This check is better moved to opj_t2_read_packet_header() in t2.c
 1313|       |           We do not have enough precision to decode any passes
 1314|       |           The design of openjpeg assumes that the bits of a 32-bit integer are
 1315|       |           assigned as follows:
 1316|       |           bit 31 is for sign
 1317|       |           bits 30-1 are for magnitude
 1318|       |           bit 0 is for the center of the quantization bin
 1319|       |           Therefore we can only do values of cblk->Mb <= 30
 1320|       |         */
 1321|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1321:13): [True: 0, False: 0]
  ------------------
 1322|      0|            opj_mutex_lock(p_manager_mutex);
 1323|      0|        }
 1324|      0|        opj_event_msg(p_manager, EVT_ERROR, "32 bits are not enough to "
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1325|      0|                      "decode this codeblock, since the number of "
 1326|      0|                      "bitplane, %d, is larger than 30.\n", cblk->Mb);
 1327|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1327:13): [True: 0, False: 0]
  ------------------
 1328|      0|            opj_mutex_unlock(p_manager_mutex);
 1329|      0|        }
 1330|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1331|      0|    }
 1332|      0|    if (zero_bplanes > cblk->Mb) {
  ------------------
  |  Branch (1332:9): [True: 0, False: 0]
  ------------------
 1333|       |        /* This check is better moved to opj_t2_read_packet_header() in t2.c,
 1334|       |           in the line "l_cblk->numbps = (OPJ_UINT32)l_band->numbps + 1 - i;"
 1335|       |           where i is the zero bitplanes, and should be no larger than cblk->Mb
 1336|       |           We cannot have more zero bitplanes than there are planes. */
 1337|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1337:13): [True: 0, False: 0]
  ------------------
 1338|      0|            opj_mutex_lock(p_manager_mutex);
 1339|      0|        }
 1340|      0|        opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1341|      0|                      "Decoding this codeblock is stopped. There are "
 1342|      0|                      "%d zero bitplanes in %d bitplanes.\n",
 1343|      0|                      zero_bplanes, cblk->Mb);
 1344|       |
 1345|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1345:13): [True: 0, False: 0]
  ------------------
 1346|      0|            opj_mutex_unlock(p_manager_mutex);
 1347|      0|        }
 1348|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1349|      0|    } else if (zero_bplanes == cblk->Mb && num_passes > 1) {
  ------------------
  |  Branch (1349:16): [True: 0, False: 0]
  |  Branch (1349:44): [True: 0, False: 0]
  ------------------
 1350|       |        /* When the number of zero bitplanes is equal to the number of bitplanes,
 1351|       |           only the cleanup pass makes sense*/
 1352|      0|        if (only_cleanup_pass_is_decoded == OPJ_FALSE) {
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  |  Branch (1352:13): [True: 0, False: 0]
  ------------------
 1353|      0|            if (p_manager_mutex) {
  ------------------
  |  Branch (1353:17): [True: 0, False: 0]
  ------------------
 1354|      0|                opj_mutex_lock(p_manager_mutex);
 1355|      0|            }
 1356|       |            /* We have a second check to prevent the possibility of an overrun condition,
 1357|       |               in the very unlikely event of a second thread discovering that
 1358|       |               only_cleanup_pass_is_decoded is false before the first thread changing
 1359|       |               the condition. */
 1360|      0|            if (only_cleanup_pass_is_decoded == OPJ_FALSE) {
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  |  Branch (1360:17): [True: 0, False: 0]
  ------------------
 1361|      0|                only_cleanup_pass_is_decoded = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1362|      0|                opj_event_msg(p_manager, EVT_WARNING, "Malformed HT codeblock. "
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1363|      0|                              "When the number of zero planes bitplanes is "
 1364|      0|                              "equal to the number of bitplanes, only the cleanup "
 1365|      0|                              "pass makes sense, but we have %d passes in this "
 1366|      0|                              "codeblock. Therefore, only the cleanup pass will be "
 1367|      0|                              "decoded. This message will not be displayed again.\n",
 1368|      0|                              num_passes);
 1369|      0|            }
 1370|      0|            if (p_manager_mutex) {
  ------------------
  |  Branch (1370:17): [True: 0, False: 0]
  ------------------
 1371|      0|                opj_mutex_unlock(p_manager_mutex);
 1372|      0|            }
 1373|      0|        }
 1374|      0|        num_passes = 1;
 1375|      0|    }
 1376|       |
 1377|       |    /* OPJ_UINT32 */
 1378|      0|    p = cblk->numbps;
 1379|       |
 1380|       |    // OPJ_UINT32 zero planes plus 1
 1381|      0|    zero_bplanes_p1 = zero_bplanes + 1;
 1382|       |
 1383|      0|    if (lengths1 < 2 || (OPJ_UINT32)lengths1 > cblk_len ||
  ------------------
  |  Branch (1383:9): [True: 0, False: 0]
  |  Branch (1383:25): [True: 0, False: 0]
  ------------------
 1384|      0|            (OPJ_UINT32)(lengths1 + lengths2) > cblk_len) {
  ------------------
  |  Branch (1384:13): [True: 0, False: 0]
  ------------------
 1385|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1385:13): [True: 0, False: 0]
  ------------------
 1386|      0|            opj_mutex_lock(p_manager_mutex);
 1387|      0|        }
 1388|      0|        opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1389|      0|                      "Invalid codeblock length values.\n");
 1390|       |
 1391|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1391:13): [True: 0, False: 0]
  ------------------
 1392|      0|            opj_mutex_unlock(p_manager_mutex);
 1393|      0|        }
 1394|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1395|      0|    }
 1396|       |    // read scup and fix the bytes there
 1397|      0|    lcup = (int)lengths1;  // length of CUP
 1398|       |    //scup is the length of MEL + VLC
 1399|      0|    scup = (((int)coded_data[lcup - 1]) << 4) + (coded_data[lcup - 2] & 0xF);
 1400|      0|    if (scup < 2 || scup > lcup || scup > 4079) { //something is wrong
  ------------------
  |  Branch (1400:9): [True: 0, False: 0]
  |  Branch (1400:21): [True: 0, False: 0]
  |  Branch (1400:36): [True: 0, False: 0]
  ------------------
 1401|       |        /* The standard stipulates 2 <= Scup <= min(Lcup, 4079) */
 1402|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1402:13): [True: 0, False: 0]
  ------------------
 1403|      0|            opj_mutex_lock(p_manager_mutex);
 1404|      0|        }
 1405|      0|        opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1406|      0|                      "One of the following condition is not met: "
 1407|      0|                      "2 <= Scup <= min(Lcup, 4079)\n");
 1408|       |
 1409|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1409:13): [True: 0, False: 0]
  ------------------
 1410|      0|            opj_mutex_unlock(p_manager_mutex);
 1411|      0|        }
 1412|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1413|      0|    }
 1414|       |
 1415|       |    // init structures
 1416|      0|    if (mel_init(&mel, coded_data, lcup, scup) == OPJ_FALSE) {
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  |  Branch (1416:9): [True: 0, False: 0]
  ------------------
 1417|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1417:13): [True: 0, False: 0]
  ------------------
 1418|      0|            opj_mutex_lock(p_manager_mutex);
 1419|      0|        }
 1420|      0|        opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1421|      0|                      "Incorrect MEL segment sequence.\n");
 1422|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (1422:13): [True: 0, False: 0]
  ------------------
 1423|      0|            opj_mutex_unlock(p_manager_mutex);
 1424|      0|        }
 1425|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1426|      0|    }
 1427|      0|    rev_init(&vlc, coded_data, lcup, scup);
 1428|      0|    frwd_init(&magsgn, coded_data, lcup - scup, 0xFF);
 1429|      0|    if (num_passes > 1) { // needs to be tested
  ------------------
  |  Branch (1429:9): [True: 0, False: 0]
  ------------------
 1430|      0|        frwd_init(&sigprop, coded_data + lengths1, (int)lengths2, 0);
 1431|      0|    }
 1432|      0|    if (num_passes > 2) {
  ------------------
  |  Branch (1432:9): [True: 0, False: 0]
  ------------------
 1433|      0|        rev_init_mrp(&magref, coded_data, (int)lengths1, (int)lengths2);
 1434|      0|    }
 1435|       |
 1436|       |    /** State storage
 1437|       |      *  One byte per quad; for 1024 columns, or 512 quads, we need
 1438|       |      *  512 bytes. We are using 2 extra bytes one on the left and one on
 1439|       |      *  the right for convenience.
 1440|       |      *
 1441|       |      *  The MSB bit in each byte is (\sigma^nw | \sigma^n), and the 7 LSBs
 1442|       |      *  contain max(E^nw | E^n)
 1443|       |      */
 1444|       |
 1445|       |    // 514 is enough for a block width of 1024, +2 extra
 1446|       |    // here expanded to 528
 1447|      0|    line_state = (OPJ_UINT8 *)(mbr2 + 132);
 1448|       |
 1449|       |    //initial 2 lines
 1450|       |    /////////////////
 1451|      0|    lsp = line_state;              // point to line state
 1452|      0|    lsp[0] = 0;                    // for initial row of quad, we set to 0
 1453|      0|    run = mel_get_run(&mel);    // decode runs of events from MEL bitstrm
 1454|       |    // data represented as runs of 0 events
 1455|       |    // See mel_decode description
 1456|      0|    qinf[0] = qinf[1] = 0;      // quad info decoded from VLC bitstream
 1457|      0|    c_q = 0;                    // context for quad q
 1458|      0|    sp = decoded_data;          // decoded codeblock samples
 1459|       |    // vlc_val;                 // fetched data from VLC bitstream
 1460|       |
 1461|      0|    for (x = 0; x < width; x += 4) { // one iteration per quad pair
  ------------------
  |  Branch (1461:17): [True: 0, False: 0]
  ------------------
 1462|      0|        OPJ_UINT32 U_q[2]; // u values for the quad pair
 1463|      0|        OPJ_UINT32 uvlc_mode;
 1464|      0|        OPJ_UINT32 consumed_bits;
 1465|      0|        OPJ_UINT32 m_n, v_n;
 1466|      0|        OPJ_UINT32 ms_val;
 1467|      0|        OPJ_UINT32 locs;
 1468|       |
 1469|       |        // decode VLC
 1470|       |        /////////////
 1471|       |
 1472|       |        //first quad
 1473|       |        // Get the head of the VLC bitstream. One fetch is enough for two
 1474|       |        // quads, since the largest VLC code is 7 bits, and maximum number of
 1475|       |        // bits used for u is 8.  Therefore for two quads we need 30 bits
 1476|       |        // (if we include unstuffing, then 32 bits are enough, since we have
 1477|       |        // a maximum of one stuffing per two bytes)
 1478|      0|        vlc_val = rev_fetch(&vlc);
 1479|       |
 1480|       |        //decode VLC using the context c_q and the head of the VLC bitstream
 1481|      0|        qinf[0] = vlc_tbl0[(c_q << 7) | (vlc_val & 0x7F) ];
 1482|       |
 1483|      0|        if (c_q == 0) { // if zero context, we need to use one MEL event
  ------------------
  |  Branch (1483:13): [True: 0, False: 0]
  ------------------
 1484|      0|            run -= 2; //the number of 0 events is multiplied by 2, so subtract 2
 1485|       |
 1486|       |            // Is the run terminated in 1? if so, use decoded VLC code,
 1487|       |            // otherwise, discard decoded data, since we will decoded again
 1488|       |            // using a different context
 1489|      0|            qinf[0] = (run == -1) ? qinf[0] : 0;
  ------------------
  |  Branch (1489:23): [True: 0, False: 0]
  ------------------
 1490|       |
 1491|       |            // is run -1 or -2? this means a run has been consumed
 1492|      0|            if (run < 0) {
  ------------------
  |  Branch (1492:17): [True: 0, False: 0]
  ------------------
 1493|      0|                run = mel_get_run(&mel);    // get another run
 1494|      0|            }
 1495|      0|        }
 1496|       |
 1497|       |        // prepare context for the next quad; eqn. 1 in ITU T.814
 1498|      0|        c_q = ((qinf[0] & 0x10) >> 4) | ((qinf[0] & 0xE0) >> 5);
 1499|       |
 1500|       |        //remove data from vlc stream (0 bits are removed if qinf is not used)
 1501|      0|        vlc_val = rev_advance(&vlc, qinf[0] & 0x7);
 1502|       |
 1503|       |        //update sigma
 1504|       |        // The update depends on the value of x; consider one OPJ_UINT32
 1505|       |        // if x is 0, 8, 16 and so on, then this line update c locations
 1506|       |        //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1507|       |        //                         LSB   c c 0 0 0 0 0 0
 1508|       |        //                               c c 0 0 0 0 0 0
 1509|       |        //                               0 0 0 0 0 0 0 0
 1510|       |        //                               0 0 0 0 0 0 0 0
 1511|       |        // if x is 4, 12, 20, then this line update locations c
 1512|       |        //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1513|       |        //                         LSB   0 0 0 0 c c 0 0
 1514|       |        //                               0 0 0 0 c c 0 0
 1515|       |        //                               0 0 0 0 0 0 0 0
 1516|       |        //                               0 0 0 0 0 0 0 0
 1517|      0|        *sip |= (((qinf[0] & 0x30) >> 4) | ((qinf[0] & 0xC0) >> 2)) << sip_shift;
 1518|       |
 1519|       |        //second quad
 1520|      0|        qinf[1] = 0;
 1521|      0|        if (x + 2 < width) { // do not run if codeblock is narrower
  ------------------
  |  Branch (1521:13): [True: 0, False: 0]
  ------------------
 1522|       |            //decode VLC using the context c_q and the head of the VLC bitstream
 1523|      0|            qinf[1] = vlc_tbl0[(c_q << 7) | (vlc_val & 0x7F)];
 1524|       |
 1525|       |            // if context is zero, use one MEL event
 1526|      0|            if (c_q == 0) { //zero context
  ------------------
  |  Branch (1526:17): [True: 0, False: 0]
  ------------------
 1527|      0|                run -= 2; //subtract 2, since events number if multiplied by 2
 1528|       |
 1529|       |                // if event is 0, discard decoded qinf
 1530|      0|                qinf[1] = (run == -1) ? qinf[1] : 0;
  ------------------
  |  Branch (1530:27): [True: 0, False: 0]
  ------------------
 1531|       |
 1532|      0|                if (run < 0) { // have we consumed all events in a run
  ------------------
  |  Branch (1532:21): [True: 0, False: 0]
  ------------------
 1533|      0|                    run = mel_get_run(&mel);    // if yes, then get another run
 1534|      0|                }
 1535|      0|            }
 1536|       |
 1537|       |            //prepare context for the next quad, eqn. 1 in ITU T.814
 1538|      0|            c_q = ((qinf[1] & 0x10) >> 4) | ((qinf[1] & 0xE0) >> 5);
 1539|       |
 1540|       |            //remove data from vlc stream, if qinf is not used, cwdlen is 0
 1541|      0|            vlc_val = rev_advance(&vlc, qinf[1] & 0x7);
 1542|      0|        }
 1543|       |
 1544|       |        //update sigma
 1545|       |        // The update depends on the value of x; consider one OPJ_UINT32
 1546|       |        // if x is 0, 8, 16 and so on, then this line update c locations
 1547|       |        //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1548|       |        //                         LSB   0 0 c c 0 0 0 0
 1549|       |        //                               0 0 c c 0 0 0 0
 1550|       |        //                               0 0 0 0 0 0 0 0
 1551|       |        //                               0 0 0 0 0 0 0 0
 1552|       |        // if x is 4, 12, 20, then this line update locations c
 1553|       |        //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1554|       |        //                         LSB   0 0 0 0 0 0 c c
 1555|       |        //                               0 0 0 0 0 0 c c
 1556|       |        //                               0 0 0 0 0 0 0 0
 1557|       |        //                               0 0 0 0 0 0 0 0
 1558|      0|        *sip |= (((qinf[1] & 0x30) | ((qinf[1] & 0xC0) << 2))) << (4 + sip_shift);
 1559|       |
 1560|      0|        sip += x & 0x7 ? 1 : 0; // move sigma pointer to next entry
  ------------------
  |  Branch (1560:16): [True: 0, False: 0]
  ------------------
 1561|      0|        sip_shift ^= 0x10;      // increment/decrement sip_shift by 16
 1562|       |
 1563|       |        // retrieve u
 1564|       |        /////////////
 1565|       |
 1566|       |        // uvlc_mode is made up of u_offset bits from the quad pair
 1567|      0|        uvlc_mode = ((qinf[0] & 0x8) >> 3) | ((qinf[1] & 0x8) >> 2);
 1568|      0|        if (uvlc_mode == 3) { // if both u_offset are set, get an event from
  ------------------
  |  Branch (1568:13): [True: 0, False: 0]
  ------------------
 1569|       |            // the MEL run of events
 1570|      0|            run -= 2; //subtract 2, since events number if multiplied by 2
 1571|      0|            uvlc_mode += (run == -1) ? 1 : 0; //increment uvlc_mode if event is 1
  ------------------
  |  Branch (1571:26): [True: 0, False: 0]
  ------------------
 1572|      0|            if (run < 0) { // if run is consumed (run is -1 or -2), get another run
  ------------------
  |  Branch (1572:17): [True: 0, False: 0]
  ------------------
 1573|      0|                run = mel_get_run(&mel);
 1574|      0|            }
 1575|      0|        }
 1576|       |        //decode uvlc_mode to get u for both quads
 1577|      0|        consumed_bits = decode_init_uvlc(vlc_val, uvlc_mode, U_q);
 1578|      0|        if (U_q[0] > zero_bplanes_p1 || U_q[1] > zero_bplanes_p1) {
  ------------------
  |  Branch (1578:13): [True: 0, False: 0]
  |  Branch (1578:41): [True: 0, False: 0]
  ------------------
 1579|      0|            if (p_manager_mutex) {
  ------------------
  |  Branch (1579:17): [True: 0, False: 0]
  ------------------
 1580|      0|                opj_mutex_lock(p_manager_mutex);
 1581|      0|            }
 1582|      0|            opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. Decoding "
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1583|      0|                          "this codeblock is stopped. U_q is larger than zero "
 1584|      0|                          "bitplanes + 1 \n");
 1585|      0|            if (p_manager_mutex) {
  ------------------
  |  Branch (1585:17): [True: 0, False: 0]
  ------------------
 1586|      0|                opj_mutex_unlock(p_manager_mutex);
 1587|      0|            }
 1588|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1589|      0|        }
 1590|       |
 1591|       |        //consume u bits in the VLC code
 1592|      0|        vlc_val = rev_advance(&vlc, consumed_bits);
 1593|       |
 1594|       |        //decode magsgn and update line_state
 1595|       |        /////////////////////////////////////
 1596|       |
 1597|       |        //We obtain a mask for the samples locations that needs evaluation
 1598|      0|        locs = 0xFF;
 1599|      0|        if (x + 4 > width) {
  ------------------
  |  Branch (1599:13): [True: 0, False: 0]
  ------------------
 1600|      0|            locs >>= (x + 4 - width) << 1;    // limits width
 1601|      0|        }
 1602|      0|        locs = height > 1 ? locs : (locs & 0x55);         // limits height
  ------------------
  |  Branch (1602:16): [True: 0, False: 0]
  ------------------
 1603|       |
 1604|      0|        if ((((qinf[0] & 0xF0) >> 4) | (qinf[1] & 0xF0)) & ~locs) {
  ------------------
  |  Branch (1604:13): [True: 0, False: 0]
  ------------------
 1605|      0|            if (p_manager_mutex) {
  ------------------
  |  Branch (1605:17): [True: 0, False: 0]
  ------------------
 1606|      0|                opj_mutex_lock(p_manager_mutex);
 1607|      0|            }
 1608|      0|            opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1609|      0|                          "VLC code produces significant samples outside "
 1610|      0|                          "the codeblock area.\n");
 1611|      0|            if (p_manager_mutex) {
  ------------------
  |  Branch (1611:17): [True: 0, False: 0]
  ------------------
 1612|      0|                opj_mutex_unlock(p_manager_mutex);
 1613|      0|            }
 1614|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1615|      0|        }
 1616|       |
 1617|       |        //first quad, starting at first sample in quad and moving on
 1618|      0|        if (qinf[0] & 0x10) { //is it significant? (sigma_n)
  ------------------
  |  Branch (1618:13): [True: 0, False: 0]
  ------------------
 1619|      0|            OPJ_UINT32 val;
 1620|       |
 1621|      0|            ms_val = frwd_fetch(&magsgn);         //get 32 bits of magsgn data
 1622|      0|            m_n = U_q[0] - ((qinf[0] >> 12) & 1); //evaluate m_n (number of bits
 1623|       |            // to read from bitstream), using EMB e_k
 1624|      0|            frwd_advance(&magsgn, m_n);         //consume m_n
 1625|      0|            val = ms_val << 31;                 //get sign bit
 1626|      0|            v_n = ms_val & ((1U << m_n) - 1);   //keep only m_n bits
 1627|      0|            v_n |= ((qinf[0] & 0x100) >> 8) << m_n;  //add EMB e_1 as MSB
 1628|      0|            v_n |= 1;                                //add center of bin
 1629|       |            //v_n now has 2 * (\mu - 1) + 0.5 with correct sign bit
 1630|       |            //add 2 to make it 2*\mu+0.5, shift it up to missing MSBs
 1631|      0|            sp[0] = val | ((v_n + 2) << (p - 1));
 1632|      0|        } else if (locs & 0x1) { // if this is inside the codeblock, set the
  ------------------
  |  Branch (1632:20): [True: 0, False: 0]
  ------------------
 1633|      0|            sp[0] = 0;           // sample to zero
 1634|      0|        }
 1635|       |
 1636|      0|        if (qinf[0] & 0x20) { //sigma_n
  ------------------
  |  Branch (1636:13): [True: 0, False: 0]
  ------------------
 1637|      0|            OPJ_UINT32 val, t;
 1638|       |
 1639|      0|            ms_val = frwd_fetch(&magsgn);         //get 32 bits
 1640|      0|            m_n = U_q[0] - ((qinf[0] >> 13) & 1); //m_n, uses EMB e_k
 1641|      0|            frwd_advance(&magsgn, m_n);           //consume m_n
 1642|      0|            val = ms_val << 31;                   //get sign bit
 1643|      0|            v_n = ms_val & ((1U << m_n) - 1);     //keep only m_n bits
 1644|      0|            v_n |= ((qinf[0] & 0x200) >> 9) << m_n; //add EMB e_1
 1645|      0|            v_n |= 1;                               //bin center
 1646|       |            //v_n now has 2 * (\mu - 1) + 0.5 with correct sign bit
 1647|       |            //add 2 to make it 2*\mu+0.5, shift it up to missing MSBs
 1648|      0|            sp[stride] = val | ((v_n + 2) << (p - 1));
 1649|       |
 1650|       |            //update line_state: bit 7 (\sigma^N), and E^N
 1651|      0|            t = lsp[0] & 0x7F;       // keep E^NW
 1652|      0|            v_n = 32 - count_leading_zeros(v_n);
 1653|      0|            lsp[0] = (OPJ_UINT8)(0x80 | (t > v_n ? t : v_n)); //max(E^NW, E^N) | s
  ------------------
  |  Branch (1653:42): [True: 0, False: 0]
  ------------------
 1654|      0|        } else if (locs & 0x2) { // if this is inside the codeblock, set the
  ------------------
  |  Branch (1654:20): [True: 0, False: 0]
  ------------------
 1655|      0|            sp[stride] = 0;      // sample to zero
 1656|      0|        }
 1657|       |
 1658|      0|        ++lsp; // move to next quad information
 1659|      0|        ++sp;  // move to next column of samples
 1660|       |
 1661|       |        //this is similar to the above two samples
 1662|      0|        if (qinf[0] & 0x40) {
  ------------------
  |  Branch (1662:13): [True: 0, False: 0]
  ------------------
 1663|      0|            OPJ_UINT32 val;
 1664|       |
 1665|      0|            ms_val = frwd_fetch(&magsgn);
 1666|      0|            m_n = U_q[0] - ((qinf[0] >> 14) & 1);
 1667|      0|            frwd_advance(&magsgn, m_n);
 1668|      0|            val = ms_val << 31;
 1669|      0|            v_n = ms_val & ((1U << m_n) - 1);
 1670|      0|            v_n |= (((qinf[0] & 0x400) >> 10) << m_n);
 1671|      0|            v_n |= 1;
 1672|      0|            sp[0] = val | ((v_n + 2) << (p - 1));
 1673|      0|        } else if (locs & 0x4) {
  ------------------
  |  Branch (1673:20): [True: 0, False: 0]
  ------------------
 1674|      0|            sp[0] = 0;
 1675|      0|        }
 1676|       |
 1677|      0|        lsp[0] = 0;
 1678|      0|        if (qinf[0] & 0x80) {
  ------------------
  |  Branch (1678:13): [True: 0, False: 0]
  ------------------
 1679|      0|            OPJ_UINT32 val;
 1680|      0|            ms_val = frwd_fetch(&magsgn);
 1681|      0|            m_n = U_q[0] - ((qinf[0] >> 15) & 1); //m_n
 1682|      0|            frwd_advance(&magsgn, m_n);
 1683|      0|            val = ms_val << 31;
 1684|      0|            v_n = ms_val & ((1U << m_n) - 1);
 1685|      0|            v_n |= ((qinf[0] & 0x800) >> 11) << m_n;
 1686|      0|            v_n |= 1; //center of bin
 1687|      0|            sp[stride] = val | ((v_n + 2) << (p - 1));
 1688|       |
 1689|       |            //line_state: bit 7 (\sigma^NW), and E^NW for next quad
 1690|      0|            lsp[0] = (OPJ_UINT8)(0x80 | (32 - count_leading_zeros(v_n)));
 1691|      0|        } else if (locs & 0x8) { //if outside set to 0
  ------------------
  |  Branch (1691:20): [True: 0, False: 0]
  ------------------
 1692|      0|            sp[stride] = 0;
 1693|      0|        }
 1694|       |
 1695|      0|        ++sp; //move to next column
 1696|       |
 1697|       |        //second quad
 1698|      0|        if (qinf[1] & 0x10) {
  ------------------
  |  Branch (1698:13): [True: 0, False: 0]
  ------------------
 1699|      0|            OPJ_UINT32 val;
 1700|       |
 1701|      0|            ms_val = frwd_fetch(&magsgn);
 1702|      0|            m_n = U_q[1] - ((qinf[1] >> 12) & 1); //m_n
 1703|      0|            frwd_advance(&magsgn, m_n);
 1704|      0|            val = ms_val << 31;
 1705|      0|            v_n = ms_val & ((1U << m_n) - 1);
 1706|      0|            v_n |= (((qinf[1] & 0x100) >> 8) << m_n);
 1707|      0|            v_n |= 1;
 1708|      0|            sp[0] = val | ((v_n + 2) << (p - 1));
 1709|      0|        } else if (locs & 0x10) {
  ------------------
  |  Branch (1709:20): [True: 0, False: 0]
  ------------------
 1710|      0|            sp[0] = 0;
 1711|      0|        }
 1712|       |
 1713|      0|        if (qinf[1] & 0x20) {
  ------------------
  |  Branch (1713:13): [True: 0, False: 0]
  ------------------
 1714|      0|            OPJ_UINT32 val, t;
 1715|       |
 1716|      0|            ms_val = frwd_fetch(&magsgn);
 1717|      0|            m_n = U_q[1] - ((qinf[1] >> 13) & 1); //m_n
 1718|      0|            frwd_advance(&magsgn, m_n);
 1719|      0|            val = ms_val << 31;
 1720|      0|            v_n = ms_val & ((1U << m_n) - 1);
 1721|      0|            v_n |= (((qinf[1] & 0x200) >> 9) << m_n);
 1722|      0|            v_n |= 1;
 1723|      0|            sp[stride] = val | ((v_n + 2) << (p - 1));
 1724|       |
 1725|       |            //update line_state: bit 7 (\sigma^N), and E^N
 1726|      0|            t = lsp[0] & 0x7F;            //E^NW
 1727|      0|            v_n = 32 - count_leading_zeros(v_n);     //E^N
 1728|      0|            lsp[0] = (OPJ_UINT8)(0x80 | (t > v_n ? t : v_n)); //max(E^NW, E^N) | s
  ------------------
  |  Branch (1728:42): [True: 0, False: 0]
  ------------------
 1729|      0|        } else if (locs & 0x20) {
  ------------------
  |  Branch (1729:20): [True: 0, False: 0]
  ------------------
 1730|      0|            sp[stride] = 0;    //no need to update line_state
 1731|      0|        }
 1732|       |
 1733|      0|        ++lsp; //move line state to next quad
 1734|      0|        ++sp;  //move to next sample
 1735|       |
 1736|      0|        if (qinf[1] & 0x40) {
  ------------------
  |  Branch (1736:13): [True: 0, False: 0]
  ------------------
 1737|      0|            OPJ_UINT32 val;
 1738|       |
 1739|      0|            ms_val = frwd_fetch(&magsgn);
 1740|      0|            m_n = U_q[1] - ((qinf[1] >> 14) & 1); //m_n
 1741|      0|            frwd_advance(&magsgn, m_n);
 1742|      0|            val = ms_val << 31;
 1743|      0|            v_n = ms_val & ((1U << m_n) - 1);
 1744|      0|            v_n |= (((qinf[1] & 0x400) >> 10) << m_n);
 1745|      0|            v_n |= 1;
 1746|      0|            sp[0] = val | ((v_n + 2) << (p - 1));
 1747|      0|        } else if (locs & 0x40) {
  ------------------
  |  Branch (1747:20): [True: 0, False: 0]
  ------------------
 1748|      0|            sp[0] = 0;
 1749|      0|        }
 1750|       |
 1751|      0|        lsp[0] = 0;
 1752|      0|        if (qinf[1] & 0x80) {
  ------------------
  |  Branch (1752:13): [True: 0, False: 0]
  ------------------
 1753|      0|            OPJ_UINT32 val;
 1754|       |
 1755|      0|            ms_val = frwd_fetch(&magsgn);
 1756|      0|            m_n = U_q[1] - ((qinf[1] >> 15) & 1); //m_n
 1757|      0|            frwd_advance(&magsgn, m_n);
 1758|      0|            val = ms_val << 31;
 1759|      0|            v_n = ms_val & ((1U << m_n) - 1);
 1760|      0|            v_n |= (((qinf[1] & 0x800) >> 11) << m_n);
 1761|      0|            v_n |= 1; //center of bin
 1762|      0|            sp[stride] = val | ((v_n + 2) << (p - 1));
 1763|       |
 1764|       |            //line_state: bit 7 (\sigma^NW), and E^NW for next quad
 1765|      0|            lsp[0] = (OPJ_UINT8)(0x80 | (32 - count_leading_zeros(v_n)));
 1766|      0|        } else if (locs & 0x80) {
  ------------------
  |  Branch (1766:20): [True: 0, False: 0]
  ------------------
 1767|      0|            sp[stride] = 0;
 1768|      0|        }
 1769|       |
 1770|      0|        ++sp;
 1771|      0|    }
 1772|       |
 1773|       |    //non-initial lines
 1774|       |    //////////////////////////
 1775|      0|    for (y = 2; y < height; /*done at the end of loop*/) {
  ------------------
  |  Branch (1775:17): [True: 0, False: 0]
  ------------------
 1776|      0|        OPJ_UINT32 *sip;
 1777|      0|        OPJ_UINT8 ls0;
 1778|      0|        OPJ_INT32 x;
 1779|       |
 1780|      0|        sip_shift ^= 0x2;  // shift sigma to the upper half od the nibble
 1781|      0|        sip_shift &= 0xFFFFFFEFU; //move back to 0 (it might have been at 0x10)
 1782|      0|        sip = y & 0x4 ? sigma2 : sigma1; //choose sigma array
  ------------------
  |  Branch (1782:15): [True: 0, False: 0]
  ------------------
 1783|       |
 1784|      0|        lsp = line_state;
 1785|      0|        ls0 = lsp[0];                   // read the line state value
 1786|      0|        lsp[0] = 0;                     // and set it to zero
 1787|      0|        sp = decoded_data + y * stride; // generated samples
 1788|      0|        c_q = 0;                        // context
 1789|      0|        for (x = 0; x < width; x += 4) {
  ------------------
  |  Branch (1789:21): [True: 0, False: 0]
  ------------------
 1790|      0|            OPJ_UINT32 U_q[2];
 1791|      0|            OPJ_UINT32 uvlc_mode, consumed_bits;
 1792|      0|            OPJ_UINT32 m_n, v_n;
 1793|      0|            OPJ_UINT32 ms_val;
 1794|      0|            OPJ_UINT32 locs;
 1795|       |
 1796|       |            // decode vlc
 1797|       |            /////////////
 1798|       |
 1799|       |            //first quad
 1800|       |            // get context, eqn. 2 ITU T.814
 1801|       |            // c_q has \sigma^W | \sigma^SW
 1802|      0|            c_q |= (ls0 >> 7);          //\sigma^NW | \sigma^N
 1803|      0|            c_q |= (lsp[1] >> 5) & 0x4; //\sigma^NE | \sigma^NF
 1804|       |
 1805|       |            //the following is very similar to previous code, so please refer to
 1806|       |            // that
 1807|      0|            vlc_val = rev_fetch(&vlc);
 1808|      0|            qinf[0] = vlc_tbl1[(c_q << 7) | (vlc_val & 0x7F)];
 1809|      0|            if (c_q == 0) { //zero context
  ------------------
  |  Branch (1809:17): [True: 0, False: 0]
  ------------------
 1810|      0|                run -= 2;
 1811|      0|                qinf[0] = (run == -1) ? qinf[0] : 0;
  ------------------
  |  Branch (1811:27): [True: 0, False: 0]
  ------------------
 1812|      0|                if (run < 0) {
  ------------------
  |  Branch (1812:21): [True: 0, False: 0]
  ------------------
 1813|      0|                    run = mel_get_run(&mel);
 1814|      0|                }
 1815|      0|            }
 1816|       |            //prepare context for the next quad, \sigma^W | \sigma^SW
 1817|      0|            c_q = ((qinf[0] & 0x40) >> 5) | ((qinf[0] & 0x80) >> 6);
 1818|       |
 1819|       |            //remove data from vlc stream
 1820|      0|            vlc_val = rev_advance(&vlc, qinf[0] & 0x7);
 1821|       |
 1822|       |            //update sigma
 1823|       |            // The update depends on the value of x and y; consider one OPJ_UINT32
 1824|       |            // if x is 0, 8, 16 and so on, and y is 2, 6, etc., then this
 1825|       |            // line update c locations
 1826|       |            //      nibble (4 bits) number   0 1 2 3 4 5 6 7
 1827|       |            //                         LSB   0 0 0 0 0 0 0 0
 1828|       |            //                               0 0 0 0 0 0 0 0
 1829|       |            //                               c c 0 0 0 0 0 0
 1830|       |            //                               c c 0 0 0 0 0 0
 1831|      0|            *sip |= (((qinf[0] & 0x30) >> 4) | ((qinf[0] & 0xC0) >> 2)) << sip_shift;
 1832|       |
 1833|       |            //second quad
 1834|      0|            qinf[1] = 0;
 1835|      0|            if (x + 2 < width) {
  ------------------
  |  Branch (1835:17): [True: 0, False: 0]
  ------------------
 1836|      0|                c_q |= (lsp[1] >> 7);
 1837|      0|                c_q |= (lsp[2] >> 5) & 0x4;
 1838|      0|                qinf[1] = vlc_tbl1[(c_q << 7) | (vlc_val & 0x7F)];
 1839|      0|                if (c_q == 0) { //zero context
  ------------------
  |  Branch (1839:21): [True: 0, False: 0]
  ------------------
 1840|      0|                    run -= 2;
 1841|      0|                    qinf[1] = (run == -1) ? qinf[1] : 0;
  ------------------
  |  Branch (1841:31): [True: 0, False: 0]
  ------------------
 1842|      0|                    if (run < 0) {
  ------------------
  |  Branch (1842:25): [True: 0, False: 0]
  ------------------
 1843|      0|                        run = mel_get_run(&mel);
 1844|      0|                    }
 1845|      0|                }
 1846|       |                //prepare context for the next quad
 1847|      0|                c_q = ((qinf[1] & 0x40) >> 5) | ((qinf[1] & 0x80) >> 6);
 1848|       |                //remove data from vlc stream
 1849|      0|                vlc_val = rev_advance(&vlc, qinf[1] & 0x7);
 1850|      0|            }
 1851|       |
 1852|       |            //update sigma
 1853|      0|            *sip |= (((qinf[1] & 0x30) | ((qinf[1] & 0xC0) << 2))) << (4 + sip_shift);
 1854|       |
 1855|      0|            sip += x & 0x7 ? 1 : 0;
  ------------------
  |  Branch (1855:20): [True: 0, False: 0]
  ------------------
 1856|      0|            sip_shift ^= 0x10;
 1857|       |
 1858|       |            //retrieve u
 1859|       |            ////////////
 1860|      0|            uvlc_mode = ((qinf[0] & 0x8) >> 3) | ((qinf[1] & 0x8) >> 2);
 1861|      0|            consumed_bits = decode_noninit_uvlc(vlc_val, uvlc_mode, U_q);
 1862|      0|            vlc_val = rev_advance(&vlc, consumed_bits);
 1863|       |
 1864|       |            //calculate E^max and add it to U_q, eqns 5 and 6 in ITU T.814
 1865|      0|            if ((qinf[0] & 0xF0) & ((qinf[0] & 0xF0) - 1)) { // is \gamma_q 1?
  ------------------
  |  Branch (1865:17): [True: 0, False: 0]
  ------------------
 1866|      0|                OPJ_UINT32 E = (ls0 & 0x7Fu);
 1867|      0|                E = E > (lsp[1] & 0x7Fu) ? E : (lsp[1] & 0x7Fu); //max(E, E^NE, E^NF)
  ------------------
  |  Branch (1867:21): [True: 0, False: 0]
  ------------------
 1868|       |                //since U_q already has u_q + 1, we subtract 2 instead of 1
 1869|      0|                U_q[0] += E > 2 ? E - 2 : 0;
  ------------------
  |  Branch (1869:27): [True: 0, False: 0]
  ------------------
 1870|      0|            }
 1871|       |
 1872|      0|            if ((qinf[1] & 0xF0) & ((qinf[1] & 0xF0) - 1)) { //is \gamma_q 1?
  ------------------
  |  Branch (1872:17): [True: 0, False: 0]
  ------------------
 1873|      0|                OPJ_UINT32 E = (lsp[1] & 0x7Fu);
 1874|      0|                E = E > (lsp[2] & 0x7Fu) ? E : (lsp[2] & 0x7Fu); //max(E, E^NE, E^NF)
  ------------------
  |  Branch (1874:21): [True: 0, False: 0]
  ------------------
 1875|       |                //since U_q already has u_q + 1, we subtract 2 instead of 1
 1876|      0|                U_q[1] += E > 2 ? E - 2 : 0;
  ------------------
  |  Branch (1876:27): [True: 0, False: 0]
  ------------------
 1877|      0|            }
 1878|       |
 1879|      0|            if (U_q[0] > zero_bplanes_p1 || U_q[1] > zero_bplanes_p1) {
  ------------------
  |  Branch (1879:17): [True: 0, False: 0]
  |  Branch (1879:45): [True: 0, False: 0]
  ------------------
 1880|      0|                if (p_manager_mutex) {
  ------------------
  |  Branch (1880:21): [True: 0, False: 0]
  ------------------
 1881|      0|                    opj_mutex_lock(p_manager_mutex);
 1882|      0|                }
 1883|      0|                opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1884|      0|                              "Decoding this codeblock is stopped. U_q is"
 1885|      0|                              "larger than bitplanes + 1 \n");
 1886|      0|                if (p_manager_mutex) {
  ------------------
  |  Branch (1886:21): [True: 0, False: 0]
  ------------------
 1887|      0|                    opj_mutex_unlock(p_manager_mutex);
 1888|      0|                }
 1889|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1890|      0|            }
 1891|       |
 1892|      0|            ls0 = lsp[2]; //for next double quad
 1893|      0|            lsp[1] = lsp[2] = 0;
 1894|       |
 1895|       |            //decode magsgn and update line_state
 1896|       |            /////////////////////////////////////
 1897|       |
 1898|       |            //locations where samples need update
 1899|      0|            locs = 0xFF;
 1900|      0|            if (x + 4 > width) {
  ------------------
  |  Branch (1900:17): [True: 0, False: 0]
  ------------------
 1901|      0|                locs >>= (x + 4 - width) << 1;
 1902|      0|            }
 1903|      0|            locs = y + 2 <= height ? locs : (locs & 0x55);
  ------------------
  |  Branch (1903:20): [True: 0, False: 0]
  ------------------
 1904|       |
 1905|      0|            if ((((qinf[0] & 0xF0) >> 4) | (qinf[1] & 0xF0)) & ~locs) {
  ------------------
  |  Branch (1905:17): [True: 0, False: 0]
  ------------------
 1906|      0|                if (p_manager_mutex) {
  ------------------
  |  Branch (1906:21): [True: 0, False: 0]
  ------------------
 1907|      0|                    opj_mutex_lock(p_manager_mutex);
 1908|      0|                }
 1909|      0|                opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1910|      0|                              "VLC code produces significant samples outside "
 1911|      0|                              "the codeblock area.\n");
 1912|      0|                if (p_manager_mutex) {
  ------------------
  |  Branch (1912:21): [True: 0, False: 0]
  ------------------
 1913|      0|                    opj_mutex_unlock(p_manager_mutex);
 1914|      0|                }
 1915|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1916|      0|            }
 1917|       |
 1918|       |
 1919|       |
 1920|      0|            if (qinf[0] & 0x10) { //sigma_n
  ------------------
  |  Branch (1920:17): [True: 0, False: 0]
  ------------------
 1921|      0|                OPJ_UINT32 val;
 1922|       |
 1923|      0|                ms_val = frwd_fetch(&magsgn);
 1924|      0|                m_n = U_q[0] - ((qinf[0] >> 12) & 1); //m_n
 1925|      0|                frwd_advance(&magsgn, m_n);
 1926|      0|                val = ms_val << 31;
 1927|      0|                v_n = ms_val & ((1U << m_n) - 1);
 1928|      0|                v_n |= ((qinf[0] & 0x100) >> 8) << m_n;
 1929|      0|                v_n |= 1; //center of bin
 1930|      0|                sp[0] = val | ((v_n + 2) << (p - 1));
 1931|      0|            } else if (locs & 0x1) {
  ------------------
  |  Branch (1931:24): [True: 0, False: 0]
  ------------------
 1932|      0|                sp[0] = 0;
 1933|      0|            }
 1934|       |
 1935|      0|            if (qinf[0] & 0x20) { //sigma_n
  ------------------
  |  Branch (1935:17): [True: 0, False: 0]
  ------------------
 1936|      0|                OPJ_UINT32 val, t;
 1937|       |
 1938|      0|                ms_val = frwd_fetch(&magsgn);
 1939|      0|                m_n = U_q[0] - ((qinf[0] >> 13) & 1); //m_n
 1940|      0|                frwd_advance(&magsgn, m_n);
 1941|      0|                val = ms_val << 31;
 1942|      0|                v_n = ms_val & ((1U << m_n) - 1);
 1943|      0|                v_n |= ((qinf[0] & 0x200) >> 9) << m_n;
 1944|      0|                v_n |= 1; //center of bin
 1945|      0|                sp[stride] = val | ((v_n + 2) << (p - 1));
 1946|       |
 1947|       |                //update line_state: bit 7 (\sigma^N), and E^N
 1948|      0|                t = lsp[0] & 0x7F;          //E^NW
 1949|      0|                v_n = 32 - count_leading_zeros(v_n);
 1950|      0|                lsp[0] = (OPJ_UINT8)(0x80 | (t > v_n ? t : v_n));
  ------------------
  |  Branch (1950:46): [True: 0, False: 0]
  ------------------
 1951|      0|            } else if (locs & 0x2) {
  ------------------
  |  Branch (1951:24): [True: 0, False: 0]
  ------------------
 1952|      0|                sp[stride] = 0;    //no need to update line_state
 1953|      0|            }
 1954|       |
 1955|      0|            ++lsp;
 1956|      0|            ++sp;
 1957|       |
 1958|      0|            if (qinf[0] & 0x40) { //sigma_n
  ------------------
  |  Branch (1958:17): [True: 0, False: 0]
  ------------------
 1959|      0|                OPJ_UINT32 val;
 1960|       |
 1961|      0|                ms_val = frwd_fetch(&magsgn);
 1962|      0|                m_n = U_q[0] - ((qinf[0] >> 14) & 1); //m_n
 1963|      0|                frwd_advance(&magsgn, m_n);
 1964|      0|                val = ms_val << 31;
 1965|      0|                v_n = ms_val & ((1U << m_n) - 1);
 1966|      0|                v_n |= (((qinf[0] & 0x400) >> 10) << m_n);
 1967|      0|                v_n |= 1;                            //center of bin
 1968|      0|                sp[0] = val | ((v_n + 2) << (p - 1));
 1969|      0|            } else if (locs & 0x4) {
  ------------------
  |  Branch (1969:24): [True: 0, False: 0]
  ------------------
 1970|      0|                sp[0] = 0;
 1971|      0|            }
 1972|       |
 1973|      0|            if (qinf[0] & 0x80) { //sigma_n
  ------------------
  |  Branch (1973:17): [True: 0, False: 0]
  ------------------
 1974|      0|                OPJ_UINT32 val;
 1975|       |
 1976|      0|                ms_val = frwd_fetch(&magsgn);
 1977|      0|                m_n = U_q[0] - ((qinf[0] >> 15) & 1); //m_n
 1978|      0|                frwd_advance(&magsgn, m_n);
 1979|      0|                val = ms_val << 31;
 1980|      0|                v_n = ms_val & ((1U << m_n) - 1);
 1981|      0|                v_n |= ((qinf[0] & 0x800) >> 11) << m_n;
 1982|      0|                v_n |= 1; //center of bin
 1983|      0|                sp[stride] = val | ((v_n + 2) << (p - 1));
 1984|       |
 1985|       |                //update line_state: bit 7 (\sigma^NW), and E^NW for next quad
 1986|      0|                lsp[0] = (OPJ_UINT8)(0x80 | (32 - count_leading_zeros(v_n)));
 1987|      0|            } else if (locs & 0x8) {
  ------------------
  |  Branch (1987:24): [True: 0, False: 0]
  ------------------
 1988|      0|                sp[stride] = 0;
 1989|      0|            }
 1990|       |
 1991|      0|            ++sp;
 1992|       |
 1993|      0|            if (qinf[1] & 0x10) { //sigma_n
  ------------------
  |  Branch (1993:17): [True: 0, False: 0]
  ------------------
 1994|      0|                OPJ_UINT32 val;
 1995|       |
 1996|      0|                ms_val = frwd_fetch(&magsgn);
 1997|      0|                m_n = U_q[1] - ((qinf[1] >> 12) & 1); //m_n
 1998|      0|                frwd_advance(&magsgn, m_n);
 1999|      0|                val = ms_val << 31;
 2000|      0|                v_n = ms_val & ((1U << m_n) - 1);
 2001|      0|                v_n |= (((qinf[1] & 0x100) >> 8) << m_n);
 2002|      0|                v_n |= 1;                            //center of bin
 2003|      0|                sp[0] = val | ((v_n + 2) << (p - 1));
 2004|      0|            } else if (locs & 0x10) {
  ------------------
  |  Branch (2004:24): [True: 0, False: 0]
  ------------------
 2005|      0|                sp[0] = 0;
 2006|      0|            }
 2007|       |
 2008|      0|            if (qinf[1] & 0x20) { //sigma_n
  ------------------
  |  Branch (2008:17): [True: 0, False: 0]
  ------------------
 2009|      0|                OPJ_UINT32 val, t;
 2010|       |
 2011|      0|                ms_val = frwd_fetch(&magsgn);
 2012|      0|                m_n = U_q[1] - ((qinf[1] >> 13) & 1); //m_n
 2013|      0|                frwd_advance(&magsgn, m_n);
 2014|      0|                val = ms_val << 31;
 2015|      0|                v_n = ms_val & ((1U << m_n) - 1);
 2016|      0|                v_n |= (((qinf[1] & 0x200) >> 9) << m_n);
 2017|      0|                v_n |= 1; //center of bin
 2018|      0|                sp[stride] = val | ((v_n + 2) << (p - 1));
 2019|       |
 2020|       |                //update line_state: bit 7 (\sigma^N), and E^N
 2021|      0|                t = lsp[0] & 0x7F;          //E^NW
 2022|      0|                v_n = 32 - count_leading_zeros(v_n);
 2023|      0|                lsp[0] = (OPJ_UINT8)(0x80 | (t > v_n ? t : v_n));
  ------------------
  |  Branch (2023:46): [True: 0, False: 0]
  ------------------
 2024|      0|            } else if (locs & 0x20) {
  ------------------
  |  Branch (2024:24): [True: 0, False: 0]
  ------------------
 2025|      0|                sp[stride] = 0;    //no need to update line_state
 2026|      0|            }
 2027|       |
 2028|      0|            ++lsp;
 2029|      0|            ++sp;
 2030|       |
 2031|      0|            if (qinf[1] & 0x40) { //sigma_n
  ------------------
  |  Branch (2031:17): [True: 0, False: 0]
  ------------------
 2032|      0|                OPJ_UINT32 val;
 2033|       |
 2034|      0|                ms_val = frwd_fetch(&magsgn);
 2035|      0|                m_n = U_q[1] - ((qinf[1] >> 14) & 1); //m_n
 2036|      0|                frwd_advance(&magsgn, m_n);
 2037|      0|                val = ms_val << 31;
 2038|      0|                v_n = ms_val & ((1U << m_n) - 1);
 2039|      0|                v_n |= (((qinf[1] & 0x400) >> 10) << m_n);
 2040|      0|                v_n |= 1;                            //center of bin
 2041|      0|                sp[0] = val | ((v_n + 2) << (p - 1));
 2042|      0|            } else if (locs & 0x40) {
  ------------------
  |  Branch (2042:24): [True: 0, False: 0]
  ------------------
 2043|      0|                sp[0] = 0;
 2044|      0|            }
 2045|       |
 2046|      0|            if (qinf[1] & 0x80) { //sigma_n
  ------------------
  |  Branch (2046:17): [True: 0, False: 0]
  ------------------
 2047|      0|                OPJ_UINT32 val;
 2048|       |
 2049|      0|                ms_val = frwd_fetch(&magsgn);
 2050|      0|                m_n = U_q[1] - ((qinf[1] >> 15) & 1); //m_n
 2051|      0|                frwd_advance(&magsgn, m_n);
 2052|      0|                val = ms_val << 31;
 2053|      0|                v_n = ms_val & ((1U << m_n) - 1);
 2054|      0|                v_n |= (((qinf[1] & 0x800) >> 11) << m_n);
 2055|      0|                v_n |= 1; //center of bin
 2056|      0|                sp[stride] = val | ((v_n + 2) << (p - 1));
 2057|       |
 2058|       |                //update line_state: bit 7 (\sigma^NW), and E^NW for next quad
 2059|      0|                lsp[0] = (OPJ_UINT8)(0x80 | (32 - count_leading_zeros(v_n)));
 2060|      0|            } else if (locs & 0x80) {
  ------------------
  |  Branch (2060:24): [True: 0, False: 0]
  ------------------
 2061|      0|                sp[stride] = 0;
 2062|      0|            }
 2063|       |
 2064|      0|            ++sp;
 2065|      0|        }
 2066|       |
 2067|      0|        y += 2;
 2068|      0|        if (num_passes > 1 && (y & 3) == 0) { //executed at multiples of 4
  ------------------
  |  Branch (2068:13): [True: 0, False: 0]
  |  Branch (2068:31): [True: 0, False: 0]
  ------------------
 2069|       |            // This is for SPP and potentially MRP
 2070|       |
 2071|      0|            if (num_passes > 2) { //do MRP
  ------------------
  |  Branch (2071:17): [True: 0, False: 0]
  ------------------
 2072|       |                // select the current stripe
 2073|      0|                OPJ_UINT32 *cur_sig = y & 0x4 ? sigma1 : sigma2;
  ------------------
  |  Branch (2073:39): [True: 0, False: 0]
  ------------------
 2074|       |                // the address of the data that needs updating
 2075|      0|                OPJ_UINT32 *dpp = decoded_data + (y - 4) * stride;
 2076|      0|                OPJ_UINT32 half = 1u << (p - 2); // half the center of the bin
 2077|      0|                OPJ_INT32 i;
 2078|      0|                for (i = 0; i < width; i += 8) {
  ------------------
  |  Branch (2078:29): [True: 0, False: 0]
  ------------------
 2079|       |                    //Process one entry from sigma array at a time
 2080|       |                    // Each nibble (4 bits) in the sigma array represents 4 rows,
 2081|       |                    // and the 32 bits contain 8 columns
 2082|      0|                    OPJ_UINT32 cwd = rev_fetch_mrp(&magref); // get 32 bit data
 2083|      0|                    OPJ_UINT32 sig = *cur_sig++; // 32 bit that will be processed now
 2084|      0|                    OPJ_UINT32 col_mask = 0xFu;  // a mask for a column in sig
 2085|      0|                    OPJ_UINT32 *dp = dpp + i;    // next column in decode samples
 2086|      0|                    if (sig) { // if any of the 32 bits are set
  ------------------
  |  Branch (2086:25): [True: 0, False: 0]
  ------------------
 2087|      0|                        int j;
 2088|      0|                        for (j = 0; j < 8; ++j, dp++) { //one column at a time
  ------------------
  |  Branch (2088:37): [True: 0, False: 0]
  ------------------
 2089|      0|                            if (sig & col_mask) { // lowest nibble
  ------------------
  |  Branch (2089:33): [True: 0, False: 0]
  ------------------
 2090|      0|                                OPJ_UINT32 sample_mask = 0x11111111u & col_mask; //LSB
 2091|       |
 2092|      0|                                if (sig & sample_mask) { //if LSB is set
  ------------------
  |  Branch (2092:37): [True: 0, False: 0]
  ------------------
 2093|      0|                                    OPJ_UINT32 sym;
 2094|       |
 2095|      0|                                    assert(dp[0] != 0); // decoded value cannot be zero
 2096|      0|                                    sym = cwd & 1; // get it value
 2097|       |                                    // remove center of bin if sym is 0
 2098|      0|                                    dp[0] ^= (1 - sym) << (p - 1);
 2099|      0|                                    dp[0] |= half;      // put half the center of bin
 2100|      0|                                    cwd >>= 1;          //consume word
 2101|      0|                                }
 2102|      0|                                sample_mask += sample_mask; //next row
 2103|       |
 2104|      0|                                if (sig & sample_mask) {
  ------------------
  |  Branch (2104:37): [True: 0, False: 0]
  ------------------
 2105|      0|                                    OPJ_UINT32 sym;
 2106|       |
 2107|      0|                                    assert(dp[stride] != 0);
 2108|      0|                                    sym = cwd & 1;
 2109|      0|                                    dp[stride] ^= (1 - sym) << (p - 1);
 2110|      0|                                    dp[stride] |= half;
 2111|      0|                                    cwd >>= 1;
 2112|      0|                                }
 2113|      0|                                sample_mask += sample_mask;
 2114|       |
 2115|      0|                                if (sig & sample_mask) {
  ------------------
  |  Branch (2115:37): [True: 0, False: 0]
  ------------------
 2116|      0|                                    OPJ_UINT32 sym;
 2117|       |
 2118|      0|                                    assert(dp[2 * stride] != 0);
 2119|      0|                                    sym = cwd & 1;
 2120|      0|                                    dp[2 * stride] ^= (1 - sym) << (p - 1);
 2121|      0|                                    dp[2 * stride] |= half;
 2122|      0|                                    cwd >>= 1;
 2123|      0|                                }
 2124|      0|                                sample_mask += sample_mask;
 2125|       |
 2126|      0|                                if (sig & sample_mask) {
  ------------------
  |  Branch (2126:37): [True: 0, False: 0]
  ------------------
 2127|      0|                                    OPJ_UINT32 sym;
 2128|       |
 2129|      0|                                    assert(dp[3 * stride] != 0);
 2130|      0|                                    sym = cwd & 1;
 2131|      0|                                    dp[3 * stride] ^= (1 - sym) << (p - 1);
 2132|      0|                                    dp[3 * stride] |= half;
 2133|      0|                                    cwd >>= 1;
 2134|      0|                                }
 2135|      0|                                sample_mask += sample_mask;
 2136|      0|                            }
 2137|      0|                            col_mask <<= 4; //next column
 2138|      0|                        }
 2139|      0|                    }
 2140|       |                    // consume data according to the number of bits set
 2141|      0|                    rev_advance_mrp(&magref, population_count(sig));
 2142|      0|                }
 2143|      0|            }
 2144|       |
 2145|      0|            if (y >= 4) { // update mbr array at the end of each stripe
  ------------------
  |  Branch (2145:17): [True: 0, False: 0]
  ------------------
 2146|       |                //generate mbr corresponding to a stripe
 2147|      0|                OPJ_UINT32 *sig = y & 0x4 ? sigma1 : sigma2;
  ------------------
  |  Branch (2147:35): [True: 0, False: 0]
  ------------------
 2148|      0|                OPJ_UINT32 *mbr = y & 0x4 ? mbr1 : mbr2;
  ------------------
  |  Branch (2148:35): [True: 0, False: 0]
  ------------------
 2149|       |
 2150|       |                //data is processed in patches of 8 columns, each
 2151|       |                // each 32 bits in sigma1 or mbr1 represent 4 rows
 2152|       |
 2153|       |                //integrate horizontally
 2154|      0|                OPJ_UINT32 prev = 0; // previous columns
 2155|      0|                OPJ_INT32 i;
 2156|      0|                for (i = 0; i < width; i += 8, mbr++, sig++) {
  ------------------
  |  Branch (2156:29): [True: 0, False: 0]
  ------------------
 2157|      0|                    OPJ_UINT32 t, z;
 2158|       |
 2159|      0|                    mbr[0] = sig[0];         //start with significant samples
 2160|      0|                    mbr[0] |= prev >> 28;    //for first column, left neighbors
 2161|      0|                    mbr[0] |= sig[0] << 4;   //left neighbors
 2162|      0|                    mbr[0] |= sig[0] >> 4;   //right neighbors
 2163|      0|                    mbr[0] |= sig[1] << 28;  //for last column, right neighbors
 2164|      0|                    prev = sig[0];           // for next group of columns
 2165|       |
 2166|       |                    //integrate vertically
 2167|      0|                    t = mbr[0], z = mbr[0];
 2168|      0|                    z |= (t & 0x77777777) << 1; //above neighbors
 2169|      0|                    z |= (t & 0xEEEEEEEE) >> 1; //below neighbors
 2170|      0|                    mbr[0] = z & ~sig[0]; //remove already significance samples
 2171|      0|                }
 2172|      0|            }
 2173|       |
 2174|      0|            if (y >= 8) { //wait until 8 rows has been processed
  ------------------
  |  Branch (2174:17): [True: 0, False: 0]
  ------------------
 2175|      0|                OPJ_UINT32 *cur_sig, *cur_mbr, *nxt_sig, *nxt_mbr;
 2176|      0|                OPJ_UINT32 prev;
 2177|      0|                OPJ_UINT32 val;
 2178|      0|                OPJ_INT32 i;
 2179|       |
 2180|       |                // add membership from the next stripe, obtained above
 2181|      0|                cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2181:27): [True: 0, False: 0]
  ------------------
 2182|      0|                cur_mbr = y & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2182:27): [True: 0, False: 0]
  ------------------
 2183|      0|                nxt_sig = y & 0x4 ? sigma1 : sigma2;  //future samples
  ------------------
  |  Branch (2183:27): [True: 0, False: 0]
  ------------------
 2184|      0|                prev = 0; // the columns before these group of 8 columns
 2185|      0|                for (i = 0; i < width; i += 8, cur_mbr++, cur_sig++, nxt_sig++) {
  ------------------
  |  Branch (2185:29): [True: 0, False: 0]
  ------------------
 2186|      0|                    OPJ_UINT32 t = nxt_sig[0];
 2187|      0|                    t |= prev >> 28;        //for first column, left neighbors
 2188|      0|                    t |= nxt_sig[0] << 4;   //left neighbors
 2189|      0|                    t |= nxt_sig[0] >> 4;   //right neighbors
 2190|      0|                    t |= nxt_sig[1] << 28;  //for last column, right neighbors
 2191|      0|                    prev = nxt_sig[0];      // for next group of columns
 2192|       |
 2193|      0|                    if (!stripe_causal) {
  ------------------
  |  Branch (2193:25): [True: 0, False: 0]
  ------------------
 2194|      0|                        cur_mbr[0] |= (t & 0x11111111u) << 3; //propagate up to cur_mbr
 2195|      0|                    }
 2196|      0|                    cur_mbr[0] &= ~cur_sig[0]; //remove already significance samples
 2197|      0|                }
 2198|       |
 2199|       |                //find new locations and get signs
 2200|      0|                cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2200:27): [True: 0, False: 0]
  ------------------
 2201|      0|                cur_mbr = y & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2201:27): [True: 0, False: 0]
  ------------------
 2202|      0|                nxt_sig = y & 0x4 ? sigma1 : sigma2; //future samples
  ------------------
  |  Branch (2202:27): [True: 0, False: 0]
  ------------------
 2203|      0|                nxt_mbr = y & 0x4 ? mbr1 : mbr2;     //future samples
  ------------------
  |  Branch (2203:27): [True: 0, False: 0]
  ------------------
 2204|      0|                val = 3u << (p - 2); // sample values for newly discovered
 2205|       |                // significant samples including the bin center
 2206|      0|                for (i = 0; i < width;
  ------------------
  |  Branch (2206:29): [True: 0, False: 0]
  ------------------
 2207|      0|                        i += 8, cur_sig++, cur_mbr++, nxt_sig++, nxt_mbr++) {
 2208|      0|                    OPJ_UINT32 ux, tx;
 2209|      0|                    OPJ_UINT32 mbr = *cur_mbr;
 2210|      0|                    OPJ_UINT32 new_sig = 0;
 2211|      0|                    if (mbr) { //are there any samples that might be significant
  ------------------
  |  Branch (2211:25): [True: 0, False: 0]
  ------------------
 2212|      0|                        OPJ_INT32 n;
 2213|      0|                        for (n = 0; n < 8; n += 4) {
  ------------------
  |  Branch (2213:37): [True: 0, False: 0]
  ------------------
 2214|      0|                            OPJ_UINT32 col_mask;
 2215|      0|                            OPJ_UINT32 inv_sig;
 2216|      0|                            OPJ_INT32 end;
 2217|      0|                            OPJ_INT32 j;
 2218|       |
 2219|      0|                            OPJ_UINT32 cwd = frwd_fetch(&sigprop); //get 32 bits
 2220|      0|                            OPJ_UINT32 cnt = 0;
 2221|       |
 2222|      0|                            OPJ_UINT32 *dp = decoded_data + (y - 8) * stride;
 2223|      0|                            dp += i + n; //address for decoded samples
 2224|       |
 2225|      0|                            col_mask = 0xFu << (4 * n); //a mask to select a column
 2226|       |
 2227|      0|                            inv_sig = ~cur_sig[0]; // insignificant samples
 2228|       |
 2229|       |                            //find the last sample we operate on
 2230|      0|                            end = n + 4 + i < width ? n + 4 : width - i;
  ------------------
  |  Branch (2230:35): [True: 0, False: 0]
  ------------------
 2231|       |
 2232|      0|                            for (j = n; j < end; ++j, ++dp, col_mask <<= 4) {
  ------------------
  |  Branch (2232:41): [True: 0, False: 0]
  ------------------
 2233|      0|                                OPJ_UINT32 sample_mask;
 2234|       |
 2235|      0|                                if ((col_mask & mbr) == 0) { //no samples need checking
  ------------------
  |  Branch (2235:37): [True: 0, False: 0]
  ------------------
 2236|      0|                                    continue;
 2237|      0|                                }
 2238|       |
 2239|       |                                //scan mbr to find a new significant sample
 2240|      0|                                sample_mask = 0x11111111u & col_mask; // LSB
 2241|      0|                                if (mbr & sample_mask) {
  ------------------
  |  Branch (2241:37): [True: 0, False: 0]
  ------------------
 2242|      0|                                    assert(dp[0] == 0); // the sample must have been 0
 2243|      0|                                    if (cwd & 1) { //if this sample has become significant
  ------------------
  |  Branch (2243:41): [True: 0, False: 0]
  ------------------
 2244|       |                                        // must propagate it to nearby samples
 2245|      0|                                        OPJ_UINT32 t;
 2246|      0|                                        new_sig |= sample_mask;  // new significant samples
 2247|      0|                                        t = 0x32u << (j * 4);// propagation to neighbors
 2248|      0|                                        mbr |= t & inv_sig; //remove already significant samples
 2249|      0|                                    }
 2250|      0|                                    cwd >>= 1;
 2251|      0|                                    ++cnt; //consume bit and increment number of
 2252|       |                                    //consumed bits
 2253|      0|                                }
 2254|       |
 2255|      0|                                sample_mask += sample_mask;  // next row
 2256|      0|                                if (mbr & sample_mask) {
  ------------------
  |  Branch (2256:37): [True: 0, False: 0]
  ------------------
 2257|      0|                                    assert(dp[stride] == 0);
 2258|      0|                                    if (cwd & 1) {
  ------------------
  |  Branch (2258:41): [True: 0, False: 0]
  ------------------
 2259|      0|                                        OPJ_UINT32 t;
 2260|      0|                                        new_sig |= sample_mask;
 2261|      0|                                        t = 0x74u << (j * 4);
 2262|      0|                                        mbr |= t & inv_sig;
 2263|      0|                                    }
 2264|      0|                                    cwd >>= 1;
 2265|      0|                                    ++cnt;
 2266|      0|                                }
 2267|       |
 2268|      0|                                sample_mask += sample_mask;
 2269|      0|                                if (mbr & sample_mask) {
  ------------------
  |  Branch (2269:37): [True: 0, False: 0]
  ------------------
 2270|      0|                                    assert(dp[2 * stride] == 0);
 2271|      0|                                    if (cwd & 1) {
  ------------------
  |  Branch (2271:41): [True: 0, False: 0]
  ------------------
 2272|      0|                                        OPJ_UINT32 t;
 2273|      0|                                        new_sig |= sample_mask;
 2274|      0|                                        t = 0xE8u << (j * 4);
 2275|      0|                                        mbr |= t & inv_sig;
 2276|      0|                                    }
 2277|      0|                                    cwd >>= 1;
 2278|      0|                                    ++cnt;
 2279|      0|                                }
 2280|       |
 2281|      0|                                sample_mask += sample_mask;
 2282|      0|                                if (mbr & sample_mask) {
  ------------------
  |  Branch (2282:37): [True: 0, False: 0]
  ------------------
 2283|      0|                                    assert(dp[3 * stride] == 0);
 2284|      0|                                    if (cwd & 1) {
  ------------------
  |  Branch (2284:41): [True: 0, False: 0]
  ------------------
 2285|      0|                                        OPJ_UINT32 t;
 2286|      0|                                        new_sig |= sample_mask;
 2287|      0|                                        t = 0xC0u << (j * 4);
 2288|      0|                                        mbr |= t & inv_sig;
 2289|      0|                                    }
 2290|      0|                                    cwd >>= 1;
 2291|      0|                                    ++cnt;
 2292|      0|                                }
 2293|      0|                            }
 2294|       |
 2295|       |                            //obtain signs here
 2296|      0|                            if (new_sig & (0xFFFFu << (4 * n))) { //if any
  ------------------
  |  Branch (2296:33): [True: 0, False: 0]
  ------------------
 2297|      0|                                OPJ_UINT32 col_mask;
 2298|      0|                                OPJ_INT32 j;
 2299|      0|                                OPJ_UINT32 *dp = decoded_data + (y - 8) * stride;
 2300|      0|                                dp += i + n; // decoded samples address
 2301|      0|                                col_mask = 0xFu << (4 * n); //mask to select a column
 2302|       |
 2303|      0|                                for (j = n; j < end; ++j, ++dp, col_mask <<= 4) {
  ------------------
  |  Branch (2303:45): [True: 0, False: 0]
  ------------------
 2304|      0|                                    OPJ_UINT32 sample_mask;
 2305|       |
 2306|      0|                                    if ((col_mask & new_sig) == 0) { //if non is significant
  ------------------
  |  Branch (2306:41): [True: 0, False: 0]
  ------------------
 2307|      0|                                        continue;
 2308|      0|                                    }
 2309|       |
 2310|       |                                    //scan 4 signs
 2311|      0|                                    sample_mask = 0x11111111u & col_mask;
 2312|      0|                                    if (new_sig & sample_mask) {
  ------------------
  |  Branch (2312:41): [True: 0, False: 0]
  ------------------
 2313|      0|                                        assert(dp[0] == 0);
 2314|      0|                                        dp[0] |= ((cwd & 1) << 31) | val; //put value and sign
 2315|      0|                                        cwd >>= 1;
 2316|      0|                                        ++cnt; //consume bit and increment number
 2317|       |                                        //of consumed bits
 2318|      0|                                    }
 2319|       |
 2320|      0|                                    sample_mask += sample_mask;
 2321|      0|                                    if (new_sig & sample_mask) {
  ------------------
  |  Branch (2321:41): [True: 0, False: 0]
  ------------------
 2322|      0|                                        assert(dp[stride] == 0);
 2323|      0|                                        dp[stride] |= ((cwd & 1) << 31) | val;
 2324|      0|                                        cwd >>= 1;
 2325|      0|                                        ++cnt;
 2326|      0|                                    }
 2327|       |
 2328|      0|                                    sample_mask += sample_mask;
 2329|      0|                                    if (new_sig & sample_mask) {
  ------------------
  |  Branch (2329:41): [True: 0, False: 0]
  ------------------
 2330|      0|                                        assert(dp[2 * stride] == 0);
 2331|      0|                                        dp[2 * stride] |= ((cwd & 1) << 31) | val;
 2332|      0|                                        cwd >>= 1;
 2333|      0|                                        ++cnt;
 2334|      0|                                    }
 2335|       |
 2336|      0|                                    sample_mask += sample_mask;
 2337|      0|                                    if (new_sig & sample_mask) {
  ------------------
  |  Branch (2337:41): [True: 0, False: 0]
  ------------------
 2338|      0|                                        assert(dp[3 * stride] == 0);
 2339|      0|                                        dp[3 * stride] |= ((cwd & 1) << 31) | val;
 2340|      0|                                        cwd >>= 1;
 2341|      0|                                        ++cnt;
 2342|      0|                                    }
 2343|      0|                                }
 2344|       |
 2345|      0|                            }
 2346|      0|                            frwd_advance(&sigprop, cnt); //consume the bits from bitstrm
 2347|      0|                            cnt = 0;
 2348|       |
 2349|       |                            //update the next 8 columns
 2350|      0|                            if (n == 4) {
  ------------------
  |  Branch (2350:33): [True: 0, False: 0]
  ------------------
 2351|       |                                //horizontally
 2352|      0|                                OPJ_UINT32 t = new_sig >> 28;
 2353|      0|                                t |= ((t & 0xE) >> 1) | ((t & 7) << 1);
 2354|      0|                                cur_mbr[1] |= t & ~cur_sig[1];
 2355|      0|                            }
 2356|      0|                        }
 2357|      0|                    }
 2358|       |                    //update the next stripe (vertically propagation)
 2359|      0|                    new_sig |= cur_sig[0];
 2360|      0|                    ux = (new_sig & 0x88888888) >> 3;
 2361|      0|                    tx = ux | (ux << 4) | (ux >> 4); //left and right neighbors
 2362|      0|                    if (i > 0) {
  ------------------
  |  Branch (2362:25): [True: 0, False: 0]
  ------------------
 2363|      0|                        nxt_mbr[-1] |= (ux << 28) & ~nxt_sig[-1];
 2364|      0|                    }
 2365|      0|                    nxt_mbr[0] |= tx & ~nxt_sig[0];
 2366|      0|                    nxt_mbr[1] |= (ux >> 28) & ~nxt_sig[1];
 2367|      0|                }
 2368|       |
 2369|       |                //clear current sigma
 2370|       |                //mbr need not be cleared because it is overwritten
 2371|      0|                cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2371:27): [True: 0, False: 0]
  ------------------
 2372|      0|                memset(cur_sig, 0, ((((OPJ_UINT32)width + 7u) >> 3) + 1u) << 2);
 2373|      0|            }
 2374|      0|        }
 2375|      0|    }
 2376|       |
 2377|       |    //terminating
 2378|      0|    if (num_passes > 1) {
  ------------------
  |  Branch (2378:9): [True: 0, False: 0]
  ------------------
 2379|      0|        OPJ_INT32 st, y;
 2380|       |
 2381|      0|        if (num_passes > 2 && ((height & 3) == 1 || (height & 3) == 2)) {
  ------------------
  |  Branch (2381:13): [True: 0, False: 0]
  |  Branch (2381:32): [True: 0, False: 0]
  |  Branch (2381:53): [True: 0, False: 0]
  ------------------
 2382|       |            //do magref
 2383|      0|            OPJ_UINT32 *cur_sig = height & 0x4 ? sigma2 : sigma1; //reversed
  ------------------
  |  Branch (2383:35): [True: 0, False: 0]
  ------------------
 2384|      0|            OPJ_UINT32 *dpp = decoded_data + (height & 0xFFFFFC) * stride;
 2385|      0|            OPJ_UINT32 half = 1u << (p - 2);
 2386|      0|            OPJ_INT32 i;
 2387|      0|            for (i = 0; i < width; i += 8) {
  ------------------
  |  Branch (2387:25): [True: 0, False: 0]
  ------------------
 2388|      0|                OPJ_UINT32 cwd = rev_fetch_mrp(&magref);
 2389|      0|                OPJ_UINT32 sig = *cur_sig++;
 2390|      0|                OPJ_UINT32 col_mask = 0xF;
 2391|      0|                OPJ_UINT32 *dp = dpp + i;
 2392|      0|                if (sig) {
  ------------------
  |  Branch (2392:21): [True: 0, False: 0]
  ------------------
 2393|      0|                    int j;
 2394|      0|                    for (j = 0; j < 8; ++j, dp++) {
  ------------------
  |  Branch (2394:33): [True: 0, False: 0]
  ------------------
 2395|      0|                        if (sig & col_mask) {
  ------------------
  |  Branch (2395:29): [True: 0, False: 0]
  ------------------
 2396|      0|                            OPJ_UINT32 sample_mask = 0x11111111 & col_mask;
 2397|       |
 2398|      0|                            if (sig & sample_mask) {
  ------------------
  |  Branch (2398:33): [True: 0, False: 0]
  ------------------
 2399|      0|                                OPJ_UINT32 sym;
 2400|      0|                                assert(dp[0] != 0);
 2401|      0|                                sym = cwd & 1;
 2402|      0|                                dp[0] ^= (1 - sym) << (p - 1);
 2403|      0|                                dp[0] |= half;
 2404|      0|                                cwd >>= 1;
 2405|      0|                            }
 2406|      0|                            sample_mask += sample_mask;
 2407|       |
 2408|      0|                            if (sig & sample_mask) {
  ------------------
  |  Branch (2408:33): [True: 0, False: 0]
  ------------------
 2409|      0|                                OPJ_UINT32 sym;
 2410|      0|                                assert(dp[stride] != 0);
 2411|      0|                                sym = cwd & 1;
 2412|      0|                                dp[stride] ^= (1 - sym) << (p - 1);
 2413|      0|                                dp[stride] |= half;
 2414|      0|                                cwd >>= 1;
 2415|      0|                            }
 2416|      0|                            sample_mask += sample_mask;
 2417|       |
 2418|      0|                            if (sig & sample_mask) {
  ------------------
  |  Branch (2418:33): [True: 0, False: 0]
  ------------------
 2419|      0|                                OPJ_UINT32 sym;
 2420|      0|                                assert(dp[2 * stride] != 0);
 2421|      0|                                sym = cwd & 1;
 2422|      0|                                dp[2 * stride] ^= (1 - sym) << (p - 1);
 2423|      0|                                dp[2 * stride] |= half;
 2424|      0|                                cwd >>= 1;
 2425|      0|                            }
 2426|      0|                            sample_mask += sample_mask;
 2427|       |
 2428|      0|                            if (sig & sample_mask) {
  ------------------
  |  Branch (2428:33): [True: 0, False: 0]
  ------------------
 2429|      0|                                OPJ_UINT32 sym;
 2430|      0|                                assert(dp[3 * stride] != 0);
 2431|      0|                                sym = cwd & 1;
 2432|      0|                                dp[3 * stride] ^= (1 - sym) << (p - 1);
 2433|      0|                                dp[3 * stride] |= half;
 2434|      0|                                cwd >>= 1;
 2435|      0|                            }
 2436|      0|                            sample_mask += sample_mask;
 2437|      0|                        }
 2438|      0|                        col_mask <<= 4;
 2439|      0|                    }
 2440|      0|                }
 2441|      0|                rev_advance_mrp(&magref, population_count(sig));
 2442|      0|            }
 2443|      0|        }
 2444|       |
 2445|       |        //do the last incomplete stripe
 2446|       |        // for cases of (height & 3) == 0 and 3
 2447|       |        // the should have been processed previously
 2448|      0|        if ((height & 3) == 1 || (height & 3) == 2) {
  ------------------
  |  Branch (2448:13): [True: 0, False: 0]
  |  Branch (2448:34): [True: 0, False: 0]
  ------------------
 2449|       |            //generate mbr of first stripe
 2450|      0|            OPJ_UINT32 *sig = height & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2450:31): [True: 0, False: 0]
  ------------------
 2451|      0|            OPJ_UINT32 *mbr = height & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2451:31): [True: 0, False: 0]
  ------------------
 2452|       |            //integrate horizontally
 2453|      0|            OPJ_UINT32 prev = 0;
 2454|      0|            OPJ_INT32 i;
 2455|      0|            for (i = 0; i < width; i += 8, mbr++, sig++) {
  ------------------
  |  Branch (2455:25): [True: 0, False: 0]
  ------------------
 2456|      0|                OPJ_UINT32 t, z;
 2457|       |
 2458|      0|                mbr[0] = sig[0];
 2459|      0|                mbr[0] |= prev >> 28;    //for first column, left neighbors
 2460|      0|                mbr[0] |= sig[0] << 4;   //left neighbors
 2461|      0|                mbr[0] |= sig[0] >> 4;   //left neighbors
 2462|      0|                mbr[0] |= sig[1] << 28;  //for last column, right neighbors
 2463|      0|                prev = sig[0];
 2464|       |
 2465|       |                //integrate vertically
 2466|      0|                t = mbr[0], z = mbr[0];
 2467|      0|                z |= (t & 0x77777777) << 1; //above neighbors
 2468|      0|                z |= (t & 0xEEEEEEEE) >> 1; //below neighbors
 2469|      0|                mbr[0] = z & ~sig[0]; //remove already significance samples
 2470|      0|            }
 2471|      0|        }
 2472|       |
 2473|      0|        st = height;
 2474|      0|        st -= height > 6 ? (((height + 1) & 3) + 3) : height;
  ------------------
  |  Branch (2474:15): [True: 0, False: 0]
  ------------------
 2475|      0|        for (y = st; y < height; y += 4) {
  ------------------
  |  Branch (2475:22): [True: 0, False: 0]
  ------------------
 2476|      0|            OPJ_UINT32 *cur_sig, *cur_mbr, *nxt_sig, *nxt_mbr;
 2477|      0|            OPJ_UINT32 val;
 2478|      0|            OPJ_INT32 i;
 2479|       |
 2480|      0|            OPJ_UINT32 pattern = 0xFFFFFFFFu; // a pattern needed samples
 2481|      0|            if (height - y == 3) {
  ------------------
  |  Branch (2481:17): [True: 0, False: 0]
  ------------------
 2482|      0|                pattern = 0x77777777u;
 2483|      0|            } else if (height - y == 2) {
  ------------------
  |  Branch (2483:24): [True: 0, False: 0]
  ------------------
 2484|      0|                pattern = 0x33333333u;
 2485|      0|            } else if (height - y == 1) {
  ------------------
  |  Branch (2485:24): [True: 0, False: 0]
  ------------------
 2486|      0|                pattern = 0x11111111u;
 2487|      0|            }
 2488|       |
 2489|       |            //add membership from the next stripe, obtained above
 2490|      0|            if (height - y > 4) {
  ------------------
  |  Branch (2490:17): [True: 0, False: 0]
  ------------------
 2491|      0|                OPJ_UINT32 prev = 0;
 2492|      0|                OPJ_INT32 i;
 2493|      0|                cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2493:27): [True: 0, False: 0]
  ------------------
 2494|      0|                cur_mbr = y & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2494:27): [True: 0, False: 0]
  ------------------
 2495|      0|                nxt_sig = y & 0x4 ? sigma1 : sigma2;
  ------------------
  |  Branch (2495:27): [True: 0, False: 0]
  ------------------
 2496|      0|                for (i = 0; i < width; i += 8, cur_mbr++, cur_sig++, nxt_sig++) {
  ------------------
  |  Branch (2496:29): [True: 0, False: 0]
  ------------------
 2497|      0|                    OPJ_UINT32 t = nxt_sig[0];
 2498|      0|                    t |= prev >> 28;     //for first column, left neighbors
 2499|      0|                    t |= nxt_sig[0] << 4;   //left neighbors
 2500|      0|                    t |= nxt_sig[0] >> 4;   //left neighbors
 2501|      0|                    t |= nxt_sig[1] << 28;  //for last column, right neighbors
 2502|      0|                    prev = nxt_sig[0];
 2503|       |
 2504|      0|                    if (!stripe_causal) {
  ------------------
  |  Branch (2504:25): [True: 0, False: 0]
  ------------------
 2505|      0|                        cur_mbr[0] |= (t & 0x11111111u) << 3;
 2506|      0|                    }
 2507|       |                    //remove already significance samples
 2508|      0|                    cur_mbr[0] &= ~cur_sig[0];
 2509|      0|                }
 2510|      0|            }
 2511|       |
 2512|       |            //find new locations and get signs
 2513|      0|            cur_sig = y & 0x4 ? sigma2 : sigma1;
  ------------------
  |  Branch (2513:23): [True: 0, False: 0]
  ------------------
 2514|      0|            cur_mbr = y & 0x4 ? mbr2 : mbr1;
  ------------------
  |  Branch (2514:23): [True: 0, False: 0]
  ------------------
 2515|      0|            nxt_sig = y & 0x4 ? sigma1 : sigma2;
  ------------------
  |  Branch (2515:23): [True: 0, False: 0]
  ------------------
 2516|      0|            nxt_mbr = y & 0x4 ? mbr1 : mbr2;
  ------------------
  |  Branch (2516:23): [True: 0, False: 0]
  ------------------
 2517|      0|            val = 3u << (p - 2);
 2518|      0|            for (i = 0; i < width; i += 8,
  ------------------
  |  Branch (2518:25): [True: 0, False: 0]
  ------------------
 2519|      0|                    cur_sig++, cur_mbr++, nxt_sig++, nxt_mbr++) {
 2520|      0|                OPJ_UINT32 mbr = *cur_mbr & pattern; //skip unneeded samples
 2521|      0|                OPJ_UINT32 new_sig = 0;
 2522|      0|                OPJ_UINT32 ux, tx;
 2523|      0|                if (mbr) {
  ------------------
  |  Branch (2523:21): [True: 0, False: 0]
  ------------------
 2524|      0|                    OPJ_INT32 n;
 2525|      0|                    for (n = 0; n < 8; n += 4) {
  ------------------
  |  Branch (2525:33): [True: 0, False: 0]
  ------------------
 2526|      0|                        OPJ_UINT32 col_mask;
 2527|      0|                        OPJ_UINT32 inv_sig;
 2528|      0|                        OPJ_INT32 end;
 2529|      0|                        OPJ_INT32 j;
 2530|       |
 2531|      0|                        OPJ_UINT32 cwd = frwd_fetch(&sigprop);
 2532|      0|                        OPJ_UINT32 cnt = 0;
 2533|       |
 2534|      0|                        OPJ_UINT32 *dp = decoded_data + y * stride;
 2535|      0|                        dp += i + n;
 2536|       |
 2537|      0|                        col_mask = 0xFu << (4 * n);
 2538|       |
 2539|      0|                        inv_sig = ~cur_sig[0] & pattern;
 2540|       |
 2541|      0|                        end = n + 4 + i < width ? n + 4 : width - i;
  ------------------
  |  Branch (2541:31): [True: 0, False: 0]
  ------------------
 2542|      0|                        for (j = n; j < end; ++j, ++dp, col_mask <<= 4) {
  ------------------
  |  Branch (2542:37): [True: 0, False: 0]
  ------------------
 2543|      0|                            OPJ_UINT32 sample_mask;
 2544|       |
 2545|      0|                            if ((col_mask & mbr) == 0) {
  ------------------
  |  Branch (2545:33): [True: 0, False: 0]
  ------------------
 2546|      0|                                continue;
 2547|      0|                            }
 2548|       |
 2549|       |                            //scan 4 mbr
 2550|      0|                            sample_mask = 0x11111111u & col_mask;
 2551|      0|                            if (mbr & sample_mask) {
  ------------------
  |  Branch (2551:33): [True: 0, False: 0]
  ------------------
 2552|      0|                                assert(dp[0] == 0);
 2553|      0|                                if (cwd & 1) {
  ------------------
  |  Branch (2553:37): [True: 0, False: 0]
  ------------------
 2554|      0|                                    OPJ_UINT32 t;
 2555|      0|                                    new_sig |= sample_mask;
 2556|      0|                                    t = 0x32u << (j * 4);
 2557|      0|                                    mbr |= t & inv_sig;
 2558|      0|                                }
 2559|      0|                                cwd >>= 1;
 2560|      0|                                ++cnt;
 2561|      0|                            }
 2562|       |
 2563|      0|                            sample_mask += sample_mask;
 2564|      0|                            if (mbr & sample_mask) {
  ------------------
  |  Branch (2564:33): [True: 0, False: 0]
  ------------------
 2565|      0|                                assert(dp[stride] == 0);
 2566|      0|                                if (cwd & 1) {
  ------------------
  |  Branch (2566:37): [True: 0, False: 0]
  ------------------
 2567|      0|                                    OPJ_UINT32 t;
 2568|      0|                                    new_sig |= sample_mask;
 2569|      0|                                    t = 0x74u << (j * 4);
 2570|      0|                                    mbr |= t & inv_sig;
 2571|      0|                                }
 2572|      0|                                cwd >>= 1;
 2573|      0|                                ++cnt;
 2574|      0|                            }
 2575|       |
 2576|      0|                            sample_mask += sample_mask;
 2577|      0|                            if (mbr & sample_mask) {
  ------------------
  |  Branch (2577:33): [True: 0, False: 0]
  ------------------
 2578|      0|                                assert(dp[2 * stride] == 0);
 2579|      0|                                if (cwd & 1) {
  ------------------
  |  Branch (2579:37): [True: 0, False: 0]
  ------------------
 2580|      0|                                    OPJ_UINT32 t;
 2581|      0|                                    new_sig |= sample_mask;
 2582|      0|                                    t = 0xE8u << (j * 4);
 2583|      0|                                    mbr |= t & inv_sig;
 2584|      0|                                }
 2585|      0|                                cwd >>= 1;
 2586|      0|                                ++cnt;
 2587|      0|                            }
 2588|       |
 2589|      0|                            sample_mask += sample_mask;
 2590|      0|                            if (mbr & sample_mask) {
  ------------------
  |  Branch (2590:33): [True: 0, False: 0]
  ------------------
 2591|      0|                                assert(dp[3 * stride] == 0);
 2592|      0|                                if (cwd & 1) {
  ------------------
  |  Branch (2592:37): [True: 0, False: 0]
  ------------------
 2593|      0|                                    OPJ_UINT32 t;
 2594|      0|                                    new_sig |= sample_mask;
 2595|      0|                                    t = 0xC0u << (j * 4);
 2596|      0|                                    mbr |= t & inv_sig;
 2597|      0|                                }
 2598|      0|                                cwd >>= 1;
 2599|      0|                                ++cnt;
 2600|      0|                            }
 2601|      0|                        }
 2602|       |
 2603|       |                        //signs here
 2604|      0|                        if (new_sig & (0xFFFFu << (4 * n))) {
  ------------------
  |  Branch (2604:29): [True: 0, False: 0]
  ------------------
 2605|      0|                            OPJ_UINT32 col_mask;
 2606|      0|                            OPJ_INT32 j;
 2607|      0|                            OPJ_UINT32 *dp = decoded_data + y * stride;
 2608|      0|                            dp += i + n;
 2609|      0|                            col_mask = 0xFu << (4 * n);
 2610|       |
 2611|      0|                            for (j = n; j < end; ++j, ++dp, col_mask <<= 4) {
  ------------------
  |  Branch (2611:41): [True: 0, False: 0]
  ------------------
 2612|      0|                                OPJ_UINT32 sample_mask;
 2613|      0|                                if ((col_mask & new_sig) == 0) {
  ------------------
  |  Branch (2613:37): [True: 0, False: 0]
  ------------------
 2614|      0|                                    continue;
 2615|      0|                                }
 2616|       |
 2617|       |                                //scan 4 signs
 2618|      0|                                sample_mask = 0x11111111u & col_mask;
 2619|      0|                                if (new_sig & sample_mask) {
  ------------------
  |  Branch (2619:37): [True: 0, False: 0]
  ------------------
 2620|      0|                                    assert(dp[0] == 0);
 2621|      0|                                    dp[0] |= ((cwd & 1) << 31) | val;
 2622|      0|                                    cwd >>= 1;
 2623|      0|                                    ++cnt;
 2624|      0|                                }
 2625|       |
 2626|      0|                                sample_mask += sample_mask;
 2627|      0|                                if (new_sig & sample_mask) {
  ------------------
  |  Branch (2627:37): [True: 0, False: 0]
  ------------------
 2628|      0|                                    assert(dp[stride] == 0);
 2629|      0|                                    dp[stride] |= ((cwd & 1) << 31) | val;
 2630|      0|                                    cwd >>= 1;
 2631|      0|                                    ++cnt;
 2632|      0|                                }
 2633|       |
 2634|      0|                                sample_mask += sample_mask;
 2635|      0|                                if (new_sig & sample_mask) {
  ------------------
  |  Branch (2635:37): [True: 0, False: 0]
  ------------------
 2636|      0|                                    assert(dp[2 * stride] == 0);
 2637|      0|                                    dp[2 * stride] |= ((cwd & 1) << 31) | val;
 2638|      0|                                    cwd >>= 1;
 2639|      0|                                    ++cnt;
 2640|      0|                                }
 2641|       |
 2642|      0|                                sample_mask += sample_mask;
 2643|      0|                                if (new_sig & sample_mask) {
  ------------------
  |  Branch (2643:37): [True: 0, False: 0]
  ------------------
 2644|      0|                                    assert(dp[3 * stride] == 0);
 2645|      0|                                    dp[3 * stride] |= ((cwd & 1) << 31) | val;
 2646|      0|                                    cwd >>= 1;
 2647|      0|                                    ++cnt;
 2648|      0|                                }
 2649|      0|                            }
 2650|       |
 2651|      0|                        }
 2652|      0|                        frwd_advance(&sigprop, cnt);
 2653|      0|                        cnt = 0;
 2654|       |
 2655|       |                        //update next columns
 2656|      0|                        if (n == 4) {
  ------------------
  |  Branch (2656:29): [True: 0, False: 0]
  ------------------
 2657|       |                            //horizontally
 2658|      0|                            OPJ_UINT32 t = new_sig >> 28;
 2659|      0|                            t |= ((t & 0xE) >> 1) | ((t & 7) << 1);
 2660|      0|                            cur_mbr[1] |= t & ~cur_sig[1];
 2661|      0|                        }
 2662|      0|                    }
 2663|      0|                }
 2664|       |                //propagate down (vertically propagation)
 2665|      0|                new_sig |= cur_sig[0];
 2666|      0|                ux = (new_sig & 0x88888888) >> 3;
 2667|      0|                tx = ux | (ux << 4) | (ux >> 4);
 2668|      0|                if (i > 0) {
  ------------------
  |  Branch (2668:21): [True: 0, False: 0]
  ------------------
 2669|      0|                    nxt_mbr[-1] |= (ux << 28) & ~nxt_sig[-1];
 2670|      0|                }
 2671|      0|                nxt_mbr[0] |= tx & ~nxt_sig[0];
 2672|      0|                nxt_mbr[1] |= (ux >> 28) & ~nxt_sig[1];
 2673|      0|            }
 2674|      0|        }
 2675|      0|    }
 2676|       |
 2677|      0|    {
 2678|      0|        OPJ_INT32 x, y;
 2679|      0|        for (y = 0; y < height; ++y) {
  ------------------
  |  Branch (2679:21): [True: 0, False: 0]
  ------------------
 2680|      0|            OPJ_INT32* sp = (OPJ_INT32*)decoded_data + y * stride;
 2681|      0|            for (x = 0; x < width; ++x, ++sp) {
  ------------------
  |  Branch (2681:25): [True: 0, False: 0]
  ------------------
 2682|      0|                OPJ_INT32 val = (*sp & 0x7FFFFFFF);
 2683|      0|                *sp = ((OPJ_UINT32) * sp & 0x80000000) ? -val : val;
  ------------------
  |  Branch (2683:23): [True: 0, False: 0]
  ------------------
 2684|      0|            }
 2685|      0|        }
 2686|      0|    }
 2687|       |
 2688|      0|    return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 2689|      0|}
ht_dec.c:opj_t1_allocate_buffers:
 1043|     23|{
 1044|     23|    OPJ_UINT32 flagssize;
 1045|       |
 1046|       |    /* No risk of overflow. Prior checks ensure those assert are met */
 1047|       |    /* They are per the specification */
 1048|     23|    assert(w <= 1024);
 1049|     23|    assert(h <= 1024);
 1050|     23|    assert(w * h <= 4096);
 1051|       |
 1052|       |    /* encoder uses tile buffer, so no need to allocate */
 1053|     23|    {
 1054|     23|        OPJ_UINT32 datasize = w * h;
 1055|       |
 1056|     23|        if (datasize > t1->datasize) {
  ------------------
  |  Branch (1056:13): [True: 5, False: 18]
  ------------------
 1057|      5|            opj_aligned_free(t1->data);
 1058|      5|            t1->data = (OPJ_INT32*)
 1059|      5|                       opj_aligned_malloc(datasize * sizeof(OPJ_INT32));
 1060|      5|            if (!t1->data) {
  ------------------
  |  Branch (1060:17): [True: 0, False: 5]
  ------------------
 1061|       |                /* FIXME event manager error callback */
 1062|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1063|      0|            }
 1064|      5|            t1->datasize = datasize;
 1065|      5|        }
 1066|       |        /* memset first arg is declared to never be null by gcc */
 1067|     23|        if (t1->data != NULL) {
  ------------------
  |  Branch (1067:13): [True: 23, False: 0]
  ------------------
 1068|     23|            memset(t1->data, 0, datasize * sizeof(OPJ_INT32));
 1069|     23|        }
 1070|     23|    }
 1071|       |
 1072|       |    // We expand these buffers to multiples of 16 bytes.
 1073|       |    // We need 4 buffers of 129 integers each, expanded to 132 integers each
 1074|       |    // We also need 514 bytes of buffer, expanded to 528 bytes
 1075|      0|    flagssize = 132U * sizeof(OPJ_UINT32) * 4U; // expanded to multiple of 16
 1076|     23|    flagssize += 528U; // 514 expanded to multiples of 16
 1077|       |
 1078|     23|    {
 1079|     23|        if (flagssize > t1->flagssize) {
  ------------------
  |  Branch (1079:13): [True: 3, False: 20]
  ------------------
 1080|       |
 1081|      3|            opj_aligned_free(t1->flags);
 1082|      3|            t1->flags = (opj_flag_t*) opj_aligned_malloc(flagssize * sizeof(opj_flag_t));
 1083|      3|            if (!t1->flags) {
  ------------------
  |  Branch (1083:17): [True: 0, False: 3]
  ------------------
 1084|       |                /* FIXME event manager error callback */
 1085|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1086|      0|            }
 1087|      3|        }
 1088|     23|        t1->flagssize = flagssize;
 1089|       |
 1090|     23|        memset(t1->flags, 0, flagssize * sizeof(opj_flag_t));
 1091|     23|    }
 1092|       |
 1093|      0|    t1->w = w;
 1094|     23|    t1->h = h;
 1095|       |
 1096|     23|    return OPJ_TRUE;
  ------------------
  |  |  117|     23|#define OPJ_TRUE 1
  ------------------
 1097|     23|}

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

opj_j2k_setup_decoder:
 6749|     59|{
 6750|     59|    if (j2k && parameters) {
  ------------------
  |  Branch (6750:9): [True: 59, False: 0]
  |  Branch (6750:16): [True: 59, False: 0]
  ------------------
 6751|     59|        j2k->m_cp.m_specific_param.m_dec.m_layer = parameters->cp_layer;
 6752|     59|        j2k->m_cp.m_specific_param.m_dec.m_reduce = parameters->cp_reduce;
 6753|       |
 6754|     59|        j2k->dump_state = (parameters->flags & OPJ_DPARAMETERS_DUMP_FLAG);
  ------------------
  |  |  549|     59|#define OPJ_DPARAMETERS_DUMP_FLAG 0x0002
  ------------------
 6755|       |#ifdef USE_JPWL
 6756|       |        j2k->m_cp.correct = parameters->jpwl_correct;
 6757|       |        j2k->m_cp.exp_comps = parameters->jpwl_exp_comps;
 6758|       |        j2k->m_cp.max_tiles = parameters->jpwl_max_tiles;
 6759|       |#endif /* USE_JPWL */
 6760|     59|    }
 6761|     59|}
opj_j2k_end_decompress:
 8470|     27|{
 8471|     27|    (void)p_j2k;
 8472|     27|    (void)p_stream;
 8473|     27|    (void)p_manager;
 8474|     27|    return OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
 8475|     27|}
opj_j2k_read_header:
 8481|     40|{
 8482|       |    /* preconditions */
 8483|     40|    assert(p_j2k != 00);
 8484|     40|    assert(p_stream != 00);
 8485|     40|    assert(p_manager != 00);
 8486|       |
 8487|       |    /* create an empty image header */
 8488|     40|    p_j2k->m_private_image = opj_image_create0();
 8489|     40|    if (! p_j2k->m_private_image) {
  ------------------
  |  Branch (8489:9): [True: 0, False: 40]
  ------------------
 8490|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8491|      0|    }
 8492|       |
 8493|       |    /* customization of the validation */
 8494|     40|    if (! opj_j2k_setup_decoding_validation(p_j2k, p_manager)) {
  ------------------
  |  Branch (8494:9): [True: 0, False: 40]
  ------------------
 8495|      0|        opj_image_destroy(p_j2k->m_private_image);
 8496|      0|        p_j2k->m_private_image = NULL;
 8497|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8498|      0|    }
 8499|       |
 8500|       |    /* validation of the parameters codec */
 8501|     40|    if (! opj_j2k_exec(p_j2k, p_j2k->m_validation_list, p_stream, p_manager)) {
  ------------------
  |  Branch (8501:9): [True: 0, False: 40]
  ------------------
 8502|      0|        opj_image_destroy(p_j2k->m_private_image);
 8503|      0|        p_j2k->m_private_image = NULL;
 8504|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8505|      0|    }
 8506|       |
 8507|       |    /* customization of the encoding */
 8508|     40|    if (! opj_j2k_setup_header_reading(p_j2k, p_manager)) {
  ------------------
  |  Branch (8508:9): [True: 0, False: 40]
  ------------------
 8509|      0|        opj_image_destroy(p_j2k->m_private_image);
 8510|      0|        p_j2k->m_private_image = NULL;
 8511|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8512|      0|    }
 8513|       |
 8514|       |    /* read header */
 8515|     40|    if (! opj_j2k_exec(p_j2k, p_j2k->m_procedure_list, p_stream, p_manager)) {
  ------------------
  |  Branch (8515:9): [True: 13, False: 27]
  ------------------
 8516|     13|        opj_image_destroy(p_j2k->m_private_image);
 8517|     13|        p_j2k->m_private_image = NULL;
 8518|     13|        return OPJ_FALSE;
  ------------------
  |  |  118|     13|#define OPJ_FALSE 0
  ------------------
 8519|     13|    }
 8520|       |
 8521|     27|    *p_image = opj_image_create0();
 8522|     27|    if (!(*p_image)) {
  ------------------
  |  Branch (8522:9): [True: 0, False: 27]
  ------------------
 8523|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8524|      0|    }
 8525|       |
 8526|       |    /* Copy codestream image information to the output image */
 8527|     27|    opj_copy_image_header(p_j2k->m_private_image, *p_image);
 8528|       |
 8529|     27|    return OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
 8530|     27|}
opj_j2k_destroy:
 9343|     59|{
 9344|     59|    if (p_j2k == 00) {
  ------------------
  |  Branch (9344:9): [True: 0, False: 59]
  ------------------
 9345|      0|        return;
 9346|      0|    }
 9347|       |
 9348|     59|    if (p_j2k->m_is_decoder) {
  ------------------
  |  Branch (9348:9): [True: 59, False: 0]
  ------------------
 9349|       |
 9350|     59|        if (p_j2k->m_specific_param.m_decoder.m_default_tcp != 00) {
  ------------------
  |  Branch (9350:13): [True: 59, False: 0]
  ------------------
 9351|     59|            opj_j2k_tcp_destroy(p_j2k->m_specific_param.m_decoder.m_default_tcp);
 9352|     59|            opj_free(p_j2k->m_specific_param.m_decoder.m_default_tcp);
 9353|     59|            p_j2k->m_specific_param.m_decoder.m_default_tcp = 00;
 9354|     59|        }
 9355|       |
 9356|     59|        if (p_j2k->m_specific_param.m_decoder.m_header_data != 00) {
  ------------------
  |  Branch (9356:13): [True: 59, False: 0]
  ------------------
 9357|     59|            opj_free(p_j2k->m_specific_param.m_decoder.m_header_data);
 9358|     59|            p_j2k->m_specific_param.m_decoder.m_header_data = 00;
 9359|     59|            p_j2k->m_specific_param.m_decoder.m_header_data_size = 0;
 9360|     59|        }
 9361|       |
 9362|     59|        opj_free(p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode);
 9363|     59|        p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode = 00;
 9364|     59|        p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode = 0;
 9365|       |
 9366|     59|        opj_free(p_j2k->m_specific_param.m_decoder.m_tlm.m_tile_part_infos);
 9367|     59|        p_j2k->m_specific_param.m_decoder.m_tlm.m_tile_part_infos = NULL;
 9368|       |
 9369|     59|        opj_free(p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset);
 9370|     59|        p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset = NULL;
 9371|       |
 9372|     59|    } else {
 9373|       |
 9374|      0|        if (p_j2k->m_specific_param.m_encoder.m_encoded_tile_data) {
  ------------------
  |  Branch (9374:13): [True: 0, False: 0]
  ------------------
 9375|      0|            opj_free(p_j2k->m_specific_param.m_encoder.m_encoded_tile_data);
 9376|      0|            p_j2k->m_specific_param.m_encoder.m_encoded_tile_data = 00;
 9377|      0|        }
 9378|       |
 9379|      0|        if (p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_buffer) {
  ------------------
  |  Branch (9379:13): [True: 0, False: 0]
  ------------------
 9380|      0|            opj_free(p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_buffer);
 9381|      0|            p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_buffer = 00;
 9382|      0|            p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_current = 00;
 9383|      0|        }
 9384|       |
 9385|      0|        if (p_j2k->m_specific_param.m_encoder.m_header_tile_data) {
  ------------------
  |  Branch (9385:13): [True: 0, False: 0]
  ------------------
 9386|      0|            opj_free(p_j2k->m_specific_param.m_encoder.m_header_tile_data);
 9387|      0|            p_j2k->m_specific_param.m_encoder.m_header_tile_data = 00;
 9388|      0|            p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = 0;
 9389|      0|        }
 9390|      0|    }
 9391|       |
 9392|     59|    opj_tcd_destroy(p_j2k->m_tcd);
 9393|       |
 9394|     59|    opj_j2k_cp_destroy(&(p_j2k->m_cp));
 9395|     59|    memset(&(p_j2k->m_cp), 0, sizeof(opj_cp_t));
 9396|       |
 9397|     59|    opj_procedure_list_destroy(p_j2k->m_procedure_list);
 9398|     59|    p_j2k->m_procedure_list = 00;
 9399|       |
 9400|     59|    opj_procedure_list_destroy(p_j2k->m_validation_list);
 9401|     59|    p_j2k->m_procedure_list = 00;
 9402|       |
 9403|     59|    j2k_destroy_cstr_index(p_j2k->cstr_index);
 9404|     59|    p_j2k->cstr_index = NULL;
 9405|       |
 9406|     59|    opj_image_destroy(p_j2k->m_private_image);
 9407|     59|    p_j2k->m_private_image = NULL;
 9408|       |
 9409|     59|    opj_image_destroy(p_j2k->m_output_image);
 9410|     59|    p_j2k->m_output_image = NULL;
 9411|       |
 9412|     59|    opj_thread_pool_destroy(p_j2k->m_tp);
 9413|     59|    p_j2k->m_tp = NULL;
 9414|       |
 9415|     59|    opj_free(p_j2k);
 9416|     59|}
j2k_destroy_cstr_index:
 9419|     59|{
 9420|     59|    if (p_cstr_ind) {
  ------------------
  |  Branch (9420:9): [True: 59, False: 0]
  ------------------
 9421|       |
 9422|     59|        if (p_cstr_ind->marker) {
  ------------------
  |  Branch (9422:13): [True: 59, False: 0]
  ------------------
 9423|     59|            opj_free(p_cstr_ind->marker);
 9424|     59|            p_cstr_ind->marker = NULL;
 9425|     59|        }
 9426|       |
 9427|     59|        if (p_cstr_ind->tile_index) {
  ------------------
  |  Branch (9427:13): [True: 39, False: 20]
  ------------------
 9428|     39|            OPJ_UINT32 it_tile = 0;
 9429|       |
 9430|  6.95k|            for (it_tile = 0; it_tile < p_cstr_ind->nb_of_tiles; it_tile++) {
  ------------------
  |  Branch (9430:31): [True: 6.91k, False: 39]
  ------------------
 9431|       |
 9432|  6.91k|                if (p_cstr_ind->tile_index[it_tile].packet_index) {
  ------------------
  |  Branch (9432:21): [True: 0, False: 6.91k]
  ------------------
 9433|      0|                    opj_free(p_cstr_ind->tile_index[it_tile].packet_index);
 9434|      0|                    p_cstr_ind->tile_index[it_tile].packet_index = NULL;
 9435|      0|                }
 9436|       |
 9437|  6.91k|                if (p_cstr_ind->tile_index[it_tile].tp_index) {
  ------------------
  |  Branch (9437:21): [True: 27, False: 6.88k]
  ------------------
 9438|     27|                    opj_free(p_cstr_ind->tile_index[it_tile].tp_index);
 9439|     27|                    p_cstr_ind->tile_index[it_tile].tp_index = NULL;
 9440|     27|                }
 9441|       |
 9442|  6.91k|                if (p_cstr_ind->tile_index[it_tile].marker) {
  ------------------
  |  Branch (9442:21): [True: 6.91k, False: 0]
  ------------------
 9443|  6.91k|                    opj_free(p_cstr_ind->tile_index[it_tile].marker);
 9444|  6.91k|                    p_cstr_ind->tile_index[it_tile].marker = NULL;
 9445|       |
 9446|  6.91k|                }
 9447|  6.91k|            }
 9448|       |
 9449|     39|            opj_free(p_cstr_ind->tile_index);
 9450|     39|            p_cstr_ind->tile_index = NULL;
 9451|     39|        }
 9452|       |
 9453|     59|        opj_free(p_cstr_ind);
 9454|     59|    }
 9455|     59|}
opj_j2k_read_tile_header:
 9697|     29|{
 9698|     29|    OPJ_UINT32 l_current_marker = J2K_MS_SOT;
  ------------------
  |  |   73|     29|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
 9699|     29|    OPJ_UINT32 l_marker_size;
 9700|     29|    const opj_dec_memory_marker_handler_t * l_marker_handler = 00;
 9701|     29|    opj_tcp_t * l_tcp = NULL;
 9702|     29|    const OPJ_UINT32 l_nb_tiles = p_j2k->m_cp.tw * p_j2k->m_cp.th;
 9703|       |
 9704|       |    /* preconditions */
 9705|     29|    assert(p_stream != 00);
 9706|     29|    assert(p_j2k != 00);
 9707|     29|    assert(p_manager != 00);
 9708|       |
 9709|       |    /* Reach the End Of Codestream ?*/
 9710|     29|    if (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_EOC) {
  ------------------
  |  Branch (9710:9): [True: 0, False: 29]
  ------------------
 9711|      0|        l_current_marker = J2K_MS_EOC;
  ------------------
  |  |   75|      0|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
 9712|      0|    }
 9713|       |    /* We need to encounter a SOT marker (a new tile-part header) */
 9714|     29|    else if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_TPHSOT) {
  ------------------
  |  Branch (9714:14): [True: 0, False: 29]
  ------------------
 9715|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9716|      0|    }
 9717|       |
 9718|       |    /* Read into the codestream until reach the EOC or ! can_decode ??? FIXME */
 9719|     56|    while ((!p_j2k->m_specific_param.m_decoder.m_can_decode) &&
  ------------------
  |  Branch (9719:12): [True: 43, False: 13]
  ------------------
 9720|     56|            (l_current_marker != J2K_MS_EOC)) {
  ------------------
  |  |   75|     43|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
  |  Branch (9720:13): [True: 43, False: 0]
  ------------------
 9721|       |
 9722|     43|        if (p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts > 0 &&
  ------------------
  |  Branch (9722:13): [True: 0, False: 43]
  ------------------
 9723|     43|                p_j2k->m_specific_param.m_decoder.m_idx_intersecting_tile_parts <
  ------------------
  |  Branch (9723:17): [True: 0, False: 0]
  ------------------
 9724|      0|                p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts) {
 9725|      0|            OPJ_OFF_T next_tp_sot_pos;
 9726|       |
 9727|      0|            next_tp_sot_pos =
 9728|      0|                p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset[p_j2k->m_specific_param.m_decoder.m_idx_intersecting_tile_parts];
 9729|      0|            ++p_j2k->m_specific_param.m_decoder.m_idx_intersecting_tile_parts;
 9730|      0|            if (!(opj_stream_read_seek(p_stream,
  ------------------
  |  Branch (9730:17): [True: 0, False: 0]
  ------------------
 9731|      0|                                       next_tp_sot_pos,
 9732|      0|                                       p_manager))) {
 9733|      0|                opj_event_msg(p_manager, EVT_ERROR, "Problem with seek function\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9734|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9735|      0|            }
 9736|       |
 9737|       |            /* Try to read 2 bytes (the marker ID) from stream and copy them into the buffer */
 9738|      0|            if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9738:17): [True: 0, False: 0]
  ------------------
 9739|      0|                                     p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9740|      0|                opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9741|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9742|      0|            }
 9743|       |
 9744|       |            /* Read 2 bytes from the buffer as the marker ID */
 9745|      0|            opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9746|      0|                           &l_current_marker,
 9747|      0|                           2);
 9748|       |
 9749|      0|            if (l_current_marker != J2K_MS_SOT) {
  ------------------
  |  |   73|      0|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (9749:17): [True: 0, False: 0]
  ------------------
 9750|      0|                opj_event_msg(p_manager, EVT_ERROR, "Did not get expected SOT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9751|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9752|      0|            }
 9753|      0|        }
 9754|       |
 9755|       |        /* Try to read until the Start Of Data is detected */
 9756|     73|        while (l_current_marker != J2K_MS_SOD) {
  ------------------
  |  |   74|     73|#define J2K_MS_SOD 0xff93   /**< SOD marker value */
  ------------------
  |  Branch (9756:16): [True: 46, False: 27]
  ------------------
 9757|       |
 9758|     46|            if (opj_stream_get_number_byte_left(p_stream) == 0) {
  ------------------
  |  Branch (9758:17): [True: 13, False: 33]
  ------------------
 9759|     13|                p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
 9760|     13|                break;
 9761|     13|            }
 9762|       |
 9763|       |            /* Try to read 2 bytes (the marker size) from stream and copy them into the buffer */
 9764|     33|            if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9764:17): [True: 0, False: 33]
  ------------------
 9765|     33|                                     p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9766|      0|                opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9767|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9768|      0|            }
 9769|       |
 9770|       |            /* Read 2 bytes from the buffer as the marker size */
 9771|     33|            opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data, &l_marker_size,
  ------------------
  |  |   65|     33|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9772|     33|                           2);
 9773|       |
 9774|       |            /* Check marker size (does not include marker ID but includes marker size) */
 9775|     33|            if (l_marker_size < 2) {
  ------------------
  |  Branch (9775:17): [True: 0, False: 33]
  ------------------
 9776|      0|                opj_event_msg(p_manager, EVT_ERROR, "Inconsistent marker size\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9777|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9778|      0|            }
 9779|       |
 9780|       |            /* cf. https://code.google.com/p/openjpeg/issues/detail?id=226 */
 9781|     33|            if (l_current_marker == 0x8080 &&
  ------------------
  |  Branch (9781:17): [True: 0, False: 33]
  ------------------
 9782|     33|                    opj_stream_get_number_byte_left(p_stream) == 0) {
  ------------------
  |  Branch (9782:21): [True: 0, False: 0]
  ------------------
 9783|      0|                p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
 9784|      0|                break;
 9785|      0|            }
 9786|       |
 9787|       |            /* Why this condition? FIXME */
 9788|     33|            if (p_j2k->m_specific_param.m_decoder.m_state & J2K_STATE_TPH) {
  ------------------
  |  Branch (9788:17): [True: 3, False: 30]
  ------------------
 9789|      3|                if (p_j2k->m_specific_param.m_decoder.m_sot_length < l_marker_size + 2) {
  ------------------
  |  Branch (9789:21): [True: 0, False: 3]
  ------------------
 9790|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9791|      0|                                  "Sot length is less than marker size + marker ID\n");
 9792|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9793|      0|                }
 9794|      3|                p_j2k->m_specific_param.m_decoder.m_sot_length -= (l_marker_size + 2);
 9795|      3|            }
 9796|     33|            l_marker_size -= 2; /* Subtract the size of the marker ID already read */
 9797|       |
 9798|       |            /* Get the marker handler from the marker ID */
 9799|     33|            l_marker_handler = opj_j2k_get_marker_handler(l_current_marker);
 9800|       |
 9801|       |            /* Check if the marker is known and if it is the right place to find it */
 9802|     33|            if (!(p_j2k->m_specific_param.m_decoder.m_state & l_marker_handler->states)) {
  ------------------
  |  Branch (9802:17): [True: 0, False: 33]
  ------------------
 9803|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9804|      0|                              "Marker is not compliant with its position\n");
 9805|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9806|      0|            }
 9807|       |            /* FIXME manage case of unknown marker as in the main header ? */
 9808|       |
 9809|       |            /* Check if the marker size is compatible with the header data size */
 9810|     33|            if (l_marker_size > p_j2k->m_specific_param.m_decoder.m_header_data_size) {
  ------------------
  |  Branch (9810:17): [True: 3, False: 30]
  ------------------
 9811|      3|                OPJ_BYTE *new_header_data = NULL;
 9812|       |                /* If we are here, this means we consider this marker as known & we will read it */
 9813|       |                /* Check enough bytes left in stream before allocation */
 9814|      3|                if ((OPJ_OFF_T)l_marker_size >  opj_stream_get_number_byte_left(p_stream)) {
  ------------------
  |  Branch (9814:21): [True: 0, False: 3]
  ------------------
 9815|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9816|      0|                                  "Marker size inconsistent with stream length\n");
 9817|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9818|      0|                }
 9819|      3|                new_header_data = (OPJ_BYTE *) opj_realloc(
 9820|      3|                                      p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size);
 9821|      3|                if (! new_header_data) {
  ------------------
  |  Branch (9821:21): [True: 0, False: 3]
  ------------------
 9822|      0|                    opj_free(p_j2k->m_specific_param.m_decoder.m_header_data);
 9823|      0|                    p_j2k->m_specific_param.m_decoder.m_header_data = NULL;
 9824|      0|                    p_j2k->m_specific_param.m_decoder.m_header_data_size = 0;
 9825|      0|                    opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read header\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9826|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9827|      0|                }
 9828|      3|                p_j2k->m_specific_param.m_decoder.m_header_data = new_header_data;
 9829|      3|                p_j2k->m_specific_param.m_decoder.m_header_data_size = l_marker_size;
 9830|      3|            }
 9831|       |
 9832|       |            /* Try to read the rest of the marker segment from stream and copy them into the buffer */
 9833|     33|            if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9833:17): [True: 0, False: 33]
  ------------------
 9834|     33|                                     p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size,
 9835|     33|                                     p_manager) != l_marker_size) {
 9836|      0|                opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9837|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9838|      0|            }
 9839|       |
 9840|     33|            if (!l_marker_handler->handler) {
  ------------------
  |  Branch (9840:17): [True: 1, False: 32]
  ------------------
 9841|       |                /* See issue #175 */
 9842|      1|                opj_event_msg(p_manager, EVT_ERROR, "Not sure how that happened.\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9843|      1|                return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 9844|      1|            }
 9845|       |            /* Read the marker segment with the correct marker handler */
 9846|     32|            if (!(*(l_marker_handler->handler))(p_j2k,
  ------------------
  |  Branch (9846:17): [True: 2, False: 30]
  ------------------
 9847|     32|                                                p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size, p_manager)) {
 9848|      2|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9849|      2|                              "Fail to read the current marker segment (%#x)\n", l_current_marker);
 9850|      2|                return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 9851|      2|            }
 9852|       |
 9853|       |            /* Add the marker to the codestream index*/
 9854|     30|            if (OPJ_FALSE == opj_j2k_add_tlmarker(p_j2k->m_current_tile_number,
  ------------------
  |  |  118|     30|#define OPJ_FALSE 0
  ------------------
  |  Branch (9854:17): [True: 0, False: 30]
  ------------------
 9855|     30|                                                  p_j2k->cstr_index,
 9856|     30|                                                  l_marker_handler->id,
 9857|     30|                                                  (OPJ_UINT32) opj_stream_tell(p_stream) - l_marker_size - 4,
 9858|     30|                                                  l_marker_size + 4)) {
 9859|      0|                opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add tl marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9860|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9861|      0|            }
 9862|       |
 9863|       |            /* Keep the position of the last SOT marker read */
 9864|     30|            if (l_marker_handler->id == J2K_MS_SOT) {
  ------------------
  |  |   73|     30|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (9864:17): [True: 28, False: 2]
  ------------------
 9865|     28|                OPJ_UINT32 sot_pos = (OPJ_UINT32) opj_stream_tell(p_stream) - l_marker_size - 4
 9866|     28|                                     ;
 9867|     28|                if (sot_pos > p_j2k->m_specific_param.m_decoder.m_last_sot_read_pos) {
  ------------------
  |  Branch (9867:21): [True: 28, False: 0]
  ------------------
 9868|     28|                    p_j2k->m_specific_param.m_decoder.m_last_sot_read_pos = sot_pos;
 9869|     28|                }
 9870|     28|            }
 9871|       |
 9872|     30|            if (p_j2k->m_specific_param.m_decoder.m_skip_data) {
  ------------------
  |  Branch (9872:17): [True: 0, False: 30]
  ------------------
 9873|       |                /* Skip the rest of the tile part header*/
 9874|      0|                if (opj_stream_skip(p_stream, p_j2k->m_specific_param.m_decoder.m_sot_length,
  ------------------
  |  Branch (9874:21): [True: 0, False: 0]
  ------------------
 9875|      0|                                    p_manager) != p_j2k->m_specific_param.m_decoder.m_sot_length) {
 9876|      0|                    opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9877|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9878|      0|                }
 9879|      0|                l_current_marker = J2K_MS_SOD; /* Normally we reached a SOD */
  ------------------
  |  |   74|      0|#define J2K_MS_SOD 0xff93   /**< SOD marker value */
  ------------------
 9880|     30|            } else {
 9881|       |                /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer*/
 9882|     30|                if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9882:21): [True: 0, False: 30]
  ------------------
 9883|     30|                                         p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9884|      0|                    opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9885|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9886|      0|                }
 9887|       |                /* Read 2 bytes from the buffer as the new marker ID */
 9888|     30|                opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|     30|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9889|     30|                               &l_current_marker, 2);
 9890|     30|            }
 9891|     30|        }
 9892|     40|        if (opj_stream_get_number_byte_left(p_stream) == 0
  ------------------
  |  Branch (9892:13): [True: 13, False: 27]
  ------------------
 9893|     40|                && p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NEOC) {
  ------------------
  |  Branch (9893:20): [True: 13, False: 0]
  ------------------
 9894|     13|            break;
 9895|     13|        }
 9896|       |
 9897|       |        /* If we didn't skip data before, we need to read the SOD marker*/
 9898|     27|        if (! p_j2k->m_specific_param.m_decoder.m_skip_data) {
  ------------------
  |  Branch (9898:13): [True: 27, False: 0]
  ------------------
 9899|       |            /* Try to read the SOD marker and skip data ? FIXME */
 9900|     27|            if (! opj_j2k_read_sod(p_j2k, p_stream, p_manager)) {
  ------------------
  |  Branch (9900:17): [True: 0, False: 27]
  ------------------
 9901|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9902|      0|            }
 9903|       |
 9904|       |            /* Check if we can use the TLM index to access the next tile-part */
 9905|     27|            if (!p_j2k->m_specific_param.m_decoder.m_can_decode &&
  ------------------
  |  Branch (9905:17): [True: 13, False: 14]
  ------------------
 9906|     27|                    p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec >= 0 &&
  ------------------
  |  Branch (9906:21): [True: 0, False: 13]
  ------------------
 9907|     27|                    p_j2k->m_current_tile_number == (OPJ_UINT32)
  ------------------
  |  Branch (9907:21): [True: 0, False: 0]
  ------------------
 9908|      0|                    p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec &&
 9909|     27|                    !p_j2k->m_specific_param.m_decoder.m_tlm.m_is_invalid &&
  ------------------
  |  Branch (9909:21): [True: 0, False: 0]
  ------------------
 9910|     27|                    opj_stream_has_seek(p_stream)) {
  ------------------
  |  Branch (9910:21): [True: 0, False: 0]
  ------------------
 9911|      0|                l_tcp = p_j2k->m_cp.tcps + p_j2k->m_current_tile_number;
 9912|      0|                if (l_tcp->m_nb_tile_parts ==
  ------------------
  |  Branch (9912:21): [True: 0, False: 0]
  ------------------
 9913|      0|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].nb_tps &&
 9914|      0|                        (OPJ_UINT32)l_tcp->m_current_tile_part_number + 1 < l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (9914:25): [True: 0, False: 0]
  ------------------
 9915|      0|                    const OPJ_OFF_T next_tp_sot_pos = p_j2k->cstr_index->tile_index[
 9916|      0|                                                          p_j2k->m_current_tile_number].tp_index[l_tcp->m_current_tile_part_number +
 9917|      0|                                                                  1].start_pos;
 9918|       |
 9919|      0|                    if (next_tp_sot_pos != opj_stream_tell(p_stream)) {
  ------------------
  |  Branch (9919:25): [True: 0, False: 0]
  ------------------
 9920|       |#if 0
 9921|       |                        opj_event_msg(p_manager, EVT_INFO,
 9922|       |                                      "opj_j2k_read_tile_header(tile=%u): seek to tile part %u at %" PRId64 "\n",
 9923|       |                                      p_j2k->m_current_tile_number,
 9924|       |                                      l_tcp->m_current_tile_part_number + 1,
 9925|       |                                      next_tp_sot_pos);
 9926|       |#endif
 9927|       |
 9928|      0|                        if (!(opj_stream_read_seek(p_stream,
  ------------------
  |  Branch (9928:29): [True: 0, False: 0]
  ------------------
 9929|      0|                                                   next_tp_sot_pos,
 9930|      0|                                                   p_manager))) {
 9931|      0|                            opj_event_msg(p_manager, EVT_ERROR, "Problem with seek function\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9932|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9933|      0|                        }
 9934|      0|                    }
 9935|       |
 9936|       |                    /* Try to read 2 bytes (the marker ID) from stream and copy them into the buffer */
 9937|      0|                    if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9937:25): [True: 0, False: 0]
  ------------------
 9938|      0|                                             p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9939|      0|                        opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9940|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9941|      0|                    }
 9942|       |
 9943|       |                    /* Read 2 bytes from the buffer as the marker ID */
 9944|      0|                    opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9945|      0|                                   &l_current_marker,
 9946|      0|                                   2);
 9947|       |
 9948|      0|                    if (l_current_marker != J2K_MS_SOT) {
  ------------------
  |  |   73|      0|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (9948:25): [True: 0, False: 0]
  ------------------
 9949|      0|                        opj_event_msg(p_manager, EVT_ERROR, "Did not get expected SOT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9950|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9951|      0|                    }
 9952|       |
 9953|      0|                    continue;
 9954|      0|                }
 9955|      0|            }
 9956|       |
 9957|     27|            if (p_j2k->m_specific_param.m_decoder.m_can_decode &&
  ------------------
  |  Branch (9957:17): [True: 14, False: 13]
  ------------------
 9958|     27|                    !p_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction_checked) {
  ------------------
  |  Branch (9958:21): [True: 11, False: 3]
  ------------------
 9959|       |                /* Issue 254 */
 9960|     11|                OPJ_BOOL l_correction_needed;
 9961|       |
 9962|     11|                p_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction_checked = 1;
 9963|     11|                if (!opj_j2k_need_nb_tile_parts_correction(p_stream,
  ------------------
  |  Branch (9963:21): [True: 0, False: 11]
  ------------------
 9964|     11|                        p_j2k->m_current_tile_number, &l_correction_needed, p_manager)) {
 9965|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9966|      0|                                  "opj_j2k_apply_nb_tile_parts_correction error\n");
 9967|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9968|      0|                }
 9969|     11|                if (l_correction_needed) {
  ------------------
  |  Branch (9969:21): [True: 1, False: 10]
  ------------------
 9970|      1|                    OPJ_UINT32 l_tile_no;
 9971|       |
 9972|      1|                    p_j2k->m_specific_param.m_decoder.m_can_decode = 0;
 9973|      1|                    p_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction = 1;
 9974|       |                    /* correct tiles */
 9975|  5.86k|                    for (l_tile_no = 0U; l_tile_no < l_nb_tiles; ++l_tile_no) {
  ------------------
  |  Branch (9975:42): [True: 5.86k, False: 1]
  ------------------
 9976|  5.86k|                        if (p_j2k->m_cp.tcps[l_tile_no].m_nb_tile_parts != 0U) {
  ------------------
  |  Branch (9976:29): [True: 1, False: 5.86k]
  ------------------
 9977|      1|                            p_j2k->m_cp.tcps[l_tile_no].m_nb_tile_parts += 1;
 9978|      1|                        }
 9979|  5.86k|                    }
 9980|      1|                    opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      1|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 9981|      1|                                  "Non conformant codestream TPsot==TNsot.\n");
 9982|      1|                }
 9983|     11|            }
 9984|     27|        } else {
 9985|       |            /* Indicate we will try to read a new tile-part header*/
 9986|      0|            p_j2k->m_specific_param.m_decoder.m_skip_data = 0;
 9987|      0|            p_j2k->m_specific_param.m_decoder.m_can_decode = 0;
 9988|      0|            p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPHSOT;
 9989|      0|        }
 9990|       |
 9991|     27|        if (! p_j2k->m_specific_param.m_decoder.m_can_decode) {
  ------------------
  |  Branch (9991:13): [True: 14, False: 13]
  ------------------
 9992|       |            /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */
 9993|     14|            if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9993:17): [True: 0, False: 14]
  ------------------
 9994|     14|                                     p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9995|       |
 9996|       |                /* Deal with likely non conformant SPOT6 files, where the last */
 9997|       |                /* row of tiles have TPsot == 0 and TNsot == 0, and missing EOC, */
 9998|       |                /* but no other tile-parts were found. */
 9999|      0|                if (p_j2k->m_current_tile_number + 1 == l_nb_tiles) {
  ------------------
  |  Branch (9999:21): [True: 0, False: 0]
  ------------------
10000|      0|                    OPJ_UINT32 l_tile_no;
10001|      0|                    for (l_tile_no = 0U; l_tile_no < l_nb_tiles; ++l_tile_no) {
  ------------------
  |  Branch (10001:42): [True: 0, False: 0]
  ------------------
10002|      0|                        if (p_j2k->m_cp.tcps[l_tile_no].m_current_tile_part_number == 0 &&
  ------------------
  |  Branch (10002:29): [True: 0, False: 0]
  ------------------
10003|      0|                                p_j2k->m_cp.tcps[l_tile_no].m_nb_tile_parts == 0) {
  ------------------
  |  Branch (10003:33): [True: 0, False: 0]
  ------------------
10004|      0|                            break;
10005|      0|                        }
10006|      0|                    }
10007|      0|                    if (l_tile_no < l_nb_tiles) {
  ------------------
  |  Branch (10007:25): [True: 0, False: 0]
  ------------------
10008|      0|                        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|      0|#define EVT_INFO    4   /**< Debug event type */
  ------------------
10009|      0|                                      "Tile %u has TPsot == 0 and TNsot == 0, "
10010|      0|                                      "but no other tile-parts were found. "
10011|      0|                                      "EOC is also missing.\n",
10012|      0|                                      l_tile_no);
10013|      0|                        p_j2k->m_current_tile_number = l_tile_no;
10014|      0|                        l_current_marker = J2K_MS_EOC;
  ------------------
  |  |   75|      0|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
10015|      0|                        p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
10016|      0|                        break;
10017|      0|                    }
10018|      0|                }
10019|       |
10020|      0|                opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10021|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10022|      0|            }
10023|       |
10024|       |            /* Read 2 bytes from buffer as the new marker ID */
10025|     14|            opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|     14|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10026|     14|                           &l_current_marker, 2);
10027|     14|        }
10028|     27|    }
10029|       |
10030|       |    /* Current marker is the EOC marker ?*/
10031|     26|    if (l_current_marker == J2K_MS_EOC) {
  ------------------
  |  |   75|     26|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
  |  Branch (10031:9): [True: 0, False: 26]
  ------------------
10032|      0|        if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_EOC) {
  ------------------
  |  Branch (10032:13): [True: 0, False: 0]
  ------------------
10033|      0|            p_j2k->m_current_tile_number = 0;
10034|      0|            p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
10035|      0|        }
10036|      0|    }
10037|       |
10038|       |    /* Deal with tiles that have a single tile-part with TPsot == 0 and TNsot == 0 */
10039|     26|    if (! p_j2k->m_specific_param.m_decoder.m_can_decode) {
  ------------------
  |  Branch (10039:9): [True: 13, False: 13]
  ------------------
10040|     13|        l_tcp = p_j2k->m_cp.tcps + p_j2k->m_current_tile_number;
10041|       |
10042|     13|        while ((p_j2k->m_current_tile_number < l_nb_tiles) && (l_tcp->m_data == 00)) {
  ------------------
  |  Branch (10042:16): [True: 13, False: 0]
  |  Branch (10042:63): [True: 0, False: 13]
  ------------------
10043|      0|            ++p_j2k->m_current_tile_number;
10044|      0|            ++l_tcp;
10045|      0|        }
10046|       |
10047|     13|        if (p_j2k->m_current_tile_number == l_nb_tiles) {
  ------------------
  |  Branch (10047:13): [True: 0, False: 13]
  ------------------
10048|      0|            *p_go_on = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10049|      0|            return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
10050|      0|        }
10051|     13|    }
10052|       |
10053|     26|    if (! opj_j2k_merge_ppt(p_j2k->m_cp.tcps + p_j2k->m_current_tile_number,
  ------------------
  |  Branch (10053:9): [True: 0, False: 26]
  ------------------
10054|     26|                            p_manager)) {
10055|      0|        opj_event_msg(p_manager, EVT_ERROR, "Failed to merge PPT data\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10056|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10057|      0|    }
10058|       |    /*FIXME ???*/
10059|     26|    if (! opj_tcd_init_decode_tile(p_j2k->m_tcd, p_j2k->m_current_tile_number,
  ------------------
  |  Branch (10059:9): [True: 0, False: 26]
  ------------------
10060|     26|                                   p_manager)) {
10061|      0|        opj_event_msg(p_manager, EVT_ERROR, "Cannot decode tile, memory error\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10062|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10063|      0|    }
10064|       |
10065|     26|    opj_event_msg(p_manager, EVT_INFO, "Header of tile %d / %d has been read.\n",
  ------------------
  |  |   68|     26|#define EVT_INFO    4   /**< Debug event type */
  ------------------
10066|     26|                  p_j2k->m_current_tile_number + 1, (p_j2k->m_cp.th * p_j2k->m_cp.tw));
10067|       |
10068|     26|    *p_tile_index = p_j2k->m_current_tile_number;
10069|     26|    *p_go_on = OPJ_TRUE;
  ------------------
  |  |  117|     26|#define OPJ_TRUE 1
  ------------------
10070|     26|    if (p_data_size) {
  ------------------
  |  Branch (10070:9): [True: 0, False: 26]
  ------------------
10071|       |        /* For internal use in j2k.c, we don't need this */
10072|       |        /* This is just needed for folks using the opj_read_tile_header() / opj_decode_tile_data() combo */
10073|      0|        *p_data_size = opj_tcd_get_decoded_tile_size(p_j2k->m_tcd, OPJ_FALSE);
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10074|      0|        if (*p_data_size == UINT_MAX) {
  ------------------
  |  Branch (10074:13): [True: 0, False: 0]
  ------------------
10075|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10076|      0|        }
10077|      0|    }
10078|     26|    *p_tile_x0 = p_j2k->m_tcd->tcd_image->tiles->x0;
10079|     26|    *p_tile_y0 = p_j2k->m_tcd->tcd_image->tiles->y0;
10080|     26|    *p_tile_x1 = p_j2k->m_tcd->tcd_image->tiles->x1;
10081|     26|    *p_tile_y1 = p_j2k->m_tcd->tcd_image->tiles->y1;
10082|     26|    *p_nb_comps = p_j2k->m_tcd->tcd_image->tiles->numcomps;
10083|       |
10084|     26|    p_j2k->m_specific_param.m_decoder.m_state |= J2K_STATE_DATA;
10085|       |
10086|     26|    return OPJ_TRUE;
  ------------------
  |  |  117|     26|#define OPJ_TRUE 1
  ------------------
10087|     26|}
opj_j2k_decode_tile:
10095|     26|{
10096|     26|    OPJ_UINT32 l_current_marker;
10097|     26|    OPJ_BYTE l_data [2];
10098|     26|    opj_tcp_t * l_tcp;
10099|     26|    opj_image_t* l_image_for_bounds;
10100|       |
10101|       |    /* preconditions */
10102|     26|    assert(p_stream != 00);
10103|     26|    assert(p_j2k != 00);
10104|     26|    assert(p_manager != 00);
10105|       |
10106|     26|    if (!(p_j2k->m_specific_param.m_decoder.m_state & J2K_STATE_DATA)
  ------------------
  |  Branch (10106:9): [True: 0, False: 26]
  ------------------
10107|     26|            || (p_tile_index != p_j2k->m_current_tile_number)) {
  ------------------
  |  Branch (10107:16): [True: 0, False: 26]
  ------------------
10108|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10109|      0|    }
10110|       |
10111|     26|    l_tcp = &(p_j2k->m_cp.tcps[p_tile_index]);
10112|     26|    if (! l_tcp->m_data) {
  ------------------
  |  Branch (10112:9): [True: 0, False: 26]
  ------------------
10113|      0|        opj_j2k_tcp_destroy(l_tcp);
10114|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10115|      0|    }
10116|       |
10117|       |    /* When using the opj_read_tile_header / opj_decode_tile_data API */
10118|       |    /* such as in test_tile_decoder, m_output_image is NULL, so fall back */
10119|       |    /* to the full image dimension. This is a bit surprising that */
10120|       |    /* opj_set_decode_area() is only used to determine intersecting tiles, */
10121|       |    /* but full tile decoding is done */
10122|     26|    l_image_for_bounds = p_j2k->m_output_image ? p_j2k->m_output_image :
  ------------------
  |  Branch (10122:26): [True: 26, False: 0]
  ------------------
10123|     26|                         p_j2k->m_private_image;
10124|     26|    if (! opj_tcd_decode_tile(p_j2k->m_tcd,
  ------------------
  |  Branch (10124:9): [True: 19, False: 7]
  ------------------
10125|     26|                              l_image_for_bounds->x0,
10126|     26|                              l_image_for_bounds->y0,
10127|     26|                              l_image_for_bounds->x1,
10128|     26|                              l_image_for_bounds->y1,
10129|     26|                              p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode,
10130|     26|                              p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode,
10131|     26|                              l_tcp->m_data,
10132|     26|                              l_tcp->m_data_size,
10133|     26|                              p_tile_index,
10134|     26|                              p_j2k->cstr_index, p_manager)) {
10135|     19|        opj_j2k_tcp_destroy(l_tcp);
10136|     19|        p_j2k->m_specific_param.m_decoder.m_state |= J2K_STATE_ERR;
10137|     19|        opj_event_msg(p_manager, EVT_ERROR, "Failed to decode.\n");
  ------------------
  |  |   66|     19|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10138|     19|        return OPJ_FALSE;
  ------------------
  |  |  118|     19|#define OPJ_FALSE 0
  ------------------
10139|     19|    }
10140|       |
10141|       |    /* p_data can be set to NULL when the call will take care of using */
10142|       |    /* itself the TCD data. This is typically the case for whole single */
10143|       |    /* tile decoding optimization. */
10144|      7|    if (p_data != NULL) {
  ------------------
  |  Branch (10144:9): [True: 0, False: 7]
  ------------------
10145|      0|        if (! opj_tcd_update_tile_data(p_j2k->m_tcd, p_data, p_data_size)) {
  ------------------
  |  Branch (10145:13): [True: 0, False: 0]
  ------------------
10146|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10147|      0|        }
10148|       |
10149|       |        /* To avoid to destroy the tcp which can be useful when we try to decode a tile decoded before (cf j2k_random_tile_access)
10150|       |        * we destroy just the data which will be re-read in read_tile_header*/
10151|       |        /*opj_j2k_tcp_destroy(l_tcp);
10152|       |        p_j2k->m_tcd->tcp = 0;*/
10153|      0|        opj_j2k_tcp_data_destroy(l_tcp);
10154|      0|    }
10155|       |
10156|      7|    p_j2k->m_specific_param.m_decoder.m_can_decode = 0;
10157|      7|    p_j2k->m_specific_param.m_decoder.m_state &= (~(OPJ_UINT32)J2K_STATE_DATA);
10158|       |
10159|      7|    if (opj_stream_get_number_byte_left(p_stream) == 0
  ------------------
  |  Branch (10159:9): [True: 1, False: 6]
  ------------------
10160|      7|            && p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NEOC) {
  ------------------
  |  Branch (10160:16): [True: 1, False: 0]
  ------------------
10161|      1|        return OPJ_TRUE;
  ------------------
  |  |  117|      1|#define OPJ_TRUE 1
  ------------------
10162|      1|    }
10163|       |
10164|      6|    if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_EOC) {
  ------------------
  |  Branch (10164:9): [True: 6, False: 0]
  ------------------
10165|      6|        if (opj_stream_read_data(p_stream, l_data, 2, p_manager) != 2) {
  ------------------
  |  Branch (10165:13): [True: 0, False: 6]
  ------------------
10166|      0|            opj_event_msg(p_manager, p_j2k->m_cp.strict ? EVT_ERROR : EVT_WARNING,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
                          opj_event_msg(p_manager, p_j2k->m_cp.strict ? EVT_ERROR : EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
  |  Branch (10166:38): [True: 0, False: 0]
  ------------------
10167|      0|                          "Stream too short\n");
10168|      0|            return p_j2k->m_cp.strict ? OPJ_FALSE : OPJ_TRUE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
                          return p_j2k->m_cp.strict ? OPJ_FALSE : OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
  |  Branch (10168:20): [True: 0, False: 0]
  ------------------
10169|      0|        }
10170|      6|        opj_read_bytes(l_data, &l_current_marker, 2);
  ------------------
  |  |   65|      6|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10171|       |
10172|      6|        if (l_current_marker == J2K_MS_EOC) {
  ------------------
  |  |   75|      6|#define J2K_MS_EOC 0xffd9   /**< EOC marker value */
  ------------------
  |  Branch (10172:13): [True: 0, False: 6]
  ------------------
10173|      0|            p_j2k->m_current_tile_number = 0;
10174|      0|            p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
10175|      6|        } else if (l_current_marker != J2K_MS_SOT) {
  ------------------
  |  |   73|      6|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (10175:20): [True: 4, False: 2]
  ------------------
10176|      4|            if (opj_stream_get_number_byte_left(p_stream) == 0) {
  ------------------
  |  Branch (10176:17): [True: 1, False: 3]
  ------------------
10177|      1|                p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
10178|      1|                opj_event_msg(p_manager, EVT_WARNING, "Stream does not end with EOC\n");
  ------------------
  |  |   67|      1|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10179|      1|                return OPJ_TRUE;
  ------------------
  |  |  117|      1|#define OPJ_TRUE 1
  ------------------
10180|      1|            }
10181|      3|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short, expected SOT\n");
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10182|      3|            return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
10183|      4|        }
10184|      6|    }
10185|       |
10186|      2|    return OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
10187|      6|}
opj_j2k_set_decode_area:
10521|     27|{
10522|     27|    opj_cp_t * l_cp = &(p_j2k->m_cp);
10523|     27|    opj_image_t * l_image = p_j2k->m_private_image;
10524|     27|    OPJ_BOOL ret;
10525|     27|    OPJ_UINT32 it_comp;
10526|       |
10527|     27|    if (p_j2k->m_cp.tw == 1 && p_j2k->m_cp.th == 1 &&
  ------------------
  |  Branch (10527:9): [True: 16, False: 11]
  |  Branch (10527:32): [True: 12, False: 4]
  ------------------
10528|     27|            p_j2k->m_cp.tcps[0].m_data != NULL) {
  ------------------
  |  Branch (10528:13): [True: 0, False: 12]
  ------------------
10529|       |        /* In the case of a single-tiled image whose codestream we have already */
10530|       |        /* ingested, go on */
10531|      0|    }
10532|       |    /* Check if we are read the main header */
10533|     27|    else if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_TPHSOT) {
  ------------------
  |  Branch (10533:14): [True: 0, False: 27]
  ------------------
10534|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10535|      0|                      "Need to decode the main header before begin to decode the remaining codestream.\n");
10536|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10537|      0|    }
10538|       |
10539|       |    /* Update the comps[].factor member of the output image with the one */
10540|       |    /* of m_reduce */
10541|    112|    for (it_comp = 0; it_comp < p_image->numcomps; ++it_comp) {
  ------------------
  |  Branch (10541:23): [True: 85, False: 27]
  ------------------
10542|     85|        p_image->comps[it_comp].factor = p_j2k->m_cp.m_specific_param.m_dec.m_reduce;
10543|     85|    }
10544|       |
10545|     27|    if (!p_start_x && !p_start_y && !p_end_x && !p_end_y) {
  ------------------
  |  Branch (10545:9): [True: 23, False: 4]
  |  Branch (10545:23): [True: 23, False: 0]
  |  Branch (10545:37): [True: 0, False: 23]
  |  Branch (10545:49): [True: 0, False: 0]
  ------------------
10546|      0|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|      0|#define EVT_INFO    4   /**< Debug event type */
  ------------------
10547|      0|                      "No decoded area parameters, set the decoded area to the whole image\n");
10548|       |
10549|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_x = 0;
10550|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_y = 0;
10551|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = l_cp->tw;
10552|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = l_cp->th;
10553|       |
10554|      0|        p_image->x0 = l_image->x0;
10555|      0|        p_image->y0 = l_image->y0;
10556|      0|        p_image->x1 = l_image->x1;
10557|      0|        p_image->y1 = l_image->y1;
10558|       |
10559|      0|        return opj_j2k_update_image_dimensions(p_image, p_manager);
10560|      0|    }
10561|       |
10562|       |    /* ----- */
10563|       |    /* Check if the positions provided by the user are correct */
10564|       |
10565|       |    /* Left */
10566|     27|    if (p_start_x < 0) {
  ------------------
  |  Branch (10566:9): [True: 0, False: 27]
  ------------------
10567|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10568|      0|                      "Left position of the decoded area (region_x0=%d) should be >= 0.\n",
10569|      0|                      p_start_x);
10570|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10571|     27|    } else if ((OPJ_UINT32)p_start_x > l_image->x1) {
  ------------------
  |  Branch (10571:16): [True: 0, False: 27]
  ------------------
10572|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10573|      0|                      "Left position of the decoded area (region_x0=%d) is outside the image area (Xsiz=%d).\n",
10574|      0|                      p_start_x, l_image->x1);
10575|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10576|     27|    } else if ((OPJ_UINT32)p_start_x < l_image->x0) {
  ------------------
  |  Branch (10576:16): [True: 0, False: 27]
  ------------------
10577|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10578|      0|                      "Left position of the decoded area (region_x0=%d) is outside the image area (XOsiz=%d).\n",
10579|      0|                      p_start_x, l_image->x0);
10580|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_x = 0;
10581|      0|        p_image->x0 = l_image->x0;
10582|     27|    } else {
10583|     27|        p_j2k->m_specific_param.m_decoder.m_start_tile_x = ((OPJ_UINT32)p_start_x -
10584|     27|                l_cp->tx0) / l_cp->tdx;
10585|     27|        p_image->x0 = (OPJ_UINT32)p_start_x;
10586|     27|    }
10587|       |
10588|       |    /* Up */
10589|     27|    if (p_start_y < 0) {
  ------------------
  |  Branch (10589:9): [True: 0, False: 27]
  ------------------
10590|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10591|      0|                      "Up position of the decoded area (region_y0=%d) should be >= 0.\n",
10592|      0|                      p_start_y);
10593|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10594|     27|    } else if ((OPJ_UINT32)p_start_y > l_image->y1) {
  ------------------
  |  Branch (10594:16): [True: 0, False: 27]
  ------------------
10595|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10596|      0|                      "Up position of the decoded area (region_y0=%d) is outside the image area (Ysiz=%d).\n",
10597|      0|                      p_start_y, l_image->y1);
10598|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10599|     27|    } else if ((OPJ_UINT32)p_start_y < l_image->y0) {
  ------------------
  |  Branch (10599:16): [True: 0, False: 27]
  ------------------
10600|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10601|      0|                      "Up position of the decoded area (region_y0=%d) is outside the image area (YOsiz=%d).\n",
10602|      0|                      p_start_y, l_image->y0);
10603|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_y = 0;
10604|      0|        p_image->y0 = l_image->y0;
10605|     27|    } else {
10606|     27|        p_j2k->m_specific_param.m_decoder.m_start_tile_y = ((OPJ_UINT32)p_start_y -
10607|     27|                l_cp->ty0) / l_cp->tdy;
10608|     27|        p_image->y0 = (OPJ_UINT32)p_start_y;
10609|     27|    }
10610|       |
10611|       |    /* Right */
10612|     27|    if (p_end_x <= 0) {
  ------------------
  |  Branch (10612:9): [True: 0, False: 27]
  ------------------
10613|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10614|      0|                      "Right position of the decoded area (region_x1=%d) should be > 0.\n",
10615|      0|                      p_end_x);
10616|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10617|     27|    } else if ((OPJ_UINT32)p_end_x < l_image->x0) {
  ------------------
  |  Branch (10617:16): [True: 0, False: 27]
  ------------------
10618|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10619|      0|                      "Right position of the decoded area (region_x1=%d) is outside the image area (XOsiz=%d).\n",
10620|      0|                      p_end_x, l_image->x0);
10621|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10622|     27|    } else if ((OPJ_UINT32)p_end_x > l_image->x1) {
  ------------------
  |  Branch (10622:16): [True: 0, False: 27]
  ------------------
10623|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10624|      0|                      "Right position of the decoded area (region_x1=%d) is outside the image area (Xsiz=%d).\n",
10625|      0|                      p_end_x, l_image->x1);
10626|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = l_cp->tw;
10627|      0|        p_image->x1 = l_image->x1;
10628|     27|    } else {
10629|     27|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = opj_uint_ceildiv((
10630|     27|                    OPJ_UINT32)p_end_x - l_cp->tx0, l_cp->tdx);
10631|     27|        p_image->x1 = (OPJ_UINT32)p_end_x;
10632|     27|    }
10633|       |
10634|       |    /* Bottom */
10635|     27|    if (p_end_y <= 0) {
  ------------------
  |  Branch (10635:9): [True: 0, False: 27]
  ------------------
10636|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10637|      0|                      "Bottom position of the decoded area (region_y1=%d) should be > 0.\n",
10638|      0|                      p_end_y);
10639|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10640|     27|    } else if ((OPJ_UINT32)p_end_y < l_image->y0) {
  ------------------
  |  Branch (10640:16): [True: 0, False: 27]
  ------------------
10641|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10642|      0|                      "Bottom position of the decoded area (region_y1=%d) is outside the image area (YOsiz=%d).\n",
10643|      0|                      p_end_y, l_image->y0);
10644|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10645|      0|    }
10646|     27|    if ((OPJ_UINT32)p_end_y > l_image->y1) {
  ------------------
  |  Branch (10646:9): [True: 0, False: 27]
  ------------------
10647|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
10648|      0|                      "Bottom position of the decoded area (region_y1=%d) is outside the image area (Ysiz=%d).\n",
10649|      0|                      p_end_y, l_image->y1);
10650|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = l_cp->th;
10651|      0|        p_image->y1 = l_image->y1;
10652|     27|    } else {
10653|     27|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = opj_uint_ceildiv((
10654|     27|                    OPJ_UINT32)p_end_y - l_cp->ty0, l_cp->tdy);
10655|     27|        p_image->y1 = (OPJ_UINT32)p_end_y;
10656|     27|    }
10657|       |    /* ----- */
10658|       |
10659|     27|    p_j2k->m_specific_param.m_decoder.m_discard_tiles = 1;
10660|       |
10661|     27|    ret = opj_j2k_update_image_dimensions(p_image, p_manager);
10662|       |
10663|     27|    if (ret) {
  ------------------
  |  Branch (10663:9): [True: 27, False: 0]
  ------------------
10664|     27|        opj_event_msg(p_manager, EVT_INFO, "Setting decoding area to %d,%d,%d,%d\n",
  ------------------
  |  |   68|     27|#define EVT_INFO    4   /**< Debug event type */
  ------------------
10665|     27|                      p_image->x0, p_image->y0, p_image->x1, p_image->y1);
10666|     27|    }
10667|       |
10668|     27|    return ret;
10669|     27|}
opj_j2k_create_decompress:
10672|     59|{
10673|     59|    opj_j2k_t *l_j2k = (opj_j2k_t*) opj_calloc(1, sizeof(opj_j2k_t));
10674|     59|    if (!l_j2k) {
  ------------------
  |  Branch (10674:9): [True: 0, False: 59]
  ------------------
10675|      0|        return 00;
10676|      0|    }
10677|       |
10678|     59|    l_j2k->m_is_decoder = 1;
10679|     59|    l_j2k->m_cp.m_is_decoder = 1;
10680|       |    /* in the absence of JP2 boxes, consider different bit depth / sign */
10681|       |    /* per component is allowed */
10682|     59|    l_j2k->m_cp.allow_different_bit_depth_sign = 1;
10683|       |
10684|       |    /* Default to using strict mode. */
10685|     59|    l_j2k->m_cp.strict = OPJ_TRUE;
  ------------------
  |  |  117|     59|#define OPJ_TRUE 1
  ------------------
10686|       |
10687|       |#ifdef OPJ_DISABLE_TPSOT_FIX
10688|       |    l_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction_checked = 1;
10689|       |#endif
10690|       |
10691|     59|    l_j2k->m_specific_param.m_decoder.m_default_tcp = (opj_tcp_t*) opj_calloc(1,
10692|     59|            sizeof(opj_tcp_t));
10693|     59|    if (!l_j2k->m_specific_param.m_decoder.m_default_tcp) {
  ------------------
  |  Branch (10693:9): [True: 0, False: 59]
  ------------------
10694|      0|        opj_j2k_destroy(l_j2k);
10695|      0|        return 00;
10696|      0|    }
10697|       |
10698|     59|    l_j2k->m_specific_param.m_decoder.m_header_data = (OPJ_BYTE *) opj_calloc(1,
10699|     59|            OPJ_J2K_DEFAULT_HEADER_SIZE);
  ------------------
  |  |  159|     59|#define OPJ_J2K_DEFAULT_HEADER_SIZE         1000
  ------------------
10700|     59|    if (! l_j2k->m_specific_param.m_decoder.m_header_data) {
  ------------------
  |  Branch (10700:9): [True: 0, False: 59]
  ------------------
10701|      0|        opj_j2k_destroy(l_j2k);
10702|      0|        return 00;
10703|      0|    }
10704|       |
10705|     59|    l_j2k->m_specific_param.m_decoder.m_header_data_size =
10706|     59|        OPJ_J2K_DEFAULT_HEADER_SIZE;
  ------------------
  |  |  159|     59|#define OPJ_J2K_DEFAULT_HEADER_SIZE         1000
  ------------------
10707|       |
10708|     59|    l_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec = -1 ;
10709|       |
10710|     59|    l_j2k->m_specific_param.m_decoder.m_last_sot_read_pos = 0 ;
10711|       |
10712|       |    /* codestream index creation */
10713|     59|    l_j2k->cstr_index = opj_j2k_create_cstr_index();
10714|     59|    if (!l_j2k->cstr_index) {
  ------------------
  |  Branch (10714:9): [True: 0, False: 59]
  ------------------
10715|      0|        opj_j2k_destroy(l_j2k);
10716|      0|        return 00;
10717|      0|    }
10718|       |
10719|       |    /* validation list creation */
10720|     59|    l_j2k->m_validation_list = opj_procedure_list_create();
10721|     59|    if (! l_j2k->m_validation_list) {
  ------------------
  |  Branch (10721:9): [True: 0, False: 59]
  ------------------
10722|      0|        opj_j2k_destroy(l_j2k);
10723|      0|        return 00;
10724|      0|    }
10725|       |
10726|       |    /* execution list creation */
10727|     59|    l_j2k->m_procedure_list = opj_procedure_list_create();
10728|     59|    if (! l_j2k->m_procedure_list) {
  ------------------
  |  Branch (10728:9): [True: 0, False: 59]
  ------------------
10729|      0|        opj_j2k_destroy(l_j2k);
10730|      0|        return 00;
10731|      0|    }
10732|       |
10733|     59|    l_j2k->m_tp = opj_thread_pool_create(opj_j2k_get_default_thread_count());
10734|     59|    if (!l_j2k->m_tp) {
  ------------------
  |  Branch (10734:9): [True: 0, False: 59]
  ------------------
10735|      0|        l_j2k->m_tp = opj_thread_pool_create(0);
10736|      0|    }
10737|     59|    if (!l_j2k->m_tp) {
  ------------------
  |  Branch (10737:9): [True: 0, False: 59]
  ------------------
10738|      0|        opj_j2k_destroy(l_j2k);
10739|      0|        return NULL;
10740|      0|    }
10741|       |
10742|     59|    return l_j2k;
10743|     59|}
opj_j2k_decode:
12359|     27|{
12360|     27|    if (!p_image) {
  ------------------
  |  Branch (12360:9): [True: 0, False: 27]
  ------------------
12361|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12362|      0|    }
12363|       |
12364|       |    /* Heuristics to detect sequence opj_read_header(), opj_set_decoded_resolution_factor() */
12365|       |    /* and finally opj_decode_image() without manual setting of comps[].factor */
12366|       |    /* We could potentially always execute it, if we don't allow people to do */
12367|       |    /* opj_read_header(), modify x0,y0,x1,y1 of returned image an call opj_decode_image() */
12368|     27|    if (p_j2k->m_cp.m_specific_param.m_dec.m_reduce > 0 &&
  ------------------
  |  Branch (12368:9): [True: 0, False: 27]
  ------------------
12369|     27|            p_j2k->m_private_image != NULL &&
  ------------------
  |  Branch (12369:13): [True: 0, False: 0]
  ------------------
12370|     27|            p_j2k->m_private_image->numcomps > 0 &&
  ------------------
  |  Branch (12370:13): [True: 0, False: 0]
  ------------------
12371|     27|            p_j2k->m_private_image->comps[0].factor ==
  ------------------
  |  Branch (12371:13): [True: 0, False: 0]
  ------------------
12372|      0|            p_j2k->m_cp.m_specific_param.m_dec.m_reduce &&
12373|     27|            p_image->numcomps > 0 &&
  ------------------
  |  Branch (12373:13): [True: 0, False: 0]
  ------------------
12374|     27|            p_image->comps[0].factor == 0 &&
  ------------------
  |  Branch (12374:13): [True: 0, False: 0]
  ------------------
12375|       |            /* Don't mess with image dimension if the user has allocated it */
12376|     27|            p_image->comps[0].data == NULL) {
  ------------------
  |  Branch (12376:13): [True: 0, False: 0]
  ------------------
12377|      0|        OPJ_UINT32 it_comp;
12378|       |
12379|       |        /* Update the comps[].factor member of the output image with the one */
12380|       |        /* of m_reduce */
12381|      0|        for (it_comp = 0; it_comp < p_image->numcomps; ++it_comp) {
  ------------------
  |  Branch (12381:27): [True: 0, False: 0]
  ------------------
12382|      0|            p_image->comps[it_comp].factor = p_j2k->m_cp.m_specific_param.m_dec.m_reduce;
12383|      0|        }
12384|      0|        if (!opj_j2k_update_image_dimensions(p_image, p_manager)) {
  ------------------
  |  Branch (12384:13): [True: 0, False: 0]
  ------------------
12385|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12386|      0|        }
12387|      0|    }
12388|       |
12389|     27|    if (p_j2k->m_output_image == NULL) {
  ------------------
  |  Branch (12389:9): [True: 27, False: 0]
  ------------------
12390|     27|        p_j2k->m_output_image = opj_image_create0();
12391|     27|        if (!(p_j2k->m_output_image)) {
  ------------------
  |  Branch (12391:13): [True: 0, False: 27]
  ------------------
12392|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12393|      0|        }
12394|     27|    }
12395|     27|    opj_copy_image_header(p_image, p_j2k->m_output_image);
12396|       |
12397|       |    /* customization of the decoding */
12398|     27|    if (!opj_j2k_setup_decoding(p_j2k, p_manager)) {
  ------------------
  |  Branch (12398:9): [True: 0, False: 27]
  ------------------
12399|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12400|      0|    }
12401|       |
12402|       |    /* Decode the codestream */
12403|     27|    if (! opj_j2k_exec(p_j2k, p_j2k->m_procedure_list, p_stream, p_manager)) {
  ------------------
  |  Branch (12403:9): [True: 25, False: 2]
  ------------------
12404|     25|        opj_image_destroy(p_j2k->m_private_image);
12405|     25|        p_j2k->m_private_image = NULL;
12406|     25|        return OPJ_FALSE;
  ------------------
  |  |  118|     25|#define OPJ_FALSE 0
  ------------------
12407|     25|    }
12408|       |
12409|       |    /* Move data and copy one information from codec to output image*/
12410|      2|    return opj_j2k_move_data_from_codec_to_output_image(p_j2k, p_image);
12411|     27|}
j2k.c:opj_j2k_get_default_thread_count:
 6790|     59|{
 6791|     59|    const char* num_threads_str = getenv("OPJ_NUM_THREADS");
 6792|     59|    int num_cpus;
 6793|     59|    int num_threads;
 6794|       |
 6795|     59|    if (num_threads_str == NULL || !opj_has_thread_support()) {
  ------------------
  |  Branch (6795:9): [True: 59, False: 0]
  |  Branch (6795:36): [True: 0, False: 0]
  ------------------
 6796|     59|        return 0;
 6797|     59|    }
 6798|      0|    num_cpus = opj_get_num_cpus();
 6799|      0|    if (strcmp(num_threads_str, "ALL_CPUS") == 0) {
  ------------------
  |  Branch (6799:9): [True: 0, False: 0]
  ------------------
 6800|      0|        return num_cpus;
 6801|      0|    }
 6802|      0|    if (num_cpus == 0) {
  ------------------
  |  Branch (6802:9): [True: 0, False: 0]
  ------------------
 6803|      0|        num_cpus = 32;
 6804|      0|    }
 6805|      0|    num_threads = atoi(num_threads_str);
 6806|      0|    if (num_threads < 0) {
  ------------------
  |  Branch (6806:9): [True: 0, False: 0]
  ------------------
 6807|      0|        num_threads = 0;
 6808|      0|    } else if (num_threads > 2 * num_cpus) {
  ------------------
  |  Branch (6808:16): [True: 0, False: 0]
  ------------------
 6809|      0|        num_threads = 2 * num_cpus;
 6810|      0|    }
 6811|      0|    return num_threads;
 6812|      0|}
j2k.c:opj_j2k_setup_header_reading:
 8534|     40|{
 8535|       |    /* preconditions*/
 8536|     40|    assert(p_j2k != 00);
 8537|     40|    assert(p_manager != 00);
 8538|       |
 8539|     40|    if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,
  ------------------
  |  Branch (8539:9): [True: 0, False: 40]
  ------------------
 8540|     40|                                           (opj_procedure)opj_j2k_read_header_procedure, p_manager)) {
 8541|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8542|      0|    }
 8543|       |
 8544|       |    /* DEVELOPER CORNER, add your custom procedures */
 8545|     40|    if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,
  ------------------
  |  Branch (8545:9): [True: 0, False: 40]
  ------------------
 8546|     40|                                           (opj_procedure)opj_j2k_copy_default_tcp_and_create_tcd, p_manager))  {
 8547|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8548|      0|    }
 8549|       |
 8550|     40|    return OPJ_TRUE;
  ------------------
  |  |  117|     40|#define OPJ_TRUE 1
  ------------------
 8551|     40|}
j2k.c:opj_j2k_read_header_procedure:
 8964|     40|{
 8965|     40|    OPJ_UINT32 l_current_marker;
 8966|     40|    OPJ_UINT32 l_marker_size;
 8967|     40|    const opj_dec_memory_marker_handler_t * l_marker_handler = 00;
 8968|     40|    OPJ_BOOL l_has_siz = 0;
 8969|     40|    OPJ_BOOL l_has_cod = 0;
 8970|     40|    OPJ_BOOL l_has_qcd = 0;
 8971|       |
 8972|       |    /* preconditions */
 8973|     40|    assert(p_stream != 00);
 8974|     40|    assert(p_j2k != 00);
 8975|     40|    assert(p_manager != 00);
 8976|       |
 8977|       |    /*  We enter in the main header */
 8978|     40|    p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_MHSOC;
 8979|       |
 8980|       |    /* Try to read the SOC marker, the codestream must begin with SOC marker */
 8981|     40|    if (! opj_j2k_read_soc(p_j2k, p_stream, p_manager)) {
  ------------------
  |  Branch (8981:9): [True: 1, False: 39]
  ------------------
 8982|      1|        opj_event_msg(p_manager, EVT_ERROR, "Expected a SOC marker \n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8983|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 8984|      1|    }
 8985|       |
 8986|       |    /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */
 8987|     39|    if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (8987:9): [True: 0, False: 39]
  ------------------
 8988|     39|                             p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 8989|      0|        opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8990|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8991|      0|    }
 8992|       |
 8993|       |    /* Read 2 bytes as the new marker ID */
 8994|     39|    opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|     39|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 8995|     39|                   &l_current_marker, 2);
 8996|       |
 8997|       |    /* Try to read until the SOT is detected */
 8998|  52.7k|    while (l_current_marker != J2K_MS_SOT) {
  ------------------
  |  |   73|  52.7k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (8998:12): [True: 52.7k, False: 14]
  ------------------
 8999|       |
 9000|       |        /* Check if the current marker ID is valid */
 9001|  52.7k|        if (l_current_marker < 0xff00) {
  ------------------
  |  Branch (9001:13): [True: 5, False: 52.7k]
  ------------------
 9002|      5|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      5|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9003|      5|                          "A marker ID was expected (0xff--) instead of %.8x\n", l_current_marker);
 9004|      5|            return OPJ_FALSE;
  ------------------
  |  |  118|      5|#define OPJ_FALSE 0
  ------------------
 9005|      5|        }
 9006|       |
 9007|       |        /* Get the marker handler from the marker ID */
 9008|  52.7k|        l_marker_handler = opj_j2k_get_marker_handler(l_current_marker);
 9009|       |
 9010|       |        /* Manage case where marker is unknown */
 9011|  52.7k|        if (l_marker_handler->id == J2K_MS_UNK) {
  ------------------
  |  |   99|  52.7k|#define J2K_MS_UNK 0        /**< UNKNOWN marker value */
  ------------------
  |  Branch (9011:13): [True: 43.4k, False: 9.25k]
  ------------------
 9012|  43.4k|            if (! opj_j2k_read_unk(p_j2k, p_stream, &l_current_marker, p_manager)) {
  ------------------
  |  Branch (9012:17): [True: 1, False: 43.4k]
  ------------------
 9013|      1|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9014|      1|                              "Unknown marker has been detected and generated error.\n");
 9015|      1|                return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 9016|      1|            }
 9017|       |
 9018|  43.4k|            if (l_current_marker == J2K_MS_SOT) {
  ------------------
  |  |   73|  43.4k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (9018:17): [True: 14, False: 43.4k]
  ------------------
 9019|     14|                break;    /* SOT marker is detected main header is completely read */
 9020|  43.4k|            } else { /* Get the marker handler from the marker ID */
 9021|  43.4k|                l_marker_handler = opj_j2k_get_marker_handler(l_current_marker);
 9022|  43.4k|            }
 9023|  43.4k|        }
 9024|       |
 9025|  52.7k|        if (l_marker_handler->id == J2K_MS_SIZ) {
  ------------------
  |  |   77|  52.7k|#define J2K_MS_SIZ 0xff51   /**< SIZ marker value */
  ------------------
  |  Branch (9025:13): [True: 39, False: 52.6k]
  ------------------
 9026|       |            /* Mark required SIZ marker as found */
 9027|     39|            l_has_siz = 1;
 9028|     39|        }
 9029|  52.7k|        if (l_marker_handler->id == J2K_MS_COD) {
  ------------------
  |  |   78|  52.7k|#define J2K_MS_COD 0xff52   /**< COD marker value */
  ------------------
  |  Branch (9029:13): [True: 2.31k, False: 50.4k]
  ------------------
 9030|       |            /* Mark required COD marker as found */
 9031|  2.31k|            l_has_cod = 1;
 9032|  2.31k|        }
 9033|  52.7k|        if (l_marker_handler->id == J2K_MS_QCD) {
  ------------------
  |  |   82|  52.7k|#define J2K_MS_QCD 0xff5c   /**< QCD marker value */
  ------------------
  |  Branch (9033:13): [True: 2.32k, False: 50.4k]
  ------------------
 9034|       |            /* Mark required QCD marker as found */
 9035|  2.32k|            l_has_qcd = 1;
 9036|  2.32k|        }
 9037|       |
 9038|       |        /* Check if the marker is known and if it is the right place to find it */
 9039|  52.7k|        if (!(p_j2k->m_specific_param.m_decoder.m_state & l_marker_handler->states)) {
  ------------------
  |  Branch (9039:13): [True: 0, False: 52.7k]
  ------------------
 9040|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9041|      0|                          "Marker is not compliant with its position\n");
 9042|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9043|      0|        }
 9044|       |
 9045|       |        /* Try to read 2 bytes (the marker size) from stream and copy them into the buffer */
 9046|  52.7k|        if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9046:13): [True: 0, False: 52.7k]
  ------------------
 9047|  52.7k|                                 p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9048|      0|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9049|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9050|      0|        }
 9051|       |
 9052|       |        /* read 2 bytes as the marker size */
 9053|  52.7k|        opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data, &l_marker_size,
  ------------------
  |  |   65|  52.7k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9054|  52.7k|                       2);
 9055|  52.7k|        if (l_marker_size < 2) {
  ------------------
  |  Branch (9055:13): [True: 2, False: 52.7k]
  ------------------
 9056|      2|            opj_event_msg(p_manager, EVT_ERROR, "Invalid marker size\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9057|      2|            return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 9058|      2|        }
 9059|  52.7k|        l_marker_size -= 2; /* Subtract the size of the marker ID already read */
 9060|       |
 9061|       |        /* Check if the marker size is compatible with the header data size */
 9062|  52.7k|        if (l_marker_size > p_j2k->m_specific_param.m_decoder.m_header_data_size) {
  ------------------
  |  Branch (9062:13): [True: 13, False: 52.7k]
  ------------------
 9063|     13|            OPJ_BYTE *new_header_data = (OPJ_BYTE *) opj_realloc(
 9064|     13|                                            p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size);
 9065|     13|            if (! new_header_data) {
  ------------------
  |  Branch (9065:17): [True: 0, False: 13]
  ------------------
 9066|      0|                opj_free(p_j2k->m_specific_param.m_decoder.m_header_data);
 9067|      0|                p_j2k->m_specific_param.m_decoder.m_header_data = NULL;
 9068|      0|                p_j2k->m_specific_param.m_decoder.m_header_data_size = 0;
 9069|      0|                opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read header\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9070|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9071|      0|            }
 9072|     13|            p_j2k->m_specific_param.m_decoder.m_header_data = new_header_data;
 9073|     13|            p_j2k->m_specific_param.m_decoder.m_header_data_size = l_marker_size;
 9074|     13|        }
 9075|       |
 9076|       |        /* Try to read the rest of the marker segment from stream and copy them into the buffer */
 9077|  52.7k|        if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9077:13): [True: 2, False: 52.7k]
  ------------------
 9078|  52.7k|                                 p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size,
 9079|  52.7k|                                 p_manager) != l_marker_size) {
 9080|      2|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9081|      2|            return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 9082|      2|        }
 9083|       |
 9084|       |        /* Read the marker segment with the correct marker handler */
 9085|  52.7k|        if (!(*(l_marker_handler->handler))(p_j2k,
  ------------------
  |  Branch (9085:13): [True: 1, False: 52.7k]
  ------------------
 9086|  52.7k|                                            p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size, p_manager)) {
 9087|      1|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9088|      1|                          "Marker handler function failed to read the marker segment\n");
 9089|      1|            return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 9090|      1|        }
 9091|       |
 9092|       |        /* Add the marker to the codestream index*/
 9093|  52.7k|        if (OPJ_FALSE == opj_j2k_add_mhmarker(
  ------------------
  |  |  118|  52.7k|#define OPJ_FALSE 0
  ------------------
  |  Branch (9093:13): [True: 0, False: 52.7k]
  ------------------
 9094|  52.7k|                    p_j2k->cstr_index,
 9095|  52.7k|                    l_marker_handler->id,
 9096|  52.7k|                    (OPJ_UINT32) opj_stream_tell(p_stream) - l_marker_size - 4,
 9097|  52.7k|                    l_marker_size + 4)) {
 9098|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add mh marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9099|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9100|      0|        }
 9101|       |
 9102|       |        /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */
 9103|  52.7k|        if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (9103:13): [True: 0, False: 52.7k]
  ------------------
 9104|  52.7k|                                 p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 9105|      0|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9106|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9107|      0|        }
 9108|       |
 9109|       |        /* read 2 bytes as the new marker ID */
 9110|  52.7k|        opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|  52.7k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9111|  52.7k|                       &l_current_marker, 2);
 9112|  52.7k|    }
 9113|       |
 9114|     28|    if (l_has_siz == 0) {
  ------------------
  |  Branch (9114:9): [True: 0, False: 28]
  ------------------
 9115|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9116|      0|                      "required SIZ marker not found in main header\n");
 9117|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9118|      0|    }
 9119|     28|    if (l_has_cod == 0) {
  ------------------
  |  Branch (9119:9): [True: 0, False: 28]
  ------------------
 9120|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9121|      0|                      "required COD marker not found in main header\n");
 9122|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9123|      0|    }
 9124|     28|    if (l_has_qcd == 0) {
  ------------------
  |  Branch (9124:9): [True: 0, False: 28]
  ------------------
 9125|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9126|      0|                      "required QCD marker not found in main header\n");
 9127|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9128|      0|    }
 9129|       |
 9130|     28|    if (! opj_j2k_merge_ppm(&(p_j2k->m_cp), p_manager)) {
  ------------------
  |  Branch (9130:9): [True: 1, False: 27]
  ------------------
 9131|      1|        opj_event_msg(p_manager, EVT_ERROR, "Failed to merge PPM data\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9132|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 9133|      1|    }
 9134|       |
 9135|     27|    opj_event_msg(p_manager, EVT_INFO, "Main header has been correctly decoded.\n");
  ------------------
  |  |   68|     27|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 9136|       |
 9137|       |    /* Position of the last element if the main header */
 9138|     27|    p_j2k->cstr_index->main_head_end = (OPJ_UINT32) opj_stream_tell(p_stream) - 2;
 9139|       |
 9140|       |    /* Build tile-part index from TLM information */
 9141|     27|    opj_j2k_build_tp_index_from_tlm(p_j2k, p_manager);
 9142|       |
 9143|       |    /* Next step: read a tile-part header */
 9144|     27|    p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPHSOT;
 9145|       |
 9146|     27|    return OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
 9147|     28|}
j2k.c:opj_j2k_read_soc:
 1931|     40|{
 1932|     40|    OPJ_BYTE l_data [2];
 1933|     40|    OPJ_UINT32 l_marker;
 1934|       |
 1935|       |    /* preconditions */
 1936|     40|    assert(p_j2k != 00);
 1937|     40|    assert(p_manager != 00);
 1938|     40|    assert(p_stream != 00);
 1939|       |
 1940|     40|    if (opj_stream_read_data(p_stream, l_data, 2, p_manager) != 2) {
  ------------------
  |  Branch (1940:9): [True: 1, False: 39]
  ------------------
 1941|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 1942|      1|    }
 1943|       |
 1944|     39|    opj_read_bytes(l_data, &l_marker, 2);
  ------------------
  |  |   65|     39|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1945|     39|    if (l_marker != J2K_MS_SOC) {
  ------------------
  |  |   72|     39|#define J2K_MS_SOC 0xff4f   /**< SOC marker value */
  ------------------
  |  Branch (1945:9): [True: 0, False: 39]
  ------------------
 1946|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1947|      0|    }
 1948|       |
 1949|       |    /* Next marker should be a SIZ marker in the main header */
 1950|     39|    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|     39|    p_j2k->cstr_index->main_head_start = opj_stream_tell(p_stream) - 2;
 1954|       |
 1955|     39|    opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|     39|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 1956|     39|                  "Start to read j2k main header (%" PRId64 ").\n",
 1957|     39|                  p_j2k->cstr_index->main_head_start);
 1958|       |
 1959|       |    /* Add the marker to the codestream index*/
 1960|     39|    if (OPJ_FALSE == opj_j2k_add_mhmarker(p_j2k->cstr_index, J2K_MS_SOC,
  ------------------
  |  |  118|     39|#define OPJ_FALSE 0
  ------------------
                  if (OPJ_FALSE == opj_j2k_add_mhmarker(p_j2k->cstr_index, J2K_MS_SOC,
  ------------------
  |  |   72|     39|#define J2K_MS_SOC 0xff4f   /**< SOC marker value */
  ------------------
  |  Branch (1960:9): [True: 0, False: 39]
  ------------------
 1961|     39|                                          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|     39|    return OPJ_TRUE;
  ------------------
  |  |  117|     39|#define OPJ_TRUE 1
  ------------------
 1966|     39|}
j2k.c:opj_j2k_read_unk:
 5732|  43.4k|{
 5733|  43.4k|    OPJ_UINT32 l_unknown_marker;
 5734|  43.4k|    const opj_dec_memory_marker_handler_t * l_marker_handler;
 5735|  43.4k|    OPJ_UINT32 l_size_unk = 2;
 5736|       |
 5737|       |    /* preconditions*/
 5738|  43.4k|    assert(p_j2k != 00);
 5739|  43.4k|    assert(p_manager != 00);
 5740|  43.4k|    assert(p_stream != 00);
 5741|       |
 5742|  43.4k|    opj_event_msg(p_manager, EVT_WARNING, "Unknown marker\n");
  ------------------
  |  |   67|  43.4k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 5743|       |
 5744|  1.16M|    for (;;) {
 5745|       |        /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer*/
 5746|  1.16M|        if (opj_stream_read_data(p_stream,
  ------------------
  |  Branch (5746:13): [True: 0, False: 1.16M]
  ------------------
 5747|  1.16M|                                 p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) {
 5748|      0|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5749|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5750|      0|        }
 5751|       |
 5752|       |        /* read 2 bytes as the new marker ID*/
 5753|  1.16M|        opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,
  ------------------
  |  |   65|  1.16M|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5754|  1.16M|                       &l_unknown_marker, 2);
 5755|       |
 5756|  1.16M|        if (!(l_unknown_marker < 0xff00)) {
  ------------------
  |  Branch (5756:13): [True: 557k, False: 609k]
  ------------------
 5757|       |
 5758|       |            /* Get the marker handler from the marker ID*/
 5759|   557k|            l_marker_handler = opj_j2k_get_marker_handler(l_unknown_marker);
 5760|       |
 5761|   557k|            if (!(p_j2k->m_specific_param.m_decoder.m_state & l_marker_handler->states)) {
  ------------------
  |  Branch (5761:17): [True: 1, False: 557k]
  ------------------
 5762|      1|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5763|      1|                              "Marker is not compliant with its position\n");
 5764|      1|                return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 5765|   557k|            } else {
 5766|   557k|                if (l_marker_handler->id != J2K_MS_UNK) {
  ------------------
  |  |   99|   557k|#define J2K_MS_UNK 0        /**< UNKNOWN marker value */
  ------------------
  |  Branch (5766:21): [True: 43.4k, False: 513k]
  ------------------
 5767|       |                    /* Add the marker to the codestream index*/
 5768|  43.4k|                    if (l_marker_handler->id != J2K_MS_SOT) {
  ------------------
  |  |   73|  43.4k|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (5768:25): [True: 43.4k, False: 14]
  ------------------
 5769|  43.4k|                        OPJ_BOOL res = opj_j2k_add_mhmarker(p_j2k->cstr_index, J2K_MS_UNK,
  ------------------
  |  |   99|  43.4k|#define J2K_MS_UNK 0        /**< UNKNOWN marker value */
  ------------------
 5770|  43.4k|                                                            (OPJ_UINT32) opj_stream_tell(p_stream) - l_size_unk,
 5771|  43.4k|                                                            l_size_unk);
 5772|  43.4k|                        if (res == OPJ_FALSE) {
  ------------------
  |  |  118|  43.4k|#define OPJ_FALSE 0
  ------------------
  |  Branch (5772:29): [True: 0, False: 43.4k]
  ------------------
 5773|      0|                            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add mh marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5774|      0|                            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5775|      0|                        }
 5776|  43.4k|                    }
 5777|  43.4k|                    break; /* next marker is known and well located */
 5778|   513k|                } else {
 5779|   513k|                    l_size_unk += 2;
 5780|   513k|                }
 5781|   557k|            }
 5782|   557k|        }
 5783|  1.16M|    }
 5784|       |
 5785|  43.4k|    *output_marker = l_marker_handler->id ;
 5786|       |
 5787|  43.4k|    return OPJ_TRUE;
  ------------------
  |  |  117|  43.4k|#define OPJ_TRUE 1
  ------------------
 5788|  43.4k|}
j2k.c:opj_j2k_add_mhmarker:
 8384|  96.2k|{
 8385|  96.2k|    assert(cstr_index != 00);
 8386|       |
 8387|       |    /* expand the list? */
 8388|  96.2k|    if ((cstr_index->marknum + 1) > cstr_index->maxmarknum) {
  ------------------
  |  Branch (8388:9): [True: 954, False: 95.2k]
  ------------------
 8389|    954|        opj_marker_info_t *new_marker;
 8390|    954|        cstr_index->maxmarknum = (OPJ_UINT32)(100 + (OPJ_FLOAT32)
 8391|    954|                                              cstr_index->maxmarknum);
 8392|    954|        new_marker = (opj_marker_info_t *) opj_realloc(cstr_index->marker,
 8393|    954|                     cstr_index->maxmarknum * sizeof(opj_marker_info_t));
 8394|    954|        if (! new_marker) {
  ------------------
  |  Branch (8394:13): [True: 0, False: 954]
  ------------------
 8395|      0|            opj_free(cstr_index->marker);
 8396|      0|            cstr_index->marker = NULL;
 8397|      0|            cstr_index->maxmarknum = 0;
 8398|      0|            cstr_index->marknum = 0;
 8399|       |            /* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add mh marker\n"); */
 8400|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8401|      0|        }
 8402|    954|        cstr_index->marker = new_marker;
 8403|    954|    }
 8404|       |
 8405|       |    /* add the marker */
 8406|  96.2k|    cstr_index->marker[cstr_index->marknum].type = (OPJ_UINT16)type;
 8407|  96.2k|    cstr_index->marker[cstr_index->marknum].pos = (OPJ_INT32)pos;
 8408|  96.2k|    cstr_index->marker[cstr_index->marknum].len = (OPJ_INT32)len;
 8409|  96.2k|    cstr_index->marknum++;
 8410|  96.2k|    return OPJ_TRUE;
  ------------------
  |  |  117|  96.2k|#define OPJ_TRUE 1
  ------------------
 8411|  96.2k|}
j2k.c:opj_j2k_merge_ppm:
 3990|     28|{
 3991|     28|    OPJ_UINT32 i, l_ppm_data_size, l_N_ppm_remaining;
 3992|       |
 3993|       |    /* preconditions */
 3994|     28|    assert(p_cp != 00);
 3995|     28|    assert(p_manager != 00);
 3996|     28|    assert(p_cp->ppm_buffer == NULL);
 3997|       |
 3998|     28|    if (p_cp->ppm == 0U) {
  ------------------
  |  Branch (3998:9): [True: 27, False: 1]
  ------------------
 3999|     27|        return OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
 4000|     27|    }
 4001|       |
 4002|      1|    l_ppm_data_size = 0U;
 4003|      1|    l_N_ppm_remaining = 0U;
 4004|      3|    for (i = 0U; i < p_cp->ppm_markers_count; ++i) {
  ------------------
  |  Branch (4004:18): [True: 2, False: 1]
  ------------------
 4005|      2|        if (p_cp->ppm_markers[i].m_data !=
  ------------------
  |  Branch (4005:13): [True: 1, False: 1]
  ------------------
 4006|      2|                NULL) { /* standard doesn't seem to require contiguous Zppm */
 4007|      1|            OPJ_UINT32 l_N_ppm;
 4008|      1|            OPJ_UINT32 l_data_size = p_cp->ppm_markers[i].m_data_size;
 4009|      1|            const OPJ_BYTE* l_data = p_cp->ppm_markers[i].m_data;
 4010|       |
 4011|      1|            if (l_N_ppm_remaining >= l_data_size) {
  ------------------
  |  Branch (4011:17): [True: 0, False: 1]
  ------------------
 4012|      0|                l_N_ppm_remaining -= l_data_size;
 4013|      0|                l_data_size = 0U;
 4014|      1|            } else {
 4015|      1|                l_data += l_N_ppm_remaining;
 4016|      1|                l_data_size -= l_N_ppm_remaining;
 4017|      1|                l_N_ppm_remaining = 0U;
 4018|      1|            }
 4019|       |
 4020|      1|            if (l_data_size > 0U) {
  ------------------
  |  Branch (4020:17): [True: 1, False: 0]
  ------------------
 4021|      1|                do {
 4022|       |                    /* read Nppm */
 4023|      1|                    if (l_data_size < 4U) {
  ------------------
  |  Branch (4023:25): [True: 0, False: 1]
  ------------------
 4024|       |                        /* clean up to be done on l_cp destruction */
 4025|      0|                        opj_event_msg(p_manager, EVT_ERROR, "Not enough bytes to read Nppm\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4026|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4027|      0|                    }
 4028|      1|                    opj_read_bytes(l_data, &l_N_ppm, 4);
  ------------------
  |  |   65|      1|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4029|      1|                    l_data += 4;
 4030|      1|                    l_data_size -= 4;
 4031|       |
 4032|      1|                    if (l_ppm_data_size > UINT_MAX - l_N_ppm) {
  ------------------
  |  Branch (4032:25): [True: 0, False: 1]
  ------------------
 4033|      0|                        opj_event_msg(p_manager, EVT_ERROR, "Too large value for Nppm\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4034|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4035|      0|                    }
 4036|      1|                    l_ppm_data_size += l_N_ppm;
 4037|      1|                    if (l_data_size >= l_N_ppm) {
  ------------------
  |  Branch (4037:25): [True: 0, False: 1]
  ------------------
 4038|      0|                        l_data_size -= l_N_ppm;
 4039|      0|                        l_data += l_N_ppm;
 4040|      1|                    } else {
 4041|      1|                        l_N_ppm_remaining = l_N_ppm - l_data_size;
 4042|      1|                        l_data_size = 0U;
 4043|      1|                    }
 4044|      1|                } while (l_data_size > 0U);
  ------------------
  |  Branch (4044:26): [True: 0, False: 1]
  ------------------
 4045|      1|            }
 4046|      1|        }
 4047|      2|    }
 4048|       |
 4049|      1|    if (l_N_ppm_remaining != 0U) {
  ------------------
  |  Branch (4049:9): [True: 1, False: 0]
  ------------------
 4050|       |        /* clean up to be done on l_cp destruction */
 4051|      1|        opj_event_msg(p_manager, EVT_ERROR, "Corrupted PPM markers\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4052|      1|        return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 4053|      1|    }
 4054|       |
 4055|      0|    p_cp->ppm_buffer = (OPJ_BYTE *) opj_malloc(l_ppm_data_size);
 4056|      0|    if (p_cp->ppm_buffer == 00) {
  ------------------
  |  Branch (4056:9): [True: 0, False: 0]
  ------------------
 4057|      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 */
  ------------------
 4058|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4059|      0|    }
 4060|      0|    p_cp->ppm_len = l_ppm_data_size;
 4061|      0|    l_ppm_data_size = 0U;
 4062|      0|    l_N_ppm_remaining = 0U;
 4063|      0|    for (i = 0U; i < p_cp->ppm_markers_count; ++i) {
  ------------------
  |  Branch (4063:18): [True: 0, False: 0]
  ------------------
 4064|      0|        if (p_cp->ppm_markers[i].m_data !=
  ------------------
  |  Branch (4064:13): [True: 0, False: 0]
  ------------------
 4065|      0|                NULL) { /* standard doesn't seem to require contiguous Zppm */
 4066|      0|            OPJ_UINT32 l_N_ppm;
 4067|      0|            OPJ_UINT32 l_data_size = p_cp->ppm_markers[i].m_data_size;
 4068|      0|            const OPJ_BYTE* l_data = p_cp->ppm_markers[i].m_data;
 4069|       |
 4070|      0|            if (l_N_ppm_remaining >= l_data_size) {
  ------------------
  |  Branch (4070:17): [True: 0, False: 0]
  ------------------
 4071|      0|                memcpy(p_cp->ppm_buffer + l_ppm_data_size, l_data, l_data_size);
 4072|      0|                l_ppm_data_size += l_data_size;
 4073|      0|                l_N_ppm_remaining -= l_data_size;
 4074|      0|                l_data_size = 0U;
 4075|      0|            } else {
 4076|      0|                memcpy(p_cp->ppm_buffer + l_ppm_data_size, l_data, l_N_ppm_remaining);
 4077|      0|                l_ppm_data_size += l_N_ppm_remaining;
 4078|      0|                l_data += l_N_ppm_remaining;
 4079|      0|                l_data_size -= l_N_ppm_remaining;
 4080|      0|                l_N_ppm_remaining = 0U;
 4081|      0|            }
 4082|       |
 4083|      0|            if (l_data_size > 0U) {
  ------------------
  |  Branch (4083:17): [True: 0, False: 0]
  ------------------
 4084|      0|                do {
 4085|       |                    /* read Nppm */
 4086|      0|                    if (l_data_size < 4U) {
  ------------------
  |  Branch (4086:25): [True: 0, False: 0]
  ------------------
 4087|       |                        /* clean up to be done on l_cp destruction */
 4088|      0|                        opj_event_msg(p_manager, EVT_ERROR, "Not enough bytes to read Nppm\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4089|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4090|      0|                    }
 4091|      0|                    opj_read_bytes(l_data, &l_N_ppm, 4);
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4092|      0|                    l_data += 4;
 4093|      0|                    l_data_size -= 4;
 4094|       |
 4095|      0|                    if (l_data_size >= l_N_ppm) {
  ------------------
  |  Branch (4095:25): [True: 0, False: 0]
  ------------------
 4096|      0|                        memcpy(p_cp->ppm_buffer + l_ppm_data_size, l_data, l_N_ppm);
 4097|      0|                        l_ppm_data_size += l_N_ppm;
 4098|      0|                        l_data_size -= l_N_ppm;
 4099|      0|                        l_data += l_N_ppm;
 4100|      0|                    } else {
 4101|      0|                        memcpy(p_cp->ppm_buffer + l_ppm_data_size, l_data, l_data_size);
 4102|      0|                        l_ppm_data_size += l_data_size;
 4103|      0|                        l_N_ppm_remaining = l_N_ppm - l_data_size;
 4104|      0|                        l_data_size = 0U;
 4105|      0|                    }
 4106|      0|                } while (l_data_size > 0U);
  ------------------
  |  Branch (4106:26): [True: 0, False: 0]
  ------------------
 4107|      0|            }
 4108|      0|            opj_free(p_cp->ppm_markers[i].m_data);
 4109|      0|            p_cp->ppm_markers[i].m_data = NULL;
 4110|      0|            p_cp->ppm_markers[i].m_data_size = 0U;
 4111|      0|        }
 4112|      0|    }
 4113|       |
 4114|      0|    p_cp->ppm_data = p_cp->ppm_buffer;
 4115|      0|    p_cp->ppm_data_size = p_cp->ppm_len;
 4116|       |
 4117|      0|    p_cp->ppm_markers_count = 0U;
 4118|      0|    opj_free(p_cp->ppm_markers);
 4119|      0|    p_cp->ppm_markers = NULL;
 4120|       |
 4121|      0|    return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 4122|      0|}
j2k.c:opj_j2k_build_tp_index_from_tlm:
 8883|     27|{
 8884|     27|    opj_j2k_tlm_info_t* l_tlm;
 8885|     27|    OPJ_UINT32 i;
 8886|     27|    OPJ_OFF_T l_cur_offset;
 8887|       |
 8888|     27|    assert(p_j2k->cstr_index->main_head_end > 0);
 8889|     27|    assert(p_j2k->cstr_index->nb_of_tiles > 0);
 8890|     27|    assert(p_j2k->cstr_index->tile_index != NULL);
 8891|       |
 8892|     27|    l_tlm = &(p_j2k->m_specific_param.m_decoder.m_tlm);
 8893|       |
 8894|     27|    if (l_tlm->m_entries_count == 0) {
  ------------------
  |  Branch (8894:9): [True: 27, False: 0]
  ------------------
 8895|     27|        l_tlm->m_is_invalid = OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
 8896|     27|        return;
 8897|     27|    }
 8898|       |
 8899|      0|    if (l_tlm->m_is_invalid) {
  ------------------
  |  Branch (8899:9): [True: 0, False: 0]
  ------------------
 8900|      0|        return;
 8901|      0|    }
 8902|       |
 8903|       |    /* Initial pass to count the number of tile-parts per tile */
 8904|      0|    for (i = 0; i < l_tlm->m_entries_count; ++i) {
  ------------------
  |  Branch (8904:17): [True: 0, False: 0]
  ------------------
 8905|      0|        OPJ_UINT32 l_tile_index_no = l_tlm->m_tile_part_infos[i].m_tile_index;
 8906|      0|        assert(l_tile_index_no < p_j2k->cstr_index->nb_of_tiles);
 8907|      0|        p_j2k->cstr_index->tile_index[l_tile_index_no].tileno = l_tile_index_no;
 8908|      0|        ++p_j2k->cstr_index->tile_index[l_tile_index_no].current_nb_tps;
 8909|      0|    }
 8910|       |
 8911|       |    /* Now check that all tiles have at least one tile-part */
 8912|      0|    for (i = 0; i < p_j2k->cstr_index->nb_of_tiles; ++i) {
  ------------------
  |  Branch (8912:17): [True: 0, False: 0]
  ------------------
 8913|      0|        if (p_j2k->cstr_index->tile_index[i].current_nb_tps == 0) {
  ------------------
  |  Branch (8913:13): [True: 0, False: 0]
  ------------------
 8914|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8915|      0|                          "opj_j2k_build_tp_index_from_tlm(): tile %d has no "
 8916|      0|                          "registered tile-part in TLM marker segments.\n", i);
 8917|      0|            goto error;
 8918|      0|        }
 8919|      0|    }
 8920|       |
 8921|       |    /* Final pass to fill p_j2k->cstr_index */
 8922|      0|    l_cur_offset = p_j2k->cstr_index->main_head_end;
 8923|      0|    for (i = 0; i < l_tlm->m_entries_count; ++i) {
  ------------------
  |  Branch (8923:17): [True: 0, False: 0]
  ------------------
 8924|      0|        OPJ_UINT32 l_tile_index_no = l_tlm->m_tile_part_infos[i].m_tile_index;
 8925|      0|        opj_tile_index_t* l_tile_index = &
 8926|      0|                                         (p_j2k->cstr_index->tile_index[l_tile_index_no]);
 8927|      0|        if (!l_tile_index->tp_index) {
  ------------------
  |  Branch (8927:13): [True: 0, False: 0]
  ------------------
 8928|      0|            l_tile_index->tp_index = (opj_tp_index_t *) opj_calloc(
 8929|      0|                                         l_tile_index->current_nb_tps, sizeof(opj_tp_index_t));
 8930|      0|            if (! l_tile_index->tp_index) {
  ------------------
  |  Branch (8930:17): [True: 0, False: 0]
  ------------------
 8931|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 8932|      0|                              "opj_j2k_build_tp_index_from_tlm(): tile index allocation failed\n");
 8933|      0|                goto error;
 8934|      0|            }
 8935|      0|        }
 8936|       |
 8937|      0|        assert(l_tile_index->nb_tps < l_tile_index->current_nb_tps);
 8938|      0|        l_tile_index->tp_index[l_tile_index->nb_tps].start_pos = l_cur_offset;
 8939|       |        /* We don't know how to set the tp_index[].end_header field, but this is not really needed */
 8940|       |        /* If there would be no markers between SOT and SOD, that would be : */
 8941|       |        /* l_tile_index->tp_index[l_tile_index->nb_tps].end_header = l_cur_offset + 12; */
 8942|      0|        l_tile_index->tp_index[l_tile_index->nb_tps].end_pos = l_cur_offset +
 8943|      0|                l_tlm->m_tile_part_infos[i].m_length;
 8944|      0|        ++l_tile_index->nb_tps;
 8945|       |
 8946|      0|        l_cur_offset += l_tlm->m_tile_part_infos[i].m_length;
 8947|      0|    }
 8948|       |
 8949|      0|    return;
 8950|       |
 8951|      0|error:
 8952|      0|    l_tlm->m_is_invalid = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 8953|      0|    for (i = 0; i < l_tlm->m_entries_count; ++i) {
  ------------------
  |  Branch (8953:17): [True: 0, False: 0]
  ------------------
 8954|      0|        OPJ_UINT32 l_tile_index = l_tlm->m_tile_part_infos[i].m_tile_index;
 8955|      0|        p_j2k->cstr_index->tile_index[l_tile_index].current_nb_tps = 0;
 8956|      0|        opj_free(p_j2k->cstr_index->tile_index[l_tile_index].tp_index);
 8957|      0|        p_j2k->cstr_index->tile_index[l_tile_index].tp_index = NULL;
 8958|      0|    }
 8959|      0|}
j2k.c:opj_j2k_copy_default_tcp_and_create_tcd:
 9184|     27|{
 9185|     27|    opj_tcp_t * l_tcp = 00;
 9186|     27|    opj_tcp_t * l_default_tcp = 00;
 9187|     27|    OPJ_UINT32 l_nb_tiles;
 9188|     27|    OPJ_UINT32 i, j;
 9189|     27|    opj_tccp_t *l_current_tccp = 00;
 9190|     27|    OPJ_UINT32 l_tccp_size;
 9191|     27|    OPJ_UINT32 l_mct_size;
 9192|     27|    opj_image_t * l_image;
 9193|     27|    OPJ_UINT32 l_mcc_records_size, l_mct_records_size;
 9194|     27|    opj_mct_data_t * l_src_mct_rec, *l_dest_mct_rec;
 9195|     27|    opj_simple_mcc_decorrelation_data_t * l_src_mcc_rec, *l_dest_mcc_rec;
 9196|     27|    OPJ_UINT32 l_offset;
 9197|       |
 9198|       |    /* preconditions */
 9199|     27|    assert(p_j2k != 00);
 9200|     27|    assert(p_stream != 00);
 9201|     27|    assert(p_manager != 00);
 9202|       |
 9203|     27|    OPJ_UNUSED(p_stream);
  ------------------
  |  |  221|     27|#define OPJ_UNUSED(x) (void)x
  ------------------
 9204|       |
 9205|     27|    l_image = p_j2k->m_private_image;
 9206|     27|    l_nb_tiles = p_j2k->m_cp.th * p_j2k->m_cp.tw;
 9207|     27|    l_tcp = p_j2k->m_cp.tcps;
 9208|     27|    l_tccp_size = l_image->numcomps * (OPJ_UINT32)sizeof(opj_tccp_t);
 9209|     27|    l_default_tcp = p_j2k->m_specific_param.m_decoder.m_default_tcp;
 9210|     27|    l_mct_size = l_image->numcomps * l_image->numcomps * (OPJ_UINT32)sizeof(
 9211|     27|                     OPJ_FLOAT32);
 9212|       |
 9213|       |    /* For each tile */
 9214|  6.92k|    for (i = 0; i < l_nb_tiles; ++i) {
  ------------------
  |  Branch (9214:17): [True: 6.89k, False: 27]
  ------------------
 9215|       |        /* keep the tile-compo coding parameters pointer of the current tile coding parameters*/
 9216|  6.89k|        l_current_tccp = l_tcp->tccps;
 9217|       |        /*Copy default coding parameters into the current tile coding parameters*/
 9218|  6.89k|        memcpy(l_tcp, l_default_tcp, sizeof(opj_tcp_t));
 9219|       |        /* Initialize some values of the current tile coding parameters*/
 9220|  6.89k|        l_tcp->cod = 0;
 9221|  6.89k|        l_tcp->ppt = 0;
 9222|  6.89k|        l_tcp->ppt_data = 00;
 9223|  6.89k|        l_tcp->m_current_tile_part_number = -1;
 9224|       |        /* Remove memory not owned by this tile in case of early error return. */
 9225|  6.89k|        l_tcp->m_mct_decoding_matrix = 00;
 9226|  6.89k|        l_tcp->m_nb_max_mct_records = 0;
 9227|  6.89k|        l_tcp->m_mct_records = 00;
 9228|  6.89k|        l_tcp->m_nb_max_mcc_records = 0;
 9229|  6.89k|        l_tcp->m_mcc_records = 00;
 9230|       |        /* Reconnect the tile-compo coding parameters pointer to the current tile coding parameters*/
 9231|  6.89k|        l_tcp->tccps = l_current_tccp;
 9232|       |
 9233|       |        /* Get the mct_decoding_matrix of the dflt_tile_cp and copy them into the current tile cp*/
 9234|  6.89k|        if (l_default_tcp->m_mct_decoding_matrix) {
  ------------------
  |  Branch (9234:13): [True: 0, False: 6.89k]
  ------------------
 9235|      0|            l_tcp->m_mct_decoding_matrix = (OPJ_FLOAT32*)opj_malloc(l_mct_size);
 9236|      0|            if (! l_tcp->m_mct_decoding_matrix) {
  ------------------
  |  Branch (9236:17): [True: 0, False: 0]
  ------------------
 9237|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9238|      0|            }
 9239|      0|            memcpy(l_tcp->m_mct_decoding_matrix, l_default_tcp->m_mct_decoding_matrix,
 9240|      0|                   l_mct_size);
 9241|      0|        }
 9242|       |
 9243|       |        /* Get the mct_record of the dflt_tile_cp and copy them into the current tile cp*/
 9244|  6.89k|        l_mct_records_size = l_default_tcp->m_nb_max_mct_records * (OPJ_UINT32)sizeof(
 9245|  6.89k|                                 opj_mct_data_t);
 9246|  6.89k|        l_tcp->m_mct_records = (opj_mct_data_t*)opj_malloc(l_mct_records_size);
 9247|  6.89k|        if (! l_tcp->m_mct_records) {
  ------------------
  |  Branch (9247:13): [True: 0, False: 6.89k]
  ------------------
 9248|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9249|      0|        }
 9250|  6.89k|        memcpy(l_tcp->m_mct_records, l_default_tcp->m_mct_records, l_mct_records_size);
 9251|       |
 9252|       |        /* Copy the mct record data from dflt_tile_cp to the current tile*/
 9253|  6.89k|        l_src_mct_rec = l_default_tcp->m_mct_records;
 9254|  6.89k|        l_dest_mct_rec = l_tcp->m_mct_records;
 9255|       |
 9256|  6.91k|        for (j = 0; j < l_default_tcp->m_nb_mct_records; ++j) {
  ------------------
  |  Branch (9256:21): [True: 17, False: 6.89k]
  ------------------
 9257|       |
 9258|     17|            if (l_src_mct_rec->m_data) {
  ------------------
  |  Branch (9258:17): [True: 0, False: 17]
  ------------------
 9259|       |
 9260|      0|                l_dest_mct_rec->m_data = (OPJ_BYTE*) opj_malloc(l_src_mct_rec->m_data_size);
 9261|      0|                if (! l_dest_mct_rec->m_data) {
  ------------------
  |  Branch (9261:21): [True: 0, False: 0]
  ------------------
 9262|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9263|      0|                }
 9264|      0|                memcpy(l_dest_mct_rec->m_data, l_src_mct_rec->m_data,
 9265|      0|                       l_src_mct_rec->m_data_size);
 9266|      0|            }
 9267|       |
 9268|     17|            ++l_src_mct_rec;
 9269|     17|            ++l_dest_mct_rec;
 9270|       |            /* Update with each pass to free exactly what has been allocated on early return. */
 9271|     17|            l_tcp->m_nb_max_mct_records += 1;
 9272|     17|        }
 9273|       |
 9274|       |        /* Get the mcc_record of the dflt_tile_cp and copy them into the current tile cp*/
 9275|  6.89k|        l_mcc_records_size = l_default_tcp->m_nb_max_mcc_records * (OPJ_UINT32)sizeof(
 9276|  6.89k|                                 opj_simple_mcc_decorrelation_data_t);
 9277|  6.89k|        l_tcp->m_mcc_records = (opj_simple_mcc_decorrelation_data_t*) opj_malloc(
 9278|  6.89k|                                   l_mcc_records_size);
 9279|  6.89k|        if (! l_tcp->m_mcc_records) {
  ------------------
  |  Branch (9279:13): [True: 0, False: 6.89k]
  ------------------
 9280|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9281|      0|        }
 9282|  6.89k|        memcpy(l_tcp->m_mcc_records, l_default_tcp->m_mcc_records, l_mcc_records_size);
 9283|  6.89k|        l_tcp->m_nb_max_mcc_records = l_default_tcp->m_nb_max_mcc_records;
 9284|       |
 9285|       |        /* Copy the mcc record data from dflt_tile_cp to the current tile*/
 9286|  6.89k|        l_src_mcc_rec = l_default_tcp->m_mcc_records;
 9287|  6.89k|        l_dest_mcc_rec = l_tcp->m_mcc_records;
 9288|       |
 9289|  75.8k|        for (j = 0; j < l_default_tcp->m_nb_max_mcc_records; ++j) {
  ------------------
  |  Branch (9289:21): [True: 68.9k, False: 6.89k]
  ------------------
 9290|       |
 9291|  68.9k|            if (l_src_mcc_rec->m_decorrelation_array) {
  ------------------
  |  Branch (9291:17): [True: 0, False: 68.9k]
  ------------------
 9292|      0|                l_offset = (OPJ_UINT32)(l_src_mcc_rec->m_decorrelation_array -
 9293|      0|                                        l_default_tcp->m_mct_records);
 9294|      0|                l_dest_mcc_rec->m_decorrelation_array = l_tcp->m_mct_records + l_offset;
 9295|      0|            }
 9296|       |
 9297|  68.9k|            if (l_src_mcc_rec->m_offset_array) {
  ------------------
  |  Branch (9297:17): [True: 0, False: 68.9k]
  ------------------
 9298|      0|                l_offset = (OPJ_UINT32)(l_src_mcc_rec->m_offset_array -
 9299|      0|                                        l_default_tcp->m_mct_records);
 9300|      0|                l_dest_mcc_rec->m_offset_array = l_tcp->m_mct_records + l_offset;
 9301|      0|            }
 9302|       |
 9303|  68.9k|            ++l_src_mcc_rec;
 9304|  68.9k|            ++l_dest_mcc_rec;
 9305|  68.9k|        }
 9306|       |
 9307|       |        /* Copy all the dflt_tile_compo_cp to the current tile cp */
 9308|  6.89k|        memcpy(l_current_tccp, l_default_tcp->tccps, l_tccp_size);
 9309|       |
 9310|       |        /* Move to next tile cp*/
 9311|  6.89k|        ++l_tcp;
 9312|  6.89k|    }
 9313|       |
 9314|       |    /* Create the current tile decoder*/
 9315|     27|    p_j2k->m_tcd = opj_tcd_create(OPJ_TRUE);
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
 9316|     27|    if (! p_j2k->m_tcd) {
  ------------------
  |  Branch (9316:9): [True: 0, False: 27]
  ------------------
 9317|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9318|      0|    }
 9319|       |
 9320|     27|    if (!opj_tcd_init(p_j2k->m_tcd, l_image, &(p_j2k->m_cp), p_j2k->m_tp)) {
  ------------------
  |  Branch (9320:9): [True: 0, False: 27]
  ------------------
 9321|      0|        opj_tcd_destroy(p_j2k->m_tcd);
 9322|      0|        p_j2k->m_tcd = 00;
 9323|      0|        opj_event_msg(p_manager, EVT_ERROR, "Cannot decode tile, memory error\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9324|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9325|      0|    }
 9326|       |
 9327|     27|    return OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
 9328|     27|}
j2k.c:opj_j2k_setup_decoding_validation:
 8555|     40|{
 8556|       |    /* preconditions*/
 8557|     40|    assert(p_j2k != 00);
 8558|     40|    assert(p_manager != 00);
 8559|       |
 8560|     40|    if (! opj_procedure_list_add_procedure(p_j2k->m_validation_list,
  ------------------
  |  Branch (8560:9): [True: 0, False: 40]
  ------------------
 8561|     40|                                           (opj_procedure)opj_j2k_build_decoder, p_manager)) {
 8562|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8563|      0|    }
 8564|     40|    if (! opj_procedure_list_add_procedure(p_j2k->m_validation_list,
  ------------------
  |  Branch (8564:9): [True: 0, False: 40]
  ------------------
 8565|     40|                                           (opj_procedure)opj_j2k_decoding_validation, p_manager)) {
 8566|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8567|      0|    }
 8568|       |
 8569|       |    /* DEVELOPER CORNER, add your custom validation procedure */
 8570|     40|    return OPJ_TRUE;
  ------------------
  |  |  117|     40|#define OPJ_TRUE 1
  ------------------
 8571|     40|}
j2k.c:opj_j2k_build_decoder:
 8775|     40|{
 8776|       |    /* add here initialization of cp
 8777|       |       copy paste of setup_decoder */
 8778|     40|    (void)p_j2k;
 8779|     40|    (void)p_stream;
 8780|     40|    (void)p_manager;
 8781|     40|    return OPJ_TRUE;
  ------------------
  |  |  117|     40|#define OPJ_TRUE 1
  ------------------
 8782|     40|}
j2k.c:opj_j2k_decoding_validation:
 8851|     40|{
 8852|     40|    OPJ_BOOL l_is_valid = OPJ_TRUE;
  ------------------
  |  |  117|     40|#define OPJ_TRUE 1
  ------------------
 8853|       |
 8854|       |    /* preconditions*/
 8855|     40|    assert(p_j2k != 00);
 8856|     40|    assert(p_stream != 00);
 8857|     40|    assert(p_manager != 00);
 8858|       |
 8859|     40|    OPJ_UNUSED(p_stream);
  ------------------
  |  |  221|     40|#define OPJ_UNUSED(x) (void)x
  ------------------
 8860|     40|    OPJ_UNUSED(p_manager);
  ------------------
  |  |  221|     40|#define OPJ_UNUSED(x) (void)x
  ------------------
 8861|       |
 8862|       |    /* STATE checking */
 8863|       |    /* make sure the state is at 0 */
 8864|       |#ifdef TODO_MSD
 8865|       |    l_is_valid &= (p_j2k->m_specific_param.m_decoder.m_state == J2K_DEC_STATE_NONE);
 8866|       |#endif
 8867|     40|    l_is_valid &= (p_j2k->m_specific_param.m_decoder.m_state == 0x0000);
 8868|       |
 8869|       |    /* POINTER validation */
 8870|       |    /* make sure a p_j2k codec is present */
 8871|       |    /* make sure a procedure list is present */
 8872|     40|    l_is_valid &= (p_j2k->m_procedure_list != 00);
 8873|       |    /* make sure a validation list is present */
 8874|     40|    l_is_valid &= (p_j2k->m_validation_list != 00);
 8875|       |
 8876|       |    /* PARAMETER VALIDATION */
 8877|     40|    return l_is_valid;
 8878|     40|}
j2k.c:opj_j2k_exec:
 9153|    107|{
 9154|    107|    OPJ_BOOL(** l_procedure)(opj_j2k_t *, opj_stream_private_t *,
 9155|    107|                             opj_event_mgr_t *) = 00;
 9156|    107|    OPJ_BOOL l_result = OPJ_TRUE;
  ------------------
  |  |  117|    107|#define OPJ_TRUE 1
  ------------------
 9157|    107|    OPJ_UINT32 l_nb_proc, i;
 9158|       |
 9159|       |    /* preconditions*/
 9160|    107|    assert(p_procedure_list != 00);
 9161|    107|    assert(p_j2k != 00);
 9162|    107|    assert(p_stream != 00);
 9163|    107|    assert(p_manager != 00);
 9164|       |
 9165|    107|    l_nb_proc = opj_procedure_list_get_nb_procedures(p_procedure_list);
 9166|    107|    l_procedure = (OPJ_BOOL(**)(opj_j2k_t *, opj_stream_private_t *,
 9167|    107|                                opj_event_mgr_t *)) opj_procedure_list_get_first_procedure(p_procedure_list);
 9168|       |
 9169|    294|    for (i = 0; i < l_nb_proc; ++i) {
  ------------------
  |  Branch (9169:17): [True: 187, False: 107]
  ------------------
 9170|    187|        l_result = l_result && ((*l_procedure)(p_j2k, p_stream, p_manager));
  ------------------
  |  Branch (9170:20): [True: 174, False: 13]
  |  Branch (9170:32): [True: 136, False: 38]
  ------------------
 9171|    187|        ++l_procedure;
 9172|    187|    }
 9173|       |
 9174|       |    /* and clear the procedure list at the end.*/
 9175|    107|    opj_procedure_list_clear(p_procedure_list);
 9176|    107|    return l_result;
 9177|    107|}
j2k.c:opj_j2k_tcp_destroy:
 9458|  6.98k|{
 9459|  6.98k|    if (p_tcp == 00) {
  ------------------
  |  Branch (9459:9): [True: 0, False: 6.98k]
  ------------------
 9460|      0|        return;
 9461|      0|    }
 9462|       |
 9463|  6.98k|    if (p_tcp->ppt_markers != 00) {
  ------------------
  |  Branch (9463:9): [True: 1, False: 6.98k]
  ------------------
 9464|      1|        OPJ_UINT32 i;
 9465|    242|        for (i = 0U; i < p_tcp->ppt_markers_count; ++i) {
  ------------------
  |  Branch (9465:22): [True: 241, False: 1]
  ------------------
 9466|    241|            if (p_tcp->ppt_markers[i].m_data != NULL) {
  ------------------
  |  Branch (9466:17): [True: 2, False: 239]
  ------------------
 9467|      2|                opj_free(p_tcp->ppt_markers[i].m_data);
 9468|      2|            }
 9469|    241|        }
 9470|      1|        p_tcp->ppt_markers_count = 0U;
 9471|      1|        opj_free(p_tcp->ppt_markers);
 9472|      1|        p_tcp->ppt_markers = NULL;
 9473|      1|    }
 9474|       |
 9475|  6.98k|    if (p_tcp->ppt_buffer != 00) {
  ------------------
  |  Branch (9475:9): [True: 0, False: 6.98k]
  ------------------
 9476|      0|        opj_free(p_tcp->ppt_buffer);
 9477|      0|        p_tcp->ppt_buffer = 00;
 9478|      0|    }
 9479|       |
 9480|  6.98k|    if (p_tcp->tccps != 00) {
  ------------------
  |  Branch (9480:9): [True: 6.95k, False: 39]
  ------------------
 9481|  6.95k|        opj_free(p_tcp->tccps);
 9482|  6.95k|        p_tcp->tccps = 00;
 9483|  6.95k|    }
 9484|       |
 9485|  6.98k|    if (p_tcp->m_mct_coding_matrix != 00) {
  ------------------
  |  Branch (9485:9): [True: 0, False: 6.98k]
  ------------------
 9486|      0|        opj_free(p_tcp->m_mct_coding_matrix);
 9487|      0|        p_tcp->m_mct_coding_matrix = 00;
 9488|      0|    }
 9489|       |
 9490|  6.98k|    if (p_tcp->m_mct_decoding_matrix != 00) {
  ------------------
  |  Branch (9490:9): [True: 0, False: 6.98k]
  ------------------
 9491|      0|        opj_free(p_tcp->m_mct_decoding_matrix);
 9492|      0|        p_tcp->m_mct_decoding_matrix = 00;
 9493|      0|    }
 9494|       |
 9495|  6.98k|    if (p_tcp->m_mcc_records) {
  ------------------
  |  Branch (9495:9): [True: 6.93k, False: 51]
  ------------------
 9496|  6.93k|        opj_free(p_tcp->m_mcc_records);
 9497|  6.93k|        p_tcp->m_mcc_records = 00;
 9498|  6.93k|        p_tcp->m_nb_max_mcc_records = 0;
 9499|  6.93k|        p_tcp->m_nb_mcc_records = 0;
 9500|  6.93k|    }
 9501|       |
 9502|  6.98k|    if (p_tcp->m_mct_records) {
  ------------------
  |  Branch (9502:9): [True: 6.93k, False: 51]
  ------------------
 9503|  6.93k|        opj_mct_data_t * l_mct_data = p_tcp->m_mct_records;
 9504|  6.93k|        OPJ_UINT32 i;
 9505|       |
 9506|  6.96k|        for (i = 0; i < p_tcp->m_nb_mct_records; ++i) {
  ------------------
  |  Branch (9506:21): [True: 29, False: 6.93k]
  ------------------
 9507|     29|            if (l_mct_data->m_data) {
  ------------------
  |  Branch (9507:17): [True: 9, False: 20]
  ------------------
 9508|      9|                opj_free(l_mct_data->m_data);
 9509|      9|                l_mct_data->m_data = 00;
 9510|      9|            }
 9511|       |
 9512|     29|            ++l_mct_data;
 9513|     29|        }
 9514|       |
 9515|  6.93k|        opj_free(p_tcp->m_mct_records);
 9516|  6.93k|        p_tcp->m_mct_records = 00;
 9517|  6.93k|    }
 9518|       |
 9519|  6.98k|    if (p_tcp->mct_norms != 00) {
  ------------------
  |  Branch (9519:9): [True: 0, False: 6.98k]
  ------------------
 9520|      0|        opj_free(p_tcp->mct_norms);
 9521|      0|        p_tcp->mct_norms = 00;
 9522|      0|    }
 9523|       |
 9524|  6.98k|    opj_j2k_tcp_data_destroy(p_tcp);
 9525|       |
 9526|  6.98k|}
j2k.c:opj_j2k_cp_destroy:
 9538|     59|{
 9539|     59|    OPJ_UINT32 l_nb_tiles;
 9540|     59|    opj_tcp_t * l_current_tile = 00;
 9541|       |
 9542|     59|    if (p_cp == 00) {
  ------------------
  |  Branch (9542:9): [True: 0, False: 59]
  ------------------
 9543|      0|        return;
 9544|      0|    }
 9545|     59|    if (p_cp->tcps != 00) {
  ------------------
  |  Branch (9545:9): [True: 39, False: 20]
  ------------------
 9546|     39|        OPJ_UINT32 i;
 9547|     39|        l_current_tile = p_cp->tcps;
 9548|     39|        l_nb_tiles = p_cp->th * p_cp->tw;
 9549|       |
 9550|  6.95k|        for (i = 0U; i < l_nb_tiles; ++i) {
  ------------------
  |  Branch (9550:22): [True: 6.91k, False: 39]
  ------------------
 9551|  6.91k|            opj_j2k_tcp_destroy(l_current_tile);
 9552|  6.91k|            ++l_current_tile;
 9553|  6.91k|        }
 9554|     39|        opj_free(p_cp->tcps);
 9555|     39|        p_cp->tcps = 00;
 9556|     39|    }
 9557|     59|    if (p_cp->ppm_markers != 00) {
  ------------------
  |  Branch (9557:9): [True: 2, False: 57]
  ------------------
 9558|      2|        OPJ_UINT32 i;
 9559|      6|        for (i = 0U; i < p_cp->ppm_markers_count; ++i) {
  ------------------
  |  Branch (9559:22): [True: 4, False: 2]
  ------------------
 9560|      4|            if (p_cp->ppm_markers[i].m_data != NULL) {
  ------------------
  |  Branch (9560:17): [True: 2, False: 2]
  ------------------
 9561|      2|                opj_free(p_cp->ppm_markers[i].m_data);
 9562|      2|            }
 9563|      4|        }
 9564|      2|        p_cp->ppm_markers_count = 0U;
 9565|      2|        opj_free(p_cp->ppm_markers);
 9566|      2|        p_cp->ppm_markers = NULL;
 9567|      2|    }
 9568|     59|    opj_free(p_cp->ppm_buffer);
 9569|     59|    p_cp->ppm_buffer = 00;
 9570|     59|    p_cp->ppm_data =
 9571|     59|        NULL; /* ppm_data belongs to the allocated buffer pointed by ppm_buffer */
 9572|     59|    opj_free(p_cp->comment);
 9573|     59|    p_cp->comment = 00;
 9574|     59|    if (! p_cp->m_is_decoder) {
  ------------------
  |  Branch (9574:9): [True: 0, False: 59]
  ------------------
 9575|      0|        opj_free(p_cp->m_specific_param.m_enc.m_matrice);
 9576|      0|        p_cp->m_specific_param.m_enc.m_matrice = 00;
 9577|      0|    }
 9578|     59|}
j2k.c:opj_j2k_get_marker_handler:
 9332|   653k|{
 9333|   653k|    const opj_dec_memory_marker_handler_t *e;
 9334|  14.5M|    for (e = j2k_memory_marker_handler_tab; e->id != 0; ++e) {
  ------------------
  |  Branch (9334:45): [True: 13.9M, False: 557k]
  ------------------
 9335|  13.9M|        if (e->id == p_id) {
  ------------------
  |  Branch (9335:13): [True: 96.2k, False: 13.9M]
  ------------------
 9336|  96.2k|            break; /* we find a handler corresponding to the marker ID*/
 9337|  96.2k|        }
 9338|  13.9M|    }
 9339|   653k|    return e;
 9340|   653k|}
j2k.c:opj_j2k_read_sot:
 4448|     30|{
 4449|     30|    opj_cp_t *l_cp = 00;
 4450|     30|    opj_tcp_t *l_tcp = 00;
 4451|     30|    OPJ_UINT32 l_tot_len, l_num_parts = 0;
 4452|     30|    OPJ_UINT32 l_current_part;
 4453|     30|    OPJ_UINT32 l_tile_x, l_tile_y;
 4454|       |
 4455|       |    /* preconditions */
 4456|       |
 4457|     30|    assert(p_j2k != 00);
 4458|     30|    assert(p_manager != 00);
 4459|       |
 4460|     30|    if (! opj_j2k_get_sot_values(p_header_data, p_header_size,
  ------------------
  |  Branch (4460:9): [True: 2, False: 28]
  ------------------
 4461|     30|                                 &(p_j2k->m_current_tile_number), &l_tot_len, &l_current_part, &l_num_parts,
 4462|     30|                                 p_manager)) {
 4463|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading SOT marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4464|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 4465|      2|    }
 4466|       |#ifdef DEBUG_VERBOSE
 4467|       |    fprintf(stderr, "SOT %d %d %d %d\n",
 4468|       |            p_j2k->m_current_tile_number, l_tot_len, l_current_part, l_num_parts);
 4469|       |#endif
 4470|       |
 4471|     28|    l_cp = &(p_j2k->m_cp);
 4472|       |
 4473|       |    /* testcase 2.pdf.SIGFPE.706.1112 */
 4474|     28|    if (p_j2k->m_current_tile_number >= l_cp->tw * l_cp->th) {
  ------------------
  |  Branch (4474:9): [True: 0, False: 28]
  ------------------
 4475|      0|        opj_event_msg(p_manager, EVT_ERROR, "Invalid tile number %d\n",
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4476|      0|                      p_j2k->m_current_tile_number);
 4477|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4478|      0|    }
 4479|       |
 4480|     28|    l_tcp = &l_cp->tcps[p_j2k->m_current_tile_number];
 4481|     28|    l_tile_x = p_j2k->m_current_tile_number % l_cp->tw;
 4482|     28|    l_tile_y = p_j2k->m_current_tile_number / l_cp->tw;
 4483|       |
 4484|     28|    if (p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec < 0 ||
  ------------------
  |  Branch (4484:9): [True: 28, False: 0]
  ------------------
 4485|     28|            p_j2k->m_current_tile_number == (OPJ_UINT32)
  ------------------
  |  Branch (4485:13): [True: 0, False: 0]
  ------------------
 4486|     28|            p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec) {
 4487|       |        /* Do only this check if we decode all tile part headers, or if */
 4488|       |        /* we decode one precise tile. Otherwise the m_current_tile_part_number */
 4489|       |        /* might not be valid */
 4490|       |        /* Fixes issue with id_000020,sig_06,src_001958,op_flip4,pos_149 */
 4491|       |        /* of https://github.com/uclouvain/openjpeg/issues/939 */
 4492|       |        /* We must avoid reading twice the same tile part number for a given tile */
 4493|       |        /* so as to avoid various issues, like opj_j2k_merge_ppt being called */
 4494|       |        /* several times. */
 4495|       |        /* ISO 15444-1 A.4.2 Start of tile-part (SOT) mandates that tile parts */
 4496|       |        /* should appear in increasing order. */
 4497|     28|        if (l_tcp->m_current_tile_part_number + 1 != (OPJ_INT32)l_current_part) {
  ------------------
  |  Branch (4497:13): [True: 0, False: 28]
  ------------------
 4498|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4499|      0|                          "Invalid tile part index for tile number %d. "
 4500|      0|                          "Got %d, expected %d\n",
 4501|      0|                          p_j2k->m_current_tile_number,
 4502|      0|                          l_current_part,
 4503|      0|                          l_tcp->m_current_tile_part_number + 1);
 4504|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4505|      0|        }
 4506|     28|    }
 4507|       |
 4508|     28|    l_tcp->m_current_tile_part_number = (OPJ_INT32) l_current_part;
 4509|       |
 4510|       |#ifdef USE_JPWL
 4511|       |    if (l_cp->correct) {
 4512|       |
 4513|       |        OPJ_UINT32 tileno = p_j2k->m_current_tile_number;
 4514|       |        static OPJ_UINT32 backup_tileno = 0;
 4515|       |
 4516|       |        /* tileno is negative or larger than the number of tiles!!! */
 4517|       |        if (tileno > (l_cp->tw * l_cp->th)) {
 4518|       |            opj_event_msg(p_manager, EVT_ERROR,
 4519|       |                          "JPWL: bad tile number (%d out of a maximum of %d)\n",
 4520|       |                          tileno, (l_cp->tw * l_cp->th));
 4521|       |            if (!JPWL_ASSUME) {
 4522|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 4523|       |                return OPJ_FALSE;
 4524|       |            }
 4525|       |            /* we try to correct */
 4526|       |            tileno = backup_tileno;
 4527|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust this\n"
 4528|       |                          "- setting tile number to %d\n",
 4529|       |                          tileno);
 4530|       |        }
 4531|       |
 4532|       |        /* keep your private count of tiles */
 4533|       |        backup_tileno++;
 4534|       |    };
 4535|       |#endif /* USE_JPWL */
 4536|       |
 4537|       |    /* look for the tile in the list of already processed tile (in parts). */
 4538|       |    /* Optimization possible here with a more complex data structure and with the removing of tiles */
 4539|       |    /* since the time taken by this function can only grow at the time */
 4540|       |
 4541|       |    /* PSot should be equal to zero or >=14 or <= 2^32-1 */
 4542|     28|    if ((l_tot_len != 0) && (l_tot_len < 14)) {
  ------------------
  |  Branch (4542:9): [True: 7, False: 21]
  |  Branch (4542:29): [True: 0, False: 7]
  ------------------
 4543|      0|        if (l_tot_len ==
  ------------------
  |  Branch (4543:13): [True: 0, False: 0]
  ------------------
 4544|      0|                12) { /* MSD: Special case for the PHR data which are read by kakadu*/
 4545|      0|            opj_event_msg(p_manager, EVT_WARNING, "Empty SOT marker detected: Psot=%d.\n",
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 4546|      0|                          l_tot_len);
 4547|      0|        } else {
 4548|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4549|      0|                          "Psot value is not correct regards to the JPEG2000 norm: %d.\n", l_tot_len);
 4550|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4551|      0|        }
 4552|      0|    }
 4553|       |
 4554|       |#ifdef USE_JPWL
 4555|       |    if (l_cp->correct) {
 4556|       |
 4557|       |        /* totlen is negative or larger than the bytes left!!! */
 4558|       |        if (/*(l_tot_len < 0) ||*/ (l_tot_len >
 4559|       |                                    p_header_size)) {   /* FIXME it seems correct; for info in V1 -> (p_stream_numbytesleft(p_stream) + 8))) { */
 4560|       |            opj_event_msg(p_manager, EVT_ERROR,
 4561|       |                          "JPWL: bad tile byte size (%d bytes against %d bytes left)\n",
 4562|       |                          l_tot_len,
 4563|       |                          p_header_size);  /* FIXME it seems correct; for info in V1 -> p_stream_numbytesleft(p_stream) + 8); */
 4564|       |            if (!JPWL_ASSUME) {
 4565|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 4566|       |                return OPJ_FALSE;
 4567|       |            }
 4568|       |            /* we try to correct */
 4569|       |            l_tot_len = 0;
 4570|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust this\n"
 4571|       |                          "- setting Psot to %d => assuming it is the last tile\n",
 4572|       |                          l_tot_len);
 4573|       |        }
 4574|       |    };
 4575|       |#endif /* USE_JPWL */
 4576|       |
 4577|       |    /* Ref A.4.2: Psot could be equal zero if it is the last tile-part of the codestream.*/
 4578|     28|    if (!l_tot_len) {
  ------------------
  |  Branch (4578:9): [True: 21, False: 7]
  ------------------
 4579|     21|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|     21|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 4580|     21|                      "Psot value of the current tile-part is equal to zero, "
 4581|     21|                      "we assuming it is the last tile-part of the codestream.\n");
 4582|     21|        p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
 4583|     21|    }
 4584|       |
 4585|     28|    if (l_tcp->m_nb_tile_parts != 0 && l_current_part >= l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (4585:9): [True: 1, False: 27]
  |  Branch (4585:40): [True: 0, False: 1]
  ------------------
 4586|       |        /* Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2851 */
 4587|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4588|      0|                      "In SOT marker, TPSot (%d) is not valid regards to the previous "
 4589|      0|                      "number of tile-part (%d), giving up\n", l_current_part,
 4590|      0|                      l_tcp->m_nb_tile_parts);
 4591|      0|        p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
 4592|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4593|      0|    }
 4594|       |
 4595|     28|    if (l_num_parts !=
  ------------------
  |  Branch (4595:9): [True: 18, False: 10]
  ------------------
 4596|     28|            0) { /* Number of tile-part header is provided by this tile-part header */
 4597|     18|        l_num_parts += p_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction;
 4598|       |        /* Useful to manage the case of textGBR.jp2 file because two values of TNSot are allowed: the correct numbers of
 4599|       |         * tile-parts for that tile and zero (A.4.2 of 15444-1 : 2002). */
 4600|     18|        if (l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (4600:13): [True: 1, False: 17]
  ------------------
 4601|      1|            if (l_current_part >= l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (4601:17): [True: 0, False: 1]
  ------------------
 4602|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4603|      0|                              "In SOT marker, TPSot (%d) is not valid regards to the current "
 4604|      0|                              "number of tile-part (%d), giving up\n", l_current_part,
 4605|      0|                              l_tcp->m_nb_tile_parts);
 4606|      0|                p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
 4607|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4608|      0|            }
 4609|      1|        }
 4610|     18|        if (l_current_part >= l_num_parts) {
  ------------------
  |  Branch (4610:13): [True: 0, False: 18]
  ------------------
 4611|       |            /* testcase 451.pdf.SIGSEGV.ce9.3723 */
 4612|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4613|      0|                          "In SOT marker, TPSot (%d) is not valid regards to the current "
 4614|      0|                          "number of tile-part (header) (%d), giving up\n", l_current_part, l_num_parts);
 4615|      0|            p_j2k->m_specific_param.m_decoder.m_last_tile_part = 1;
 4616|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4617|      0|        }
 4618|     18|        l_tcp->m_nb_tile_parts = l_num_parts;
 4619|     18|    }
 4620|       |
 4621|       |    /* If know the number of tile part header we will check if we didn't read the last*/
 4622|     28|    if (l_tcp->m_nb_tile_parts) {
  ------------------
  |  Branch (4622:9): [True: 18, False: 10]
  ------------------
 4623|     18|        if (l_tcp->m_nb_tile_parts == (l_current_part + 1)) {
  ------------------
  |  Branch (4623:13): [True: 14, False: 4]
  ------------------
 4624|     14|            p_j2k->m_specific_param.m_decoder.m_can_decode =
 4625|     14|                1; /* Process the last tile-part header*/
 4626|     14|        }
 4627|     18|    }
 4628|       |
 4629|     28|    if (!p_j2k->m_specific_param.m_decoder.m_last_tile_part) {
  ------------------
  |  Branch (4629:9): [True: 7, False: 21]
  ------------------
 4630|       |        /* Keep the size of data to skip after this marker */
 4631|      7|        p_j2k->m_specific_param.m_decoder.m_sot_length = l_tot_len -
 4632|      7|                12; /* SOT_marker_size = 12 */
 4633|     21|    } else {
 4634|       |        /* FIXME: need to be computed from the number of bytes remaining in the codestream */
 4635|     21|        p_j2k->m_specific_param.m_decoder.m_sot_length = 0;
 4636|     21|    }
 4637|       |
 4638|     28|    p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPH;
 4639|       |
 4640|       |    /* Check if the current tile is outside the area we want decode or not corresponding to the tile index*/
 4641|     28|    if (p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec == -1) {
  ------------------
  |  Branch (4641:9): [True: 28, False: 0]
  ------------------
 4642|     28|        p_j2k->m_specific_param.m_decoder.m_skip_data =
 4643|     28|            (l_tile_x < p_j2k->m_specific_param.m_decoder.m_start_tile_x)
  ------------------
  |  Branch (4643:13): [True: 0, False: 28]
  ------------------
 4644|     28|            || (l_tile_x >= p_j2k->m_specific_param.m_decoder.m_end_tile_x)
  ------------------
  |  Branch (4644:16): [True: 0, False: 28]
  ------------------
 4645|     28|            || (l_tile_y < p_j2k->m_specific_param.m_decoder.m_start_tile_y)
  ------------------
  |  Branch (4645:16): [True: 0, False: 28]
  ------------------
 4646|     28|            || (l_tile_y >= p_j2k->m_specific_param.m_decoder.m_end_tile_y);
  ------------------
  |  Branch (4646:16): [True: 0, False: 28]
  ------------------
 4647|     28|    } else {
 4648|      0|        assert(p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec >= 0);
 4649|      0|        p_j2k->m_specific_param.m_decoder.m_skip_data =
 4650|      0|            (p_j2k->m_current_tile_number != (OPJ_UINT32)
 4651|      0|             p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec);
 4652|      0|    }
 4653|       |
 4654|       |    /* Index */
 4655|     28|    {
 4656|     28|        assert(p_j2k->cstr_index->tile_index != 00);
 4657|     28|        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tileno =
 4658|     28|            p_j2k->m_current_tile_number;
 4659|     28|        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_tpsno =
 4660|     28|            l_current_part;
 4661|       |
 4662|     28|        if (!p_j2k->m_specific_param.m_decoder.m_tlm.m_is_invalid &&
  ------------------
  |  Branch (4662:13): [True: 0, False: 28]
  ------------------
 4663|     28|                l_num_parts >
  ------------------
  |  Branch (4663:17): [True: 0, False: 0]
  ------------------
 4664|      0|                p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].nb_tps) {
 4665|      0|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 4666|      0|                          "SOT marker for tile %u declares more tile-parts than found in TLM marker.",
 4667|      0|                          p_j2k->m_current_tile_number);
 4668|      0|            p_j2k->m_specific_param.m_decoder.m_tlm.m_is_invalid = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 4669|      0|        }
 4670|       |
 4671|     28|        if (!p_j2k->m_specific_param.m_decoder.m_tlm.m_is_invalid) {
  ------------------
  |  Branch (4671:13): [True: 0, False: 28]
  ------------------
 4672|       |            /* do nothing */
 4673|     28|        } else if (l_num_parts != 0) {
  ------------------
  |  Branch (4673:20): [True: 18, False: 10]
  ------------------
 4674|       |
 4675|     18|            p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].nb_tps =
 4676|     18|                l_num_parts;
 4677|     18|            p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps =
 4678|     18|                l_num_parts;
 4679|       |
 4680|     18|            if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index) {
  ------------------
  |  Branch (4680:17): [True: 17, False: 1]
  ------------------
 4681|     17|                p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index =
 4682|     17|                    (opj_tp_index_t*)opj_calloc(l_num_parts, sizeof(opj_tp_index_t));
 4683|     17|                if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index) {
  ------------------
  |  Branch (4683:21): [True: 0, False: 17]
  ------------------
 4684|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4685|      0|                                  "Not enough memory to read SOT marker. Tile index allocation failed\n");
 4686|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4687|      0|                }
 4688|     17|            } else {
 4689|      1|                opj_tp_index_t *new_tp_index = (opj_tp_index_t *) opj_realloc(
 4690|      1|                                                   p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index,
 4691|      1|                                                   l_num_parts * sizeof(opj_tp_index_t));
 4692|      1|                if (! new_tp_index) {
  ------------------
  |  Branch (4692:21): [True: 0, False: 1]
  ------------------
 4693|      0|                    opj_free(p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index);
 4694|      0|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index = NULL;
 4695|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4696|      0|                                  "Not enough memory to read SOT marker. Tile index allocation failed\n");
 4697|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4698|      0|                }
 4699|      1|                p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index =
 4700|      1|                    new_tp_index;
 4701|      1|            }
 4702|     18|        } else {
 4703|     10|            /*if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index)*/ {
 4704|       |
 4705|     10|                if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index) {
  ------------------
  |  Branch (4705:21): [True: 10, False: 0]
  ------------------
 4706|     10|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps = 10;
 4707|     10|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index =
 4708|     10|                        (opj_tp_index_t*)opj_calloc(
 4709|     10|                            p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps,
 4710|     10|                            sizeof(opj_tp_index_t));
 4711|     10|                    if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index) {
  ------------------
  |  Branch (4711:25): [True: 0, False: 10]
  ------------------
 4712|      0|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps = 0;
 4713|      0|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4714|      0|                                      "Not enough memory to read SOT marker. Tile index allocation failed\n");
 4715|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4716|      0|                    }
 4717|     10|                }
 4718|       |
 4719|     10|                if (l_current_part >=
  ------------------
  |  Branch (4719:21): [True: 0, False: 10]
  ------------------
 4720|     10|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps) {
 4721|      0|                    opj_tp_index_t *new_tp_index;
 4722|      0|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps =
 4723|      0|                        l_current_part + 1;
 4724|      0|                    new_tp_index = (opj_tp_index_t *) opj_realloc(
 4725|      0|                                       p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index,
 4726|      0|                                       p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps *
 4727|      0|                                       sizeof(opj_tp_index_t));
 4728|      0|                    if (! new_tp_index) {
  ------------------
  |  Branch (4728:25): [True: 0, False: 0]
  ------------------
 4729|      0|                        opj_free(p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index);
 4730|      0|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index = NULL;
 4731|      0|                        p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps = 0;
 4732|      0|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4733|      0|                                      "Not enough memory to read SOT marker. Tile index allocation failed\n");
 4734|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4735|      0|                    }
 4736|      0|                    p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index =
 4737|      0|                        new_tp_index;
 4738|      0|                }
 4739|     10|            }
 4740|       |
 4741|     10|        }
 4742|       |
 4743|     28|    }
 4744|       |
 4745|     28|    return OPJ_TRUE;
  ------------------
  |  |  117|     28|#define OPJ_TRUE 1
  ------------------
 4746|     28|}
j2k.c:opj_j2k_get_sot_values:
 4422|     33|{
 4423|       |    /* preconditions */
 4424|     33|    assert(p_header_data != 00);
 4425|     33|    assert(p_manager != 00);
 4426|       |
 4427|       |    /* Size of this marker is fixed = 12 (we have already read marker and its size)*/
 4428|     33|    if (p_header_size != 8) {
  ------------------
  |  Branch (4428:9): [True: 2, False: 31]
  ------------------
 4429|      2|        opj_event_msg(p_manager, EVT_ERROR, "Error reading SOT marker\n");
  ------------------
  |  |   66|      2|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4430|      2|        return OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 4431|      2|    }
 4432|       |
 4433|     31|    opj_read_bytes(p_header_data, p_tile_no, 2);    /* Isot */
  ------------------
  |  |   65|     31|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4434|     31|    p_header_data += 2;
 4435|     31|    opj_read_bytes(p_header_data, p_tot_len, 4);    /* Psot */
  ------------------
  |  |   65|     31|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4436|     31|    p_header_data += 4;
 4437|     31|    opj_read_bytes(p_header_data, p_current_part, 1); /* TPsot */
  ------------------
  |  |   65|     31|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4438|     31|    ++p_header_data;
 4439|     31|    opj_read_bytes(p_header_data, p_num_parts, 1);  /* TNsot */
  ------------------
  |  |   65|     31|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4440|     31|    ++p_header_data;
 4441|     31|    return OPJ_TRUE;
  ------------------
  |  |  117|     31|#define OPJ_TRUE 1
  ------------------
 4442|     33|}
j2k.c:opj_j2k_read_cod:
 2670|  2.31k|{
 2671|       |    /* loop */
 2672|  2.31k|    OPJ_UINT32 i;
 2673|  2.31k|    OPJ_UINT32 l_tmp;
 2674|  2.31k|    opj_cp_t *l_cp = 00;
 2675|  2.31k|    opj_tcp_t *l_tcp = 00;
 2676|  2.31k|    opj_image_t *l_image = 00;
 2677|       |
 2678|       |    /* preconditions */
 2679|  2.31k|    assert(p_header_data != 00);
 2680|  2.31k|    assert(p_j2k != 00);
 2681|  2.31k|    assert(p_manager != 00);
 2682|       |
 2683|  2.31k|    l_image = p_j2k->m_private_image;
 2684|  2.31k|    l_cp = &(p_j2k->m_cp);
 2685|       |
 2686|       |    /* If we are in the first tile-part header of the current tile */
 2687|  2.31k|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ?
  ------------------
  |  Branch (2687:13): [True: 0, False: 2.31k]
  ------------------
 2688|      0|            &l_cp->tcps[p_j2k->m_current_tile_number] :
 2689|  2.31k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 2690|       |
 2691|       |#if 0
 2692|       |    /* This check was added per https://github.com/uclouvain/openjpeg/commit/daed8cc9195555e101ab708a501af2dfe6d5e001 */
 2693|       |    /* but this is no longer necessary to handle issue476.jp2 */
 2694|       |    /* and this actually cause issues on legit files. See https://github.com/uclouvain/openjpeg/issues/1043 */
 2695|       |    /* Only one COD per tile */
 2696|       |    if (l_tcp->cod) {
 2697|       |        opj_event_msg(p_manager, EVT_ERROR,
 2698|       |                      "COD marker already read. No more than one COD marker per tile.\n");
 2699|       |        return OPJ_FALSE;
 2700|       |    }
 2701|       |#endif
 2702|  2.31k|    l_tcp->cod = 1;
 2703|       |
 2704|       |    /* Make sure room is sufficient */
 2705|  2.31k|    if (p_header_size < 5) {
  ------------------
  |  Branch (2705:9): [True: 0, False: 2.31k]
  ------------------
 2706|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COD marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2707|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2708|      0|    }
 2709|       |
 2710|  2.31k|    opj_read_bytes(p_header_data, &l_tcp->csty, 1);         /* Scod */
  ------------------
  |  |   65|  2.31k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2711|  2.31k|    ++p_header_data;
 2712|       |    /* Make sure we know how to decode this */
 2713|  2.31k|    if ((l_tcp->csty & ~(OPJ_UINT32)(J2K_CP_CSTY_PRT | J2K_CP_CSTY_SOP |
  ------------------
  |  |   54|  2.31k|#define J2K_CP_CSTY_PRT 0x01
  ------------------
                  if ((l_tcp->csty & ~(OPJ_UINT32)(J2K_CP_CSTY_PRT | J2K_CP_CSTY_SOP |
  ------------------
  |  |   55|  2.31k|#define J2K_CP_CSTY_SOP 0x02
  ------------------
  |  Branch (2713:9): [True: 0, False: 2.31k]
  ------------------
 2714|  2.31k|                                     J2K_CP_CSTY_EPH)) != 0U) {
  ------------------
  |  |   56|  2.31k|#define J2K_CP_CSTY_EPH 0x04
  ------------------
 2715|      0|        opj_event_msg(p_manager, EVT_ERROR, "Unknown Scod value in COD marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2716|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2717|      0|    }
 2718|  2.31k|    opj_read_bytes(p_header_data, &l_tmp, 1);                       /* SGcod (A) */
  ------------------
  |  |   65|  2.31k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2719|  2.31k|    ++p_header_data;
 2720|  2.31k|    l_tcp->prg = (OPJ_PROG_ORDER) l_tmp;
 2721|       |    /* Make sure progression order is valid */
 2722|  2.31k|    if (l_tcp->prg > OPJ_CPRL) {
  ------------------
  |  Branch (2722:9): [True: 1.03k, False: 1.28k]
  ------------------
 2723|  1.03k|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|  1.03k|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2724|  1.03k|                      "Unknown progression order in COD marker\n");
 2725|  1.03k|        l_tcp->prg = OPJ_PROG_UNKNOWN;
 2726|  1.03k|    }
 2727|  2.31k|    opj_read_bytes(p_header_data, &l_tcp->numlayers, 2);    /* SGcod (B) */
  ------------------
  |  |   65|  2.31k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2728|  2.31k|    p_header_data += 2;
 2729|       |
 2730|  2.31k|    if ((l_tcp->numlayers < 1U) || (l_tcp->numlayers > 65535U)) {
  ------------------
  |  Branch (2730:9): [True: 0, False: 2.31k]
  |  Branch (2730:36): [True: 0, False: 2.31k]
  ------------------
 2731|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2732|      0|                      "Invalid number of layers in COD marker : %d not in range [1-65535]\n",
 2733|      0|                      l_tcp->numlayers);
 2734|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2735|      0|    }
 2736|       |
 2737|       |    /* If user didn't set a number layer to decode take the max specify in the codestream. */
 2738|  2.31k|    if (l_cp->m_specific_param.m_dec.m_layer) {
  ------------------
  |  Branch (2738:9): [True: 0, False: 2.31k]
  ------------------
 2739|      0|        l_tcp->num_layers_to_decode = l_cp->m_specific_param.m_dec.m_layer;
 2740|  2.31k|    } else {
 2741|  2.31k|        l_tcp->num_layers_to_decode = l_tcp->numlayers;
 2742|  2.31k|    }
 2743|       |
 2744|  2.31k|    opj_read_bytes(p_header_data, &l_tcp->mct, 1);          /* SGcod (C) */
  ------------------
  |  |   65|  2.31k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2745|  2.31k|    ++p_header_data;
 2746|       |
 2747|  2.31k|    if (l_tcp->mct > 1) {
  ------------------
  |  Branch (2747:9): [True: 0, False: 2.31k]
  ------------------
 2748|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2749|      0|                      "Invalid multiple component transformation\n");
 2750|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2751|      0|    }
 2752|       |
 2753|  2.31k|    p_header_size -= 5;
 2754|  6.96k|    for (i = 0; i < l_image->numcomps; ++i) {
  ------------------
  |  Branch (2754:17): [True: 4.64k, False: 2.31k]
  ------------------
 2755|  4.64k|        l_tcp->tccps[i].csty = l_tcp->csty & J2K_CCP_CSTY_PRT;
  ------------------
  |  |   57|  4.64k|#define J2K_CCP_CSTY_PRT 0x01
  ------------------
 2756|  4.64k|    }
 2757|       |
 2758|  2.31k|    if (! opj_j2k_read_SPCod_SPCoc(p_j2k, 0, p_header_data, &p_header_size,
  ------------------
  |  Branch (2758:9): [True: 0, False: 2.31k]
  ------------------
 2759|  2.31k|                                   p_manager)) {
 2760|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COD marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2761|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2762|      0|    }
 2763|       |
 2764|  2.31k|    if (p_header_size != 0) {
  ------------------
  |  Branch (2764:9): [True: 0, False: 2.31k]
  ------------------
 2765|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COD marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2766|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2767|      0|    }
 2768|       |
 2769|       |    /* Apply the coding style to other components of the current tile or the m_default_tcp*/
 2770|  2.31k|    opj_j2k_copy_tile_component_parameters(p_j2k);
 2771|       |
 2772|       |    /* Index */
 2773|       |#ifdef WIP_REMOVE_MSD
 2774|       |    if (p_j2k->cstr_info) {
 2775|       |        /*opj_codestream_info_t *l_cstr_info = p_j2k->cstr_info;*/
 2776|       |        p_j2k->cstr_info->prog = l_tcp->prg;
 2777|       |        p_j2k->cstr_info->numlayers = l_tcp->numlayers;
 2778|       |        p_j2k->cstr_info->numdecompos = (OPJ_INT32*) opj_malloc(
 2779|       |                                            l_image->numcomps * sizeof(OPJ_UINT32));
 2780|       |        if (!p_j2k->cstr_info->numdecompos) {
 2781|       |            return OPJ_FALSE;
 2782|       |        }
 2783|       |        for (i = 0; i < l_image->numcomps; ++i) {
 2784|       |            p_j2k->cstr_info->numdecompos[i] = l_tcp->tccps[i].numresolutions - 1;
 2785|       |        }
 2786|       |    }
 2787|       |#endif
 2788|       |
 2789|  2.31k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.31k|#define OPJ_TRUE 1
  ------------------
 2790|  2.31k|}
j2k.c:opj_j2k_read_SPCod_SPCoc:
10914|  2.31k|{
10915|  2.31k|    OPJ_UINT32 i, l_tmp;
10916|  2.31k|    opj_cp_t *l_cp = NULL;
10917|  2.31k|    opj_tcp_t *l_tcp = NULL;
10918|  2.31k|    opj_tccp_t *l_tccp = NULL;
10919|  2.31k|    OPJ_BYTE * l_current_ptr = NULL;
10920|       |
10921|       |    /* preconditions */
10922|  2.31k|    assert(p_j2k != 00);
10923|  2.31k|    assert(p_manager != 00);
10924|  2.31k|    assert(p_header_data != 00);
10925|       |
10926|  2.31k|    l_cp = &(p_j2k->m_cp);
10927|  2.31k|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ?
  ------------------
  |  Branch (10927:13): [True: 0, False: 2.31k]
  ------------------
10928|      0|            &l_cp->tcps[p_j2k->m_current_tile_number] :
10929|  2.31k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
10930|       |
10931|       |    /* precondition again */
10932|  2.31k|    assert(compno < p_j2k->m_private_image->numcomps);
10933|       |
10934|  2.31k|    l_tccp = &l_tcp->tccps[compno];
10935|  2.31k|    l_current_ptr = p_header_data;
10936|       |
10937|       |    /* make sure room is sufficient */
10938|  2.31k|    if (*p_header_size < 5) {
  ------------------
  |  Branch (10938:9): [True: 0, False: 2.31k]
  ------------------
10939|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading SPCod SPCoc element\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10940|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10941|      0|    }
10942|       |
10943|       |    /* SPcod (D) / SPcoc (A) */
10944|  2.31k|    opj_read_bytes(l_current_ptr, &l_tccp->numresolutions, 1);
  ------------------
  |  |   65|  2.31k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10945|  2.31k|    ++l_tccp->numresolutions;  /* tccp->numresolutions = read() + 1 */
10946|  2.31k|    if (l_tccp->numresolutions > OPJ_J2K_MAXRLVLS) {
  ------------------
  |  |  154|  2.31k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  ------------------
  |  Branch (10946:9): [True: 0, False: 2.31k]
  ------------------
10947|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10948|      0|                      "Invalid value for numresolutions : %d, max value is set in openjpeg.h at %d\n",
10949|      0|                      l_tccp->numresolutions, OPJ_J2K_MAXRLVLS);
  ------------------
  |  |  154|      0|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  ------------------
10950|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10951|      0|    }
10952|  2.31k|    ++l_current_ptr;
10953|       |
10954|       |    /* If user wants to remove more resolutions than the codestream contains, return error */
10955|  2.31k|    if (l_cp->m_specific_param.m_dec.m_reduce >= l_tccp->numresolutions) {
  ------------------
  |  Branch (10955:9): [True: 0, False: 2.31k]
  ------------------
10956|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10957|      0|                      "Error decoding component %d.\nThe number of resolutions "
10958|      0|                      "to remove (%d) is greater or equal than the number "
10959|      0|                      "of resolutions of this component (%d)\nModify the cp_reduce parameter.\n\n",
10960|      0|                      compno, l_cp->m_specific_param.m_dec.m_reduce, l_tccp->numresolutions);
10961|      0|        p_j2k->m_specific_param.m_decoder.m_state |=
10962|      0|            0x8000;/* FIXME J2K_DEC_STATE_ERR;*/
10963|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10964|      0|    }
10965|       |
10966|       |    /* SPcod (E) / SPcoc (B) */
10967|  2.31k|    opj_read_bytes(l_current_ptr, &l_tccp->cblkw, 1);
  ------------------
  |  |   65|  2.31k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10968|  2.31k|    ++l_current_ptr;
10969|  2.31k|    l_tccp->cblkw += 2;
10970|       |
10971|       |    /* SPcod (F) / SPcoc (C) */
10972|  2.31k|    opj_read_bytes(l_current_ptr, &l_tccp->cblkh, 1);
  ------------------
  |  |   65|  2.31k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10973|  2.31k|    ++l_current_ptr;
10974|  2.31k|    l_tccp->cblkh += 2;
10975|       |
10976|  2.31k|    if ((l_tccp->cblkw > 10) || (l_tccp->cblkh > 10) ||
  ------------------
  |  Branch (10976:9): [True: 0, False: 2.31k]
  |  Branch (10976:33): [True: 0, False: 2.31k]
  ------------------
10977|  2.31k|            ((l_tccp->cblkw + l_tccp->cblkh) > 12)) {
  ------------------
  |  Branch (10977:13): [True: 0, False: 2.31k]
  ------------------
10978|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10979|      0|                      "Error reading SPCod SPCoc element, Invalid cblkw/cblkh combination\n");
10980|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10981|      0|    }
10982|       |
10983|       |    /* SPcod (G) / SPcoc (D) */
10984|  2.31k|    opj_read_bytes(l_current_ptr, &l_tccp->cblksty, 1);
  ------------------
  |  |   65|  2.31k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10985|  2.31k|    ++l_current_ptr;
10986|  2.31k|    if ((l_tccp->cblksty & J2K_CCP_CBLKSTY_HTMIXED) != 0) {
  ------------------
  |  |   65|  2.31k|#define J2K_CCP_CBLKSTY_HTMIXED 0x80  /**< MIXED mode HT codeblocks */
  ------------------
  |  Branch (10986:9): [True: 0, False: 2.31k]
  ------------------
10987|       |        /* We do not support HT mixed mode yet.  For conformance, it should be supported.*/
10988|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10989|      0|                      "Error reading SPCod SPCoc element. Unsupported Mixed HT code-block style found\n");
10990|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10991|      0|    }
10992|       |
10993|       |    /* SPcod (H) / SPcoc (E) */
10994|  2.31k|    opj_read_bytes(l_current_ptr, &l_tccp->qmfbid, 1);
  ------------------
  |  |   65|  2.31k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
10995|  2.31k|    ++l_current_ptr;
10996|       |
10997|  2.31k|    if (l_tccp->qmfbid > 1) {
  ------------------
  |  Branch (10997:9): [True: 0, False: 2.31k]
  ------------------
10998|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10999|      0|                      "Error reading SPCod SPCoc element, Invalid transformation found\n");
11000|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11001|      0|    }
11002|       |
11003|  2.31k|    *p_header_size = *p_header_size - 5;
11004|       |
11005|       |    /* use custom precinct size ? */
11006|  2.31k|    if (l_tccp->csty & J2K_CCP_CSTY_PRT) {
  ------------------
  |  |   57|  2.31k|#define J2K_CCP_CSTY_PRT 0x01
  ------------------
  |  Branch (11006:9): [True: 0, False: 2.31k]
  ------------------
11007|      0|        if (*p_header_size < l_tccp->numresolutions) {
  ------------------
  |  Branch (11007:13): [True: 0, False: 0]
  ------------------
11008|      0|            opj_event_msg(p_manager, EVT_ERROR, "Error reading SPCod SPCoc element\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11009|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11010|      0|        }
11011|       |
11012|       |        /* SPcod (I_i) / SPcoc (F_i) */
11013|      0|        for (i = 0; i < l_tccp->numresolutions; ++i) {
  ------------------
  |  Branch (11013:21): [True: 0, False: 0]
  ------------------
11014|      0|            opj_read_bytes(l_current_ptr, &l_tmp, 1);
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
11015|      0|            ++l_current_ptr;
11016|       |            /* Precinct exponent 0 is only allowed for lowest resolution level (Table A.21) */
11017|      0|            if ((i != 0) && (((l_tmp & 0xf) == 0) || ((l_tmp >> 4) == 0))) {
  ------------------
  |  Branch (11017:17): [True: 0, False: 0]
  |  Branch (11017:30): [True: 0, False: 0]
  |  Branch (11017:54): [True: 0, False: 0]
  ------------------
11018|      0|                opj_event_msg(p_manager, EVT_ERROR, "Invalid precinct size\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11019|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11020|      0|            }
11021|      0|            l_tccp->prcw[i] = l_tmp & 0xf;
11022|      0|            l_tccp->prch[i] = l_tmp >> 4;
11023|      0|        }
11024|       |
11025|      0|        *p_header_size = *p_header_size - l_tccp->numresolutions;
11026|  2.31k|    } else {
11027|       |        /* set default size for the precinct width and height */
11028|  9.86k|        for (i = 0; i < l_tccp->numresolutions; ++i) {
  ------------------
  |  Branch (11028:21): [True: 7.55k, False: 2.31k]
  ------------------
11029|  7.55k|            l_tccp->prcw[i] = 15;
11030|  7.55k|            l_tccp->prch[i] = 15;
11031|  7.55k|        }
11032|  2.31k|    }
11033|       |
11034|       |#ifdef WIP_REMOVE_MSD
11035|       |    /* INDEX >> */
11036|       |    if (p_j2k->cstr_info && compno == 0) {
11037|       |        OPJ_UINT32 l_data_size = l_tccp->numresolutions * sizeof(OPJ_UINT32);
11038|       |
11039|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].cblkh =
11040|       |            l_tccp->cblkh;
11041|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].cblkw =
11042|       |            l_tccp->cblkw;
11043|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].numresolutions
11044|       |            = l_tccp->numresolutions;
11045|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].cblksty =
11046|       |            l_tccp->cblksty;
11047|       |        p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].qmfbid =
11048|       |            l_tccp->qmfbid;
11049|       |
11050|       |        memcpy(p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].pdx, l_tccp->prcw,
11051|       |               l_data_size);
11052|       |        memcpy(p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].pdy, l_tccp->prch,
11053|       |               l_data_size);
11054|       |    }
11055|       |    /* << INDEX */
11056|       |#endif
11057|       |
11058|  2.31k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.31k|#define OPJ_TRUE 1
  ------------------
11059|  2.31k|}
j2k.c:opj_j2k_copy_tile_component_parameters:
11062|  2.31k|{
11063|       |    /* loop */
11064|  2.31k|    OPJ_UINT32 i;
11065|  2.31k|    opj_cp_t *l_cp = NULL;
11066|  2.31k|    opj_tcp_t *l_tcp = NULL;
11067|  2.31k|    opj_tccp_t *l_ref_tccp = NULL, *l_copied_tccp = NULL;
11068|  2.31k|    OPJ_UINT32 l_prc_size;
11069|       |
11070|       |    /* preconditions */
11071|  2.31k|    assert(p_j2k != 00);
11072|       |
11073|  2.31k|    l_cp = &(p_j2k->m_cp);
11074|  2.31k|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH)
  ------------------
  |  Branch (11074:13): [True: 0, False: 2.31k]
  ------------------
11075|  2.31k|            ?
11076|      0|            &l_cp->tcps[p_j2k->m_current_tile_number] :
11077|  2.31k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
11078|       |
11079|  2.31k|    l_ref_tccp = &l_tcp->tccps[0];
11080|  2.31k|    l_copied_tccp = l_ref_tccp + 1;
11081|  2.31k|    l_prc_size = l_ref_tccp->numresolutions * (OPJ_UINT32)sizeof(OPJ_UINT32);
11082|       |
11083|  4.64k|    for (i = 1; i < p_j2k->m_private_image->numcomps; ++i) {
  ------------------
  |  Branch (11083:17): [True: 2.32k, False: 2.31k]
  ------------------
11084|  2.32k|        l_copied_tccp->numresolutions = l_ref_tccp->numresolutions;
11085|  2.32k|        l_copied_tccp->cblkw = l_ref_tccp->cblkw;
11086|  2.32k|        l_copied_tccp->cblkh = l_ref_tccp->cblkh;
11087|  2.32k|        l_copied_tccp->cblksty = l_ref_tccp->cblksty;
11088|  2.32k|        l_copied_tccp->qmfbid = l_ref_tccp->qmfbid;
11089|  2.32k|        memcpy(l_copied_tccp->prcw, l_ref_tccp->prcw, l_prc_size);
11090|  2.32k|        memcpy(l_copied_tccp->prch, l_ref_tccp->prch, l_prc_size);
11091|  2.32k|        ++l_copied_tccp;
11092|  2.32k|    }
11093|  2.31k|}
j2k.c:opj_j2k_read_coc:
 2947|      1|{
 2948|      1|    opj_cp_t *l_cp = NULL;
 2949|      1|    opj_tcp_t *l_tcp = NULL;
 2950|      1|    opj_image_t *l_image = NULL;
 2951|      1|    OPJ_UINT32 l_comp_room;
 2952|      1|    OPJ_UINT32 l_comp_no;
 2953|       |
 2954|       |    /* preconditions */
 2955|      1|    assert(p_header_data != 00);
 2956|      1|    assert(p_j2k != 00);
 2957|      1|    assert(p_manager != 00);
 2958|       |
 2959|      1|    l_cp = &(p_j2k->m_cp);
 2960|      1|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH)
  ------------------
  |  Branch (2960:13): [True: 0, False: 1]
  ------------------
 2961|      1|            ?
 2962|      0|            &l_cp->tcps[p_j2k->m_current_tile_number] :
 2963|      1|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 2964|      1|    l_image = p_j2k->m_private_image;
 2965|       |
 2966|      1|    l_comp_room = l_image->numcomps <= 256 ? 1 : 2;
  ------------------
  |  Branch (2966:19): [True: 1, False: 0]
  ------------------
 2967|       |
 2968|       |    /* make sure room is sufficient*/
 2969|      1|    if (p_header_size < l_comp_room + 1) {
  ------------------
  |  Branch (2969:9): [True: 0, False: 1]
  ------------------
 2970|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2971|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2972|      0|    }
 2973|      1|    p_header_size -= l_comp_room + 1;
 2974|       |
 2975|      1|    opj_read_bytes(p_header_data, &l_comp_no,
  ------------------
  |  |   65|      1|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2976|      1|                   l_comp_room);                 /* Ccoc */
 2977|      1|    p_header_data += l_comp_room;
 2978|      1|    if (l_comp_no >= l_image->numcomps) {
  ------------------
  |  Branch (2978:9): [True: 0, False: 1]
  ------------------
 2979|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2980|      0|                      "Error reading COC marker (bad number of components)\n");
 2981|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2982|      0|    }
 2983|       |
 2984|      1|    opj_read_bytes(p_header_data, &l_tcp->tccps[l_comp_no].csty,
  ------------------
  |  |   65|      1|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2985|      1|                   1);                  /* Scoc */
 2986|      1|    ++p_header_data ;
 2987|       |
 2988|      1|    if (! opj_j2k_read_SPCod_SPCoc(p_j2k, l_comp_no, p_header_data, &p_header_size,
  ------------------
  |  Branch (2988:9): [True: 0, False: 1]
  ------------------
 2989|      1|                                   p_manager)) {
 2990|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2991|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2992|      0|    }
 2993|       |
 2994|      1|    if (p_header_size != 0) {
  ------------------
  |  Branch (2994:9): [True: 0, False: 1]
  ------------------
 2995|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading COC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2996|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2997|      0|    }
 2998|      1|    return OPJ_TRUE;
  ------------------
  |  |  117|      1|#define OPJ_TRUE 1
  ------------------
 2999|      1|}
j2k.c:opj_j2k_read_rgn:
 5240|      2|{
 5241|      2|    OPJ_UINT32 l_nb_comp;
 5242|      2|    opj_image_t * l_image = 00;
 5243|       |
 5244|      2|    opj_cp_t *l_cp = 00;
 5245|      2|    opj_tcp_t *l_tcp = 00;
 5246|      2|    OPJ_UINT32 l_comp_room, l_comp_no, l_roi_sty;
 5247|       |
 5248|       |    /* preconditions*/
 5249|      2|    assert(p_header_data != 00);
 5250|      2|    assert(p_j2k != 00);
 5251|      2|    assert(p_manager != 00);
 5252|       |
 5253|      2|    l_image = p_j2k->m_private_image;
 5254|      2|    l_nb_comp = l_image->numcomps;
 5255|       |
 5256|      2|    if (l_nb_comp <= 256) {
  ------------------
  |  Branch (5256:9): [True: 2, False: 0]
  ------------------
 5257|      2|        l_comp_room = 1;
 5258|      2|    } else {
 5259|      0|        l_comp_room = 2;
 5260|      0|    }
 5261|       |
 5262|      2|    if (p_header_size != 2 + l_comp_room) {
  ------------------
  |  Branch (5262:9): [True: 0, False: 2]
  ------------------
 5263|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading RGN marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5264|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5265|      0|    }
 5266|       |
 5267|      2|    l_cp = &(p_j2k->m_cp);
 5268|      2|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ?
  ------------------
  |  Branch (5268:13): [True: 0, False: 2]
  ------------------
 5269|      0|            &l_cp->tcps[p_j2k->m_current_tile_number] :
 5270|      2|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 5271|       |
 5272|      2|    opj_read_bytes(p_header_data, &l_comp_no, l_comp_room);         /* Crgn */
  ------------------
  |  |   65|      2|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5273|      2|    p_header_data += l_comp_room;
 5274|      2|    opj_read_bytes(p_header_data, &l_roi_sty,
  ------------------
  |  |   65|      2|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5275|      2|                   1);                                     /* Srgn */
 5276|      2|    ++p_header_data;
 5277|       |
 5278|       |#ifdef USE_JPWL
 5279|       |    if (l_cp->correct) {
 5280|       |        /* totlen is negative or larger than the bytes left!!! */
 5281|       |        if (l_comp_room >= l_nb_comp) {
 5282|       |            opj_event_msg(p_manager, EVT_ERROR,
 5283|       |                          "JPWL: bad component number in RGN (%d when there are only %d)\n",
 5284|       |                          l_comp_room, l_nb_comp);
 5285|       |            if (!JPWL_ASSUME) {
 5286|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 5287|       |                return OPJ_FALSE;
 5288|       |            }
 5289|       |        }
 5290|       |    };
 5291|       |#endif /* USE_JPWL */
 5292|       |
 5293|       |    /* testcase 3635.pdf.asan.77.2930 */
 5294|      2|    if (l_comp_no >= l_nb_comp) {
  ------------------
  |  Branch (5294:9): [True: 0, False: 2]
  ------------------
 5295|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5296|      0|                      "bad component number in RGN (%d when there are only %d)\n",
 5297|      0|                      l_comp_no, l_nb_comp);
 5298|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5299|      0|    }
 5300|       |
 5301|      2|    opj_read_bytes(p_header_data,
  ------------------
  |  |   65|      2|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5302|      2|                   (OPJ_UINT32 *)(&(l_tcp->tccps[l_comp_no].roishift)), 1);  /* SPrgn */
 5303|      2|    ++p_header_data;
 5304|       |
 5305|      2|    return OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
 5306|       |
 5307|      2|}
j2k.c:opj_j2k_read_qcd:
 3074|  2.32k|{
 3075|       |    /* preconditions */
 3076|  2.32k|    assert(p_header_data != 00);
 3077|  2.32k|    assert(p_j2k != 00);
 3078|  2.32k|    assert(p_manager != 00);
 3079|       |
 3080|  2.32k|    if (! opj_j2k_read_SQcd_SQcc(p_j2k, 0, p_header_data, &p_header_size,
  ------------------
  |  Branch (3080:9): [True: 0, False: 2.32k]
  ------------------
 3081|  2.32k|                                 p_manager)) {
 3082|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading QCD marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3083|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3084|      0|    }
 3085|       |
 3086|  2.32k|    if (p_header_size != 0) {
  ------------------
  |  Branch (3086:9): [True: 0, False: 2.32k]
  ------------------
 3087|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading QCD marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3088|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3089|      0|    }
 3090|       |
 3091|       |    /* Apply the quantization parameters to other components of the current tile or the m_default_tcp */
 3092|  2.32k|    opj_j2k_copy_tile_quantization_parameters(p_j2k);
 3093|       |
 3094|  2.32k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.32k|#define OPJ_TRUE 1
  ------------------
 3095|  2.32k|}
j2k.c:opj_j2k_read_SQcd_SQcc:
11255|  2.32k|{
11256|       |    /* loop*/
11257|  2.32k|    OPJ_UINT32 l_band_no;
11258|  2.32k|    opj_cp_t *l_cp = 00;
11259|  2.32k|    opj_tcp_t *l_tcp = 00;
11260|  2.32k|    opj_tccp_t *l_tccp = 00;
11261|  2.32k|    OPJ_BYTE * l_current_ptr = 00;
11262|  2.32k|    OPJ_UINT32 l_tmp, l_num_band;
11263|       |
11264|       |    /* preconditions*/
11265|  2.32k|    assert(p_j2k != 00);
11266|  2.32k|    assert(p_manager != 00);
11267|  2.32k|    assert(p_header_data != 00);
11268|       |
11269|  2.32k|    l_cp = &(p_j2k->m_cp);
11270|       |    /* come from tile part header or main header ?*/
11271|  2.32k|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH)
  ------------------
  |  Branch (11271:13): [True: 0, False: 2.32k]
  ------------------
11272|  2.32k|            ?
11273|      0|            &l_cp->tcps[p_j2k->m_current_tile_number] :
11274|  2.32k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
11275|       |
11276|       |    /* precondition again*/
11277|  2.32k|    assert(p_comp_no <  p_j2k->m_private_image->numcomps);
11278|       |
11279|  2.32k|    l_tccp = &l_tcp->tccps[p_comp_no];
11280|  2.32k|    l_current_ptr = p_header_data;
11281|       |
11282|  2.32k|    if (*p_header_size < 1) {
  ------------------
  |  Branch (11282:9): [True: 0, False: 2.32k]
  ------------------
11283|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading SQcd or SQcc element\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11284|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11285|      0|    }
11286|  2.32k|    *p_header_size -= 1;
11287|       |
11288|  2.32k|    opj_read_bytes(l_current_ptr, &l_tmp, 1);                       /* Sqcx */
  ------------------
  |  |   65|  2.32k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
11289|  2.32k|    ++l_current_ptr;
11290|       |
11291|  2.32k|    l_tccp->qntsty = l_tmp & 0x1f;
11292|  2.32k|    l_tccp->numgbits = l_tmp >> 5;
11293|  2.32k|    if (l_tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) {
  ------------------
  |  |   67|  2.32k|#define J2K_CCP_QNTSTY_SIQNT 1
  ------------------
  |  Branch (11293:9): [True: 0, False: 2.32k]
  ------------------
11294|      0|        l_num_band = 1;
11295|  2.32k|    } else {
11296|  2.32k|        l_num_band = (l_tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) ?
  ------------------
  |  |   66|  2.32k|#define J2K_CCP_QNTSTY_NOQNT 0
  ------------------
  |  Branch (11296:22): [True: 8, False: 2.32k]
  ------------------
11297|      8|                     (*p_header_size) :
11298|  2.32k|                     (*p_header_size) / 2;
11299|       |
11300|  2.32k|        if (l_num_band > OPJ_J2K_MAXBANDS) {
  ------------------
  |  |  155|  2.32k|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|  2.32k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
  |  Branch (11300:13): [True: 293, False: 2.03k]
  ------------------
11301|    293|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    293|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
11302|    293|                          "While reading CCP_QNTSTY element inside QCD or QCC marker segment, "
11303|    293|                          "number of subbands (%d) is greater to OPJ_J2K_MAXBANDS (%d). So we limit the number of elements stored to "
11304|    293|                          "OPJ_J2K_MAXBANDS (%d) and skip the rest. \n", l_num_band, OPJ_J2K_MAXBANDS,
  ------------------
  |  |  155|    293|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|    293|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
11305|    293|                          OPJ_J2K_MAXBANDS);
  ------------------
  |  |  155|    293|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|    293|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
11306|       |            /*return OPJ_FALSE;*/
11307|    293|        }
11308|  2.32k|    }
11309|       |
11310|       |#ifdef USE_JPWL
11311|       |    if (l_cp->correct) {
11312|       |
11313|       |        /* if JPWL is on, we check whether there are too many subbands */
11314|       |        if (/*(l_num_band < 0) ||*/ (l_num_band >= OPJ_J2K_MAXBANDS)) {
11315|       |            opj_event_msg(p_manager, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
11316|       |                          "JPWL: bad number of subbands in Sqcx (%d)\n",
11317|       |                          l_num_band);
11318|       |            if (!JPWL_ASSUME) {
11319|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
11320|       |                return OPJ_FALSE;
11321|       |            }
11322|       |            /* we try to correct */
11323|       |            l_num_band = 1;
11324|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust them\n"
11325|       |                          "- setting number of bands to %d => HYPOTHESIS!!!\n",
11326|       |                          l_num_band);
11327|       |        };
11328|       |
11329|       |    };
11330|       |#endif /* USE_JPWL */
11331|       |
11332|  2.32k|    if (l_tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) {
  ------------------
  |  |   66|  2.32k|#define J2K_CCP_QNTSTY_NOQNT 0
  ------------------
  |  Branch (11332:9): [True: 8, False: 2.32k]
  ------------------
11333|    245|        for (l_band_no = 0; l_band_no < l_num_band; l_band_no++) {
  ------------------
  |  Branch (11333:29): [True: 237, False: 8]
  ------------------
11334|    237|            opj_read_bytes(l_current_ptr, &l_tmp, 1);                       /* SPqcx_i */
  ------------------
  |  |   65|    237|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
11335|    237|            ++l_current_ptr;
11336|    237|            if (l_band_no < OPJ_J2K_MAXBANDS) {
  ------------------
  |  |  155|    237|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|    237|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
  |  Branch (11336:17): [True: 237, False: 0]
  ------------------
11337|    237|                l_tccp->stepsizes[l_band_no].expn = (OPJ_INT32)(l_tmp >> 3);
11338|    237|                l_tccp->stepsizes[l_band_no].mant = 0;
11339|    237|            }
11340|    237|        }
11341|       |
11342|      8|        if (*p_header_size < l_num_band) {
  ------------------
  |  Branch (11342:13): [True: 0, False: 8]
  ------------------
11343|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11344|      0|        }
11345|      8|        *p_header_size = *p_header_size - l_num_band;
11346|  2.32k|    } else {
11347|   347k|        for (l_band_no = 0; l_band_no < l_num_band; l_band_no++) {
  ------------------
  |  Branch (11347:29): [True: 344k, False: 2.32k]
  ------------------
11348|   344k|            opj_read_bytes(l_current_ptr, &l_tmp, 2);                       /* SPqcx_i */
  ------------------
  |  |   65|   344k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
11349|   344k|            l_current_ptr += 2;
11350|   344k|            if (l_band_no < OPJ_J2K_MAXBANDS) {
  ------------------
  |  |  155|   344k|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|   344k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
  |  Branch (11350:17): [True: 35.6k, False: 309k]
  ------------------
11351|  35.6k|                l_tccp->stepsizes[l_band_no].expn = (OPJ_INT32)(l_tmp >> 11);
11352|  35.6k|                l_tccp->stepsizes[l_band_no].mant = l_tmp & 0x7ff;
11353|  35.6k|            }
11354|   344k|        }
11355|       |
11356|  2.32k|        if (*p_header_size < 2 * l_num_band) {
  ------------------
  |  Branch (11356:13): [True: 0, False: 2.32k]
  ------------------
11357|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11358|      0|        }
11359|  2.32k|        *p_header_size = *p_header_size - 2 * l_num_band;
11360|  2.32k|    }
11361|       |
11362|       |    /* Add Antonin : if scalar_derived -> compute other stepsizes */
11363|  2.32k|    if (l_tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) {
  ------------------
  |  |   67|  2.32k|#define J2K_CCP_QNTSTY_SIQNT 1
  ------------------
  |  Branch (11363:9): [True: 0, False: 2.32k]
  ------------------
11364|      0|        for (l_band_no = 1; l_band_no < OPJ_J2K_MAXBANDS; l_band_no++) {
  ------------------
  |  |  155|      0|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|      0|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
  |  Branch (11364:29): [True: 0, False: 0]
  ------------------
11365|      0|            l_tccp->stepsizes[l_band_no].expn =
11366|      0|                ((OPJ_INT32)(l_tccp->stepsizes[0].expn) - (OPJ_INT32)((l_band_no - 1) / 3) > 0)
  ------------------
  |  Branch (11366:17): [True: 0, False: 0]
  ------------------
11367|      0|                ?
11368|      0|                (OPJ_INT32)(l_tccp->stepsizes[0].expn) - (OPJ_INT32)((l_band_no - 1) / 3) : 0;
11369|      0|            l_tccp->stepsizes[l_band_no].mant = l_tccp->stepsizes[0].mant;
11370|      0|        }
11371|      0|    }
11372|       |
11373|  2.32k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.32k|#define OPJ_TRUE 1
  ------------------
11374|  2.32k|}
j2k.c:opj_j2k_copy_tile_quantization_parameters:
11377|  2.32k|{
11378|  2.32k|    OPJ_UINT32 i;
11379|  2.32k|    opj_cp_t *l_cp = NULL;
11380|  2.32k|    opj_tcp_t *l_tcp = NULL;
11381|  2.32k|    opj_tccp_t *l_ref_tccp = NULL;
11382|  2.32k|    opj_tccp_t *l_copied_tccp = NULL;
11383|  2.32k|    OPJ_UINT32 l_size;
11384|       |
11385|       |    /* preconditions */
11386|  2.32k|    assert(p_j2k != 00);
11387|       |
11388|  2.32k|    l_cp = &(p_j2k->m_cp);
11389|  2.32k|    l_tcp = p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH ?
  ------------------
  |  Branch (11389:13): [True: 0, False: 2.32k]
  ------------------
11390|      0|            &l_cp->tcps[p_j2k->m_current_tile_number] :
11391|  2.32k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
11392|       |
11393|  2.32k|    l_ref_tccp = &l_tcp->tccps[0];
11394|  2.32k|    l_copied_tccp = l_ref_tccp + 1;
11395|  2.32k|    l_size = OPJ_J2K_MAXBANDS * sizeof(opj_stepsize_t);
  ------------------
  |  |  155|  2.32k|#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */
  |  |  ------------------
  |  |  |  |  154|  2.32k|#define OPJ_J2K_MAXRLVLS 33                 /**< Number of maximum resolution level authorized */
  |  |  ------------------
  ------------------
11396|       |
11397|  4.66k|    for (i = 1; i < p_j2k->m_private_image->numcomps; ++i) {
  ------------------
  |  Branch (11397:17): [True: 2.33k, False: 2.32k]
  ------------------
11398|  2.33k|        l_copied_tccp->qntsty = l_ref_tccp->qntsty;
11399|  2.33k|        l_copied_tccp->numgbits = l_ref_tccp->numgbits;
11400|  2.33k|        memcpy(l_copied_tccp->stepsizes, l_ref_tccp->stepsizes, l_size);
11401|  2.33k|        ++l_copied_tccp;
11402|  2.33k|    }
11403|  2.32k|}
j2k.c:opj_j2k_read_qcc:
 3216|      2|{
 3217|      2|    OPJ_UINT32 l_num_comp, l_comp_no;
 3218|       |
 3219|       |    /* preconditions */
 3220|      2|    assert(p_header_data != 00);
 3221|      2|    assert(p_j2k != 00);
 3222|      2|    assert(p_manager != 00);
 3223|       |
 3224|      2|    l_num_comp = p_j2k->m_private_image->numcomps;
 3225|       |
 3226|      2|    if (l_num_comp <= 256) {
  ------------------
  |  Branch (3226:9): [True: 2, False: 0]
  ------------------
 3227|      2|        if (p_header_size < 1) {
  ------------------
  |  Branch (3227:13): [True: 0, False: 2]
  ------------------
 3228|      0|            opj_event_msg(p_manager, EVT_ERROR, "Error reading QCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3229|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3230|      0|        }
 3231|      2|        opj_read_bytes(p_header_data, &l_comp_no, 1);
  ------------------
  |  |   65|      2|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3232|      2|        ++p_header_data;
 3233|      2|        --p_header_size;
 3234|      2|    } else {
 3235|      0|        if (p_header_size < 2) {
  ------------------
  |  Branch (3235:13): [True: 0, False: 0]
  ------------------
 3236|      0|            opj_event_msg(p_manager, EVT_ERROR, "Error reading QCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3237|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3238|      0|        }
 3239|      0|        opj_read_bytes(p_header_data, &l_comp_no, 2);
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3240|      0|        p_header_data += 2;
 3241|      0|        p_header_size -= 2;
 3242|      0|    }
 3243|       |
 3244|       |#ifdef USE_JPWL
 3245|       |    if (p_j2k->m_cp.correct) {
 3246|       |
 3247|       |        static OPJ_UINT32 backup_compno = 0;
 3248|       |
 3249|       |        /* compno is negative or larger than the number of components!!! */
 3250|       |        if (/*(l_comp_no < 0) ||*/ (l_comp_no >= l_num_comp)) {
 3251|       |            opj_event_msg(p_manager, EVT_ERROR,
 3252|       |                          "JPWL: bad component number in QCC (%d out of a maximum of %d)\n",
 3253|       |                          l_comp_no, l_num_comp);
 3254|       |            if (!JPWL_ASSUME) {
 3255|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 3256|       |                return OPJ_FALSE;
 3257|       |            }
 3258|       |            /* we try to correct */
 3259|       |            l_comp_no = backup_compno % l_num_comp;
 3260|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust this\n"
 3261|       |                          "- setting component number to %d\n",
 3262|       |                          l_comp_no);
 3263|       |        }
 3264|       |
 3265|       |        /* keep your private count of tiles */
 3266|       |        backup_compno++;
 3267|       |    };
 3268|       |#endif /* USE_JPWL */
 3269|       |
 3270|      2|    if (l_comp_no >= p_j2k->m_private_image->numcomps) {
  ------------------
  |  Branch (3270:9): [True: 0, False: 2]
  ------------------
 3271|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3272|      0|                      "Invalid component number: %d, regarding the number of components %d\n",
 3273|      0|                      l_comp_no, p_j2k->m_private_image->numcomps);
 3274|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3275|      0|    }
 3276|       |
 3277|      2|    if (! opj_j2k_read_SQcd_SQcc(p_j2k, l_comp_no, p_header_data, &p_header_size,
  ------------------
  |  Branch (3277:9): [True: 0, False: 2]
  ------------------
 3278|      2|                                 p_manager)) {
 3279|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading QCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3280|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3281|      0|    }
 3282|       |
 3283|      2|    if (p_header_size != 0) {
  ------------------
  |  Branch (3283:9): [True: 0, False: 2]
  ------------------
 3284|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading QCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3285|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3286|      0|    }
 3287|       |
 3288|      2|    return OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
 3289|      2|}
j2k.c:opj_j2k_read_poc:
 3531|      3|{
 3532|      3|    OPJ_UINT32 i, l_nb_comp, l_tmp;
 3533|      3|    opj_image_t * l_image = 00;
 3534|      3|    OPJ_UINT32 l_old_poc_nb, l_current_poc_nb, l_current_poc_remaining;
 3535|      3|    OPJ_UINT32 l_chunk_size, l_comp_room;
 3536|       |
 3537|      3|    opj_cp_t *l_cp = 00;
 3538|      3|    opj_tcp_t *l_tcp = 00;
 3539|      3|    opj_poc_t *l_current_poc = 00;
 3540|       |
 3541|       |    /* preconditions */
 3542|      3|    assert(p_header_data != 00);
 3543|      3|    assert(p_j2k != 00);
 3544|      3|    assert(p_manager != 00);
 3545|       |
 3546|      3|    l_image = p_j2k->m_private_image;
 3547|      3|    l_nb_comp = l_image->numcomps;
 3548|      3|    if (l_nb_comp <= 256) {
  ------------------
  |  Branch (3548:9): [True: 3, False: 0]
  ------------------
 3549|      3|        l_comp_room = 1;
 3550|      3|    } else {
 3551|      0|        l_comp_room = 2;
 3552|      0|    }
 3553|      3|    l_chunk_size = 5 + 2 * l_comp_room;
 3554|      3|    l_current_poc_nb = p_header_size / l_chunk_size;
 3555|      3|    l_current_poc_remaining = p_header_size % l_chunk_size;
 3556|       |
 3557|      3|    if ((l_current_poc_nb <= 0) || (l_current_poc_remaining != 0)) {
  ------------------
  |  Branch (3557:9): [True: 0, False: 3]
  |  Branch (3557:36): [True: 0, False: 3]
  ------------------
 3558|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading POC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3559|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3560|      0|    }
 3561|       |
 3562|      3|    l_cp = &(p_j2k->m_cp);
 3563|      3|    l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ?
  ------------------
  |  Branch (3563:13): [True: 0, False: 3]
  ------------------
 3564|      0|            &l_cp->tcps[p_j2k->m_current_tile_number] :
 3565|      3|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 3566|      3|    l_old_poc_nb = l_tcp->POC ? l_tcp->numpocs + 1 : 0;
  ------------------
  |  Branch (3566:20): [True: 1, False: 2]
  ------------------
 3567|      3|    l_current_poc_nb += l_old_poc_nb;
 3568|       |
 3569|      3|    if (l_current_poc_nb >= J2K_MAX_POCS) {
  ------------------
  |  |  114|      3|#define J2K_MAX_POCS    32      /**< Maximum number of POCs */
  ------------------
  |  Branch (3569:9): [True: 0, False: 3]
  ------------------
 3570|      0|        opj_event_msg(p_manager, EVT_ERROR, "Too many POCs %d\n", l_current_poc_nb);
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3571|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3572|      0|    }
 3573|       |
 3574|       |    /* now poc is in use.*/
 3575|      3|    l_tcp->POC = 1;
 3576|       |
 3577|      3|    l_current_poc = &l_tcp->pocs[l_old_poc_nb];
 3578|     30|    for (i = l_old_poc_nb; i < l_current_poc_nb; ++i) {
  ------------------
  |  Branch (3578:28): [True: 27, False: 3]
  ------------------
 3579|     27|        opj_read_bytes(p_header_data, &(l_current_poc->resno0),
  ------------------
  |  |   65|     27|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3580|     27|                       1);                               /* RSpoc_i */
 3581|     27|        ++p_header_data;
 3582|     27|        opj_read_bytes(p_header_data, &(l_current_poc->compno0),
  ------------------
  |  |   65|     27|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3583|     27|                       l_comp_room);  /* CSpoc_i */
 3584|     27|        p_header_data += l_comp_room;
 3585|     27|        opj_read_bytes(p_header_data, &(l_current_poc->layno1),
  ------------------
  |  |   65|     27|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3586|     27|                       2);                               /* LYEpoc_i */
 3587|       |        /* make sure layer end is in acceptable bounds */
 3588|     27|        l_current_poc->layno1 = opj_uint_min(l_current_poc->layno1, l_tcp->numlayers);
 3589|     27|        p_header_data += 2;
 3590|     27|        opj_read_bytes(p_header_data, &(l_current_poc->resno1),
  ------------------
  |  |   65|     27|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3591|     27|                       1);                               /* REpoc_i */
 3592|     27|        ++p_header_data;
 3593|     27|        opj_read_bytes(p_header_data, &(l_current_poc->compno1),
  ------------------
  |  |   65|     27|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3594|     27|                       l_comp_room);  /* CEpoc_i */
 3595|     27|        p_header_data += l_comp_room;
 3596|     27|        opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|     27|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3597|     27|                       1);                                                                 /* Ppoc_i */
 3598|     27|        ++p_header_data;
 3599|     27|        l_current_poc->prg = (OPJ_PROG_ORDER) l_tmp;
 3600|       |        /* make sure comp is in acceptable bounds */
 3601|     27|        l_current_poc->compno1 = opj_uint_min(l_current_poc->compno1, l_nb_comp);
 3602|     27|        ++l_current_poc;
 3603|     27|    }
 3604|       |
 3605|      3|    l_tcp->numpocs = l_current_poc_nb - 1;
 3606|      3|    return OPJ_TRUE;
  ------------------
  |  |  117|      3|#define OPJ_TRUE 1
  ------------------
 3607|      3|}
j2k.c:opj_j2k_read_siz:
 2079|     39|{
 2080|     39|    OPJ_UINT32 i;
 2081|     39|    OPJ_UINT32 l_nb_comp;
 2082|     39|    OPJ_UINT32 l_nb_comp_remain;
 2083|     39|    OPJ_UINT32 l_remaining_size;
 2084|     39|    OPJ_UINT32 l_nb_tiles;
 2085|     39|    OPJ_UINT32 l_tmp, l_tx1, l_ty1;
 2086|     39|    OPJ_UINT32 l_prec0, l_sgnd0;
 2087|     39|    opj_image_t *l_image = 00;
 2088|     39|    opj_cp_t *l_cp = 00;
 2089|     39|    opj_image_comp_t * l_img_comp = 00;
 2090|     39|    opj_tcp_t * l_current_tile_param = 00;
 2091|       |
 2092|       |    /* preconditions */
 2093|     39|    assert(p_j2k != 00);
 2094|     39|    assert(p_manager != 00);
 2095|     39|    assert(p_header_data != 00);
 2096|       |
 2097|     39|    l_image = p_j2k->m_private_image;
 2098|     39|    l_cp = &(p_j2k->m_cp);
 2099|       |
 2100|       |    /* minimum size == 39 - 3 (= minimum component parameter) */
 2101|     39|    if (p_header_size < 36) {
  ------------------
  |  Branch (2101:9): [True: 0, False: 39]
  ------------------
 2102|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error with SIZ marker size\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2103|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2104|      0|    }
 2105|       |
 2106|     39|    l_remaining_size = p_header_size - 36;
 2107|     39|    l_nb_comp = l_remaining_size / 3;
 2108|     39|    l_nb_comp_remain = l_remaining_size % 3;
 2109|     39|    if (l_nb_comp_remain != 0) {
  ------------------
  |  Branch (2109:9): [True: 0, False: 39]
  ------------------
 2110|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error with SIZ marker size\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2111|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2112|      0|    }
 2113|       |
 2114|     39|    opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|     39|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2115|     39|                   2);                                                /* Rsiz (capabilities) */
 2116|     39|    p_header_data += 2;
 2117|     39|    l_cp->rsiz = (OPJ_UINT16) l_tmp;
 2118|     39|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_image->x1, 4);   /* Xsiz */
  ------------------
  |  |   65|     39|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2119|     39|    p_header_data += 4;
 2120|     39|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_image->y1, 4);   /* Ysiz */
  ------------------
  |  |   65|     39|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2121|     39|    p_header_data += 4;
 2122|     39|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_image->x0, 4);   /* X0siz */
  ------------------
  |  |   65|     39|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2123|     39|    p_header_data += 4;
 2124|     39|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_image->y0, 4);   /* Y0siz */
  ------------------
  |  |   65|     39|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2125|     39|    p_header_data += 4;
 2126|     39|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_cp->tdx,
  ------------------
  |  |   65|     39|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2127|     39|                   4);             /* XTsiz */
 2128|     39|    p_header_data += 4;
 2129|     39|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_cp->tdy,
  ------------------
  |  |   65|     39|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2130|     39|                   4);             /* YTsiz */
 2131|     39|    p_header_data += 4;
 2132|     39|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_cp->tx0,
  ------------------
  |  |   65|     39|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2133|     39|                   4);             /* XT0siz */
 2134|     39|    p_header_data += 4;
 2135|     39|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_cp->ty0,
  ------------------
  |  |   65|     39|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2136|     39|                   4);             /* YT0siz */
 2137|     39|    p_header_data += 4;
 2138|     39|    opj_read_bytes(p_header_data, (OPJ_UINT32*) &l_tmp,
  ------------------
  |  |   65|     39|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2139|     39|                   2);                 /* Csiz */
 2140|     39|    p_header_data += 2;
 2141|     39|    if (l_tmp < 16385) {
  ------------------
  |  Branch (2141:9): [True: 39, False: 0]
  ------------------
 2142|     39|        l_image->numcomps = (OPJ_UINT16) l_tmp;
 2143|     39|    } else {
 2144|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2145|      0|                      "Error with SIZ marker: number of component is illegal -> %d\n", l_tmp);
 2146|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2147|      0|    }
 2148|       |
 2149|     39|    if (l_image->numcomps != l_nb_comp) {
  ------------------
  |  Branch (2149:9): [True: 0, False: 39]
  ------------------
 2150|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2151|      0|                      "Error with SIZ marker: number of component is not compatible with the remaining number of parameters ( %d vs %d)\n",
 2152|      0|                      l_image->numcomps, l_nb_comp);
 2153|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2154|      0|    }
 2155|       |
 2156|       |    /* testcase 4035.pdf.SIGSEGV.d8b.3375 */
 2157|       |    /* testcase issue427-null-image-size.jp2 */
 2158|     39|    if ((l_image->x0 >= l_image->x1) || (l_image->y0 >= l_image->y1)) {
  ------------------
  |  Branch (2158:9): [True: 0, False: 39]
  |  Branch (2158:41): [True: 0, False: 39]
  ------------------
 2159|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2160|      0|                      "Error with SIZ marker: negative or zero image size (%" PRId64 " x %" PRId64
 2161|      0|                      ")\n", (OPJ_INT64)l_image->x1 - l_image->x0,
 2162|      0|                      (OPJ_INT64)l_image->y1 - l_image->y0);
 2163|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2164|      0|    }
 2165|       |    /* testcase 2539.pdf.SIGFPE.706.1712 (also 3622.pdf.SIGFPE.706.2916 and 4008.pdf.SIGFPE.706.3345 and maybe more) */
 2166|     39|    if ((l_cp->tdx == 0U) || (l_cp->tdy == 0U)) {
  ------------------
  |  Branch (2166:9): [True: 0, False: 39]
  |  Branch (2166:30): [True: 0, False: 39]
  ------------------
 2167|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2168|      0|                      "Error with SIZ marker: invalid tile size (tdx: %d, tdy: %d)\n", l_cp->tdx,
 2169|      0|                      l_cp->tdy);
 2170|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2171|      0|    }
 2172|       |
 2173|       |    /* testcase issue427-illegal-tile-offset.jp2 */
 2174|     39|    l_tx1 = opj_uint_adds(l_cp->tx0, l_cp->tdx); /* manage overflow */
 2175|     39|    l_ty1 = opj_uint_adds(l_cp->ty0, l_cp->tdy); /* manage overflow */
 2176|     39|    if ((l_cp->tx0 > l_image->x0) || (l_cp->ty0 > l_image->y0) ||
  ------------------
  |  Branch (2176:9): [True: 0, False: 39]
  |  Branch (2176:38): [True: 0, False: 39]
  ------------------
 2177|     39|            (l_tx1 <= l_image->x0) || (l_ty1 <= l_image->y0)) {
  ------------------
  |  Branch (2177:13): [True: 0, False: 39]
  |  Branch (2177:39): [True: 0, False: 39]
  ------------------
 2178|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2179|      0|                      "Error with SIZ marker: illegal tile offset\n");
 2180|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2181|      0|    }
 2182|     39|    if (!p_j2k->dump_state) {
  ------------------
  |  Branch (2182:9): [True: 39, False: 0]
  ------------------
 2183|     39|        OPJ_UINT32 siz_w, siz_h;
 2184|       |
 2185|     39|        siz_w = l_image->x1 - l_image->x0;
 2186|     39|        siz_h = l_image->y1 - l_image->y0;
 2187|       |
 2188|     39|        if (p_j2k->ihdr_w > 0 && p_j2k->ihdr_h > 0
  ------------------
  |  Branch (2188:13): [True: 39, False: 0]
  |  Branch (2188:34): [True: 39, False: 0]
  ------------------
 2189|     39|                && (p_j2k->ihdr_w != siz_w || p_j2k->ihdr_h != siz_h)) {
  ------------------
  |  Branch (2189:21): [True: 0, False: 39]
  |  Branch (2189:47): [True: 0, False: 39]
  ------------------
 2190|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2191|      0|                          "Error with SIZ marker: IHDR w(%u) h(%u) vs. SIZ w(%u) h(%u)\n", p_j2k->ihdr_w,
 2192|      0|                          p_j2k->ihdr_h, siz_w, siz_h);
 2193|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2194|      0|        }
 2195|     39|    }
 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|     39|    l_image->comps = (opj_image_comp_t*) opj_calloc(l_image->numcomps,
 2240|     39|                     sizeof(opj_image_comp_t));
 2241|     39|    if (l_image->comps == 00) {
  ------------------
  |  Branch (2241:9): [True: 0, False: 39]
  ------------------
 2242|      0|        l_image->numcomps = 0;
 2243|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2244|      0|                      "Not enough memory to take in charge SIZ marker\n");
 2245|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2246|      0|    }
 2247|       |
 2248|     39|    l_img_comp = l_image->comps;
 2249|       |
 2250|     39|    l_prec0 = 0;
 2251|     39|    l_sgnd0 = 0;
 2252|       |    /* Read the component information */
 2253|    148|    for (i = 0; i < l_image->numcomps; ++i) {
  ------------------
  |  Branch (2253:17): [True: 109, False: 39]
  ------------------
 2254|    109|        OPJ_UINT32 tmp;
 2255|    109|        opj_read_bytes(p_header_data, &tmp, 1); /* Ssiz_i */
  ------------------
  |  |   65|    109|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2256|    109|        ++p_header_data;
 2257|    109|        l_img_comp->prec = (tmp & 0x7f) + 1;
 2258|    109|        l_img_comp->sgnd = tmp >> 7;
 2259|       |
 2260|    109|        if (p_j2k->dump_state == 0) {
  ------------------
  |  Branch (2260:13): [True: 109, False: 0]
  ------------------
 2261|    109|            if (i == 0) {
  ------------------
  |  Branch (2261:17): [True: 39, False: 70]
  ------------------
 2262|     39|                l_prec0 = l_img_comp->prec;
 2263|     39|                l_sgnd0 = l_img_comp->sgnd;
 2264|     70|            } else if (!l_cp->allow_different_bit_depth_sign
  ------------------
  |  Branch (2264:24): [True: 70, False: 0]
  ------------------
 2265|     70|                       && (l_img_comp->prec != l_prec0 || l_img_comp->sgnd != l_sgnd0)) {
  ------------------
  |  Branch (2265:28): [True: 50, False: 20]
  |  Branch (2265:59): [True: 1, False: 19]
  ------------------
 2266|     51|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|     51|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2267|     51|                              "Despite JP2 BPC!=255, precision and/or sgnd values for comp[%d] is different than comp[0]:\n"
 2268|     51|                              "        [0] prec(%d) sgnd(%d) [%d] prec(%d) sgnd(%d)\n", i, l_prec0, l_sgnd0,
 2269|     51|                              i, l_img_comp->prec, l_img_comp->sgnd);
 2270|     51|            }
 2271|       |            /* TODO: we should perhaps also check against JP2 BPCC values */
 2272|    109|        }
 2273|    109|        opj_read_bytes(p_header_data, &tmp, 1); /* XRsiz_i */
  ------------------
  |  |   65|    109|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2274|    109|        ++p_header_data;
 2275|    109|        l_img_comp->dx = (OPJ_UINT32)tmp; /* should be between 1 and 255 */
 2276|    109|        opj_read_bytes(p_header_data, &tmp, 1); /* YRsiz_i */
  ------------------
  |  |   65|    109|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2277|    109|        ++p_header_data;
 2278|    109|        l_img_comp->dy = (OPJ_UINT32)tmp; /* should be between 1 and 255 */
 2279|    109|        if (l_img_comp->dx < 1 || l_img_comp->dx > 255 ||
  ------------------
  |  Branch (2279:13): [True: 0, False: 109]
  |  Branch (2279:35): [True: 0, False: 109]
  ------------------
 2280|    109|                l_img_comp->dy < 1 || l_img_comp->dy > 255) {
  ------------------
  |  Branch (2280:17): [True: 0, False: 109]
  |  Branch (2280:39): [True: 0, False: 109]
  ------------------
 2281|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2282|      0|                          "Invalid values for comp = %d : dx=%u dy=%u (should be between 1 and 255 according to the JPEG2000 norm)\n",
 2283|      0|                          i, l_img_comp->dx, l_img_comp->dy);
 2284|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2285|      0|        }
 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|    109|        if (l_img_comp->prec > 31) {
  ------------------
  |  Branch (2289:13): [True: 0, False: 109]
  ------------------
 2290|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2291|      0|                          "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|      0|                          i, l_img_comp->prec);
 2293|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2294|      0|        }
 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|    109|        l_img_comp->resno_decoded =
 2325|    109|            0;                                                          /* number of resolution decoded */
 2326|    109|        l_img_comp->factor =
 2327|    109|            l_cp->m_specific_param.m_dec.m_reduce; /* reducing factor per component */
 2328|    109|        ++l_img_comp;
 2329|    109|    }
 2330|       |
 2331|     39|    if (l_cp->tdx == 0 || l_cp->tdy == 0) {
  ------------------
  |  Branch (2331:9): [True: 0, False: 39]
  |  Branch (2331:27): [True: 0, False: 39]
  ------------------
 2332|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2333|      0|    }
 2334|       |
 2335|       |    /* Compute the number of tiles */
 2336|     39|    l_cp->tw = opj_uint_ceildiv(l_image->x1 - l_cp->tx0, l_cp->tdx);
 2337|     39|    l_cp->th = opj_uint_ceildiv(l_image->y1 - l_cp->ty0, l_cp->tdy);
 2338|       |
 2339|       |    /* Check that the number of tiles is valid */
 2340|     39|    if (l_cp->tw == 0 || l_cp->th == 0 || l_cp->tw > 65535 / l_cp->th) {
  ------------------
  |  Branch (2340:9): [True: 0, False: 39]
  |  Branch (2340:26): [True: 0, False: 39]
  |  Branch (2340:43): [True: 0, False: 39]
  ------------------
 2341|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2342|      0|                      "Invalid number of tiles : %u x %u (maximum fixed by jpeg2000 norm is 65535 tiles)\n",
 2343|      0|                      l_cp->tw, l_cp->th);
 2344|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2345|      0|    }
 2346|     39|    l_nb_tiles = l_cp->tw * l_cp->th;
 2347|       |
 2348|       |    /* Define the tiles which will be decoded */
 2349|     39|    if (p_j2k->m_specific_param.m_decoder.m_discard_tiles) {
  ------------------
  |  Branch (2349:9): [True: 0, False: 39]
  ------------------
 2350|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_x =
 2351|      0|            (p_j2k->m_specific_param.m_decoder.m_start_tile_x - l_cp->tx0) / l_cp->tdx;
 2352|      0|        p_j2k->m_specific_param.m_decoder.m_start_tile_y =
 2353|      0|            (p_j2k->m_specific_param.m_decoder.m_start_tile_y - l_cp->ty0) / l_cp->tdy;
 2354|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = opj_uint_ceildiv(
 2355|      0|                    p_j2k->m_specific_param.m_decoder.m_end_tile_x - l_cp->tx0,
 2356|      0|                    l_cp->tdx);
 2357|      0|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = opj_uint_ceildiv(
 2358|      0|                    p_j2k->m_specific_param.m_decoder.m_end_tile_y - l_cp->ty0,
 2359|      0|                    l_cp->tdy);
 2360|     39|    } else {
 2361|     39|        p_j2k->m_specific_param.m_decoder.m_start_tile_x = 0;
 2362|     39|        p_j2k->m_specific_param.m_decoder.m_start_tile_y = 0;
 2363|     39|        p_j2k->m_specific_param.m_decoder.m_end_tile_x = l_cp->tw;
 2364|     39|        p_j2k->m_specific_param.m_decoder.m_end_tile_y = l_cp->th;
 2365|     39|    }
 2366|       |
 2367|       |#ifdef USE_JPWL
 2368|       |    if (l_cp->correct) {
 2369|       |        /* if JPWL is on, we check whether TX errors have damaged
 2370|       |          too much the SIZ parameters */
 2371|       |        if ((l_cp->tw < 1) || (l_cp->th < 1) || (l_cp->tw > l_cp->max_tiles) ||
 2372|       |                (l_cp->th > l_cp->max_tiles)) {
 2373|       |            opj_event_msg(p_manager, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
 2374|       |                          "JPWL: bad number of tiles (%d x %d)\n",
 2375|       |                          l_cp->tw, l_cp->th);
 2376|       |            if (!JPWL_ASSUME) {
 2377|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 2378|       |                return OPJ_FALSE;
 2379|       |            }
 2380|       |            /* we try to correct */
 2381|       |            opj_event_msg(p_manager, EVT_WARNING, "- trying to adjust them\n");
 2382|       |            if (l_cp->tw < 1) {
 2383|       |                l_cp->tw = 1;
 2384|       |                opj_event_msg(p_manager, EVT_WARNING,
 2385|       |                              "- setting %d tiles in x => HYPOTHESIS!!!\n",
 2386|       |                              l_cp->tw);
 2387|       |            }
 2388|       |            if (l_cp->tw > l_cp->max_tiles) {
 2389|       |                l_cp->tw = 1;
 2390|       |                opj_event_msg(p_manager, EVT_WARNING,
 2391|       |                              "- too large x, increase expectance of %d\n"
 2392|       |                              "- setting %d tiles in x => HYPOTHESIS!!!\n",
 2393|       |                              l_cp->max_tiles, l_cp->tw);
 2394|       |            }
 2395|       |            if (l_cp->th < 1) {
 2396|       |                l_cp->th = 1;
 2397|       |                opj_event_msg(p_manager, EVT_WARNING,
 2398|       |                              "- setting %d tiles in y => HYPOTHESIS!!!\n",
 2399|       |                              l_cp->th);
 2400|       |            }
 2401|       |            if (l_cp->th > l_cp->max_tiles) {
 2402|       |                l_cp->th = 1;
 2403|       |                opj_event_msg(p_manager, EVT_WARNING,
 2404|       |                              "- too large y, increase expectance of %d to continue\n",
 2405|       |                              "- setting %d tiles in y => HYPOTHESIS!!!\n",
 2406|       |                              l_cp->max_tiles, l_cp->th);
 2407|       |            }
 2408|       |        }
 2409|       |    }
 2410|       |#endif /* USE_JPWL */
 2411|       |
 2412|       |    /* memory allocations */
 2413|     39|    l_cp->tcps = (opj_tcp_t*) opj_calloc(l_nb_tiles, sizeof(opj_tcp_t));
 2414|     39|    if (l_cp->tcps == 00) {
  ------------------
  |  Branch (2414:9): [True: 0, False: 39]
  ------------------
 2415|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2416|      0|                      "Not enough memory to take in charge SIZ marker\n");
 2417|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2418|      0|    }
 2419|       |
 2420|       |#ifdef USE_JPWL
 2421|       |    if (l_cp->correct) {
 2422|       |        if (!l_cp->tcps) {
 2423|       |            opj_event_msg(p_manager, JPWL_ASSUME ? EVT_WARNING : EVT_ERROR,
 2424|       |                          "JPWL: could not alloc tcps field of cp\n");
 2425|       |            if (!JPWL_ASSUME) {
 2426|       |                opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
 2427|       |                return OPJ_FALSE;
 2428|       |            }
 2429|       |        }
 2430|       |    }
 2431|       |#endif /* USE_JPWL */
 2432|       |
 2433|     39|    p_j2k->m_specific_param.m_decoder.m_default_tcp->tccps =
 2434|     39|        (opj_tccp_t*) opj_calloc(l_image->numcomps, sizeof(opj_tccp_t));
 2435|     39|    if (p_j2k->m_specific_param.m_decoder.m_default_tcp->tccps  == 00) {
  ------------------
  |  Branch (2435:9): [True: 0, False: 39]
  ------------------
 2436|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2437|      0|                      "Not enough memory to take in charge SIZ marker\n");
 2438|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2439|      0|    }
 2440|       |
 2441|     39|    p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mct_records =
 2442|     39|        (opj_mct_data_t*)opj_calloc(OPJ_J2K_MCT_DEFAULT_NB_RECORDS,
  ------------------
  |  |  161|     39|#define OPJ_J2K_MCT_DEFAULT_NB_RECORDS      10
  ------------------
 2443|     39|                                    sizeof(opj_mct_data_t));
 2444|       |
 2445|     39|    if (! p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mct_records) {
  ------------------
  |  Branch (2445:9): [True: 0, False: 39]
  ------------------
 2446|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2447|      0|                      "Not enough memory to take in charge SIZ marker\n");
 2448|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2449|      0|    }
 2450|     39|    p_j2k->m_specific_param.m_decoder.m_default_tcp->m_nb_max_mct_records =
 2451|     39|        OPJ_J2K_MCT_DEFAULT_NB_RECORDS;
  ------------------
  |  |  161|     39|#define OPJ_J2K_MCT_DEFAULT_NB_RECORDS      10
  ------------------
 2452|       |
 2453|     39|    p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mcc_records =
 2454|     39|        (opj_simple_mcc_decorrelation_data_t*)
 2455|     39|        opj_calloc(OPJ_J2K_MCC_DEFAULT_NB_RECORDS,
  ------------------
  |  |  160|     39|#define OPJ_J2K_MCC_DEFAULT_NB_RECORDS      10
  ------------------
 2456|     39|                   sizeof(opj_simple_mcc_decorrelation_data_t));
 2457|       |
 2458|     39|    if (! p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mcc_records) {
  ------------------
  |  Branch (2458:9): [True: 0, False: 39]
  ------------------
 2459|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2460|      0|                      "Not enough memory to take in charge SIZ marker\n");
 2461|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2462|      0|    }
 2463|     39|    p_j2k->m_specific_param.m_decoder.m_default_tcp->m_nb_max_mcc_records =
 2464|     39|        OPJ_J2K_MCC_DEFAULT_NB_RECORDS;
  ------------------
  |  |  160|     39|#define OPJ_J2K_MCC_DEFAULT_NB_RECORDS      10
  ------------------
 2465|       |
 2466|       |    /* set up default dc level shift */
 2467|    148|    for (i = 0; i < l_image->numcomps; ++i) {
  ------------------
  |  Branch (2467:17): [True: 109, False: 39]
  ------------------
 2468|    109|        if (! l_image->comps[i].sgnd) {
  ------------------
  |  Branch (2468:13): [True: 70, False: 39]
  ------------------
 2469|     70|            p_j2k->m_specific_param.m_decoder.m_default_tcp->tccps[i].m_dc_level_shift = 1
 2470|     70|                    << (l_image->comps[i].prec - 1);
 2471|     70|        }
 2472|    109|    }
 2473|       |
 2474|     39|    l_current_tile_param = l_cp->tcps;
 2475|  6.95k|    for (i = 0; i < l_nb_tiles; ++i) {
  ------------------
  |  Branch (2475:17): [True: 6.91k, False: 39]
  ------------------
 2476|  6.91k|        l_current_tile_param->tccps = (opj_tccp_t*) opj_calloc(l_image->numcomps,
 2477|  6.91k|                                      sizeof(opj_tccp_t));
 2478|  6.91k|        if (l_current_tile_param->tccps == 00) {
  ------------------
  |  Branch (2478:13): [True: 0, False: 6.91k]
  ------------------
 2479|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2480|      0|                          "Not enough memory to take in charge SIZ marker\n");
 2481|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2482|      0|        }
 2483|       |
 2484|  6.91k|        ++l_current_tile_param;
 2485|  6.91k|    }
 2486|       |
 2487|       |    /*Allocate and initialize some elements of codestrem index*/
 2488|     39|    if (!opj_j2k_allocate_tile_element_cstr_index(p_j2k)) {
  ------------------
  |  Branch (2488:9): [True: 0, False: 39]
  ------------------
 2489|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2490|      0|    }
 2491|       |
 2492|     39|    p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_MH;
 2493|     39|    opj_image_comp_header_update(l_image, l_cp);
 2494|       |
 2495|     39|    return OPJ_TRUE;
  ------------------
  |  |  117|     39|#define OPJ_TRUE 1
  ------------------
 2496|     39|}
j2k.c:opj_j2k_allocate_tile_element_cstr_index:
11855|     39|{
11856|     39|    OPJ_UINT32 it_tile = 0;
11857|       |
11858|     39|    p_j2k->cstr_index->nb_of_tiles = p_j2k->m_cp.tw * p_j2k->m_cp.th;
11859|     39|    p_j2k->cstr_index->tile_index = (opj_tile_index_t*)opj_calloc(
11860|     39|                                        p_j2k->cstr_index->nb_of_tiles, sizeof(opj_tile_index_t));
11861|     39|    if (!p_j2k->cstr_index->tile_index) {
  ------------------
  |  Branch (11861:9): [True: 0, False: 39]
  ------------------
11862|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11863|      0|    }
11864|       |
11865|  6.95k|    for (it_tile = 0; it_tile < p_j2k->cstr_index->nb_of_tiles; it_tile++) {
  ------------------
  |  Branch (11865:23): [True: 6.91k, False: 39]
  ------------------
11866|  6.91k|        p_j2k->cstr_index->tile_index[it_tile].maxmarknum = 100;
11867|  6.91k|        p_j2k->cstr_index->tile_index[it_tile].marknum = 0;
11868|  6.91k|        p_j2k->cstr_index->tile_index[it_tile].marker = (opj_marker_info_t*)
11869|  6.91k|                opj_calloc(p_j2k->cstr_index->tile_index[it_tile].maxmarknum,
11870|  6.91k|                           sizeof(opj_marker_info_t));
11871|  6.91k|        if (!p_j2k->cstr_index->tile_index[it_tile].marker) {
  ------------------
  |  Branch (11871:13): [True: 0, False: 6.91k]
  ------------------
11872|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11873|      0|        }
11874|  6.91k|    }
11875|       |
11876|     39|    return OPJ_TRUE;
  ------------------
  |  |  117|     39|#define OPJ_TRUE 1
  ------------------
11877|     39|}
j2k.c:opj_j2k_read_plm:
 3789|  2.46k|{
 3790|       |    /* preconditions */
 3791|  2.46k|    assert(p_header_data != 00);
 3792|  2.46k|    assert(p_j2k != 00);
 3793|  2.46k|    assert(p_manager != 00);
 3794|       |
 3795|  2.46k|    OPJ_UNUSED(p_j2k);
  ------------------
  |  |  221|  2.46k|#define OPJ_UNUSED(x) (void)x
  ------------------
 3796|  2.46k|    OPJ_UNUSED(p_header_data);
  ------------------
  |  |  221|  2.46k|#define OPJ_UNUSED(x) (void)x
  ------------------
 3797|       |
 3798|  2.46k|    if (p_header_size < 1) {
  ------------------
  |  Branch (3798:9): [True: 0, False: 2.46k]
  ------------------
 3799|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading PLM marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3800|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3801|      0|    }
 3802|       |    /* Do not care of this at the moment since only local variables are set here */
 3803|       |    /*
 3804|       |    opj_read_bytes(p_header_data,&l_Zplm,1);                                        // Zplm
 3805|       |    ++p_header_data;
 3806|       |    --p_header_size;
 3807|       |
 3808|       |    while
 3809|       |            (p_header_size > 0)
 3810|       |    {
 3811|       |            opj_read_bytes(p_header_data,&l_Nplm,1);                                // Nplm
 3812|       |            ++p_header_data;
 3813|       |            p_header_size -= (1+l_Nplm);
 3814|       |            if
 3815|       |                    (p_header_size < 0)
 3816|       |            {
 3817|       |                    opj_event_msg(p_manager, EVT_ERROR, "Error reading PLM marker\n");
 3818|       |                    return false;
 3819|       |            }
 3820|       |            for
 3821|       |                    (i = 0; i < l_Nplm; ++i)
 3822|       |            {
 3823|       |                    opj_read_bytes(p_header_data,&l_tmp,1);                         // Iplm_ij
 3824|       |                    ++p_header_data;
 3825|       |                    // take only the last seven bytes
 3826|       |                    l_packet_len |= (l_tmp & 0x7f);
 3827|       |                    if
 3828|       |                            (l_tmp & 0x80)
 3829|       |                    {
 3830|       |                            l_packet_len <<= 7;
 3831|       |                    }
 3832|       |                    else
 3833|       |                    {
 3834|       |            // store packet length and proceed to next packet
 3835|       |                            l_packet_len = 0;
 3836|       |                    }
 3837|       |            }
 3838|       |            if
 3839|       |                    (l_packet_len != 0)
 3840|       |            {
 3841|       |                    opj_event_msg(p_manager, EVT_ERROR, "Error reading PLM marker\n");
 3842|       |                    return false;
 3843|       |            }
 3844|       |    }
 3845|       |    */
 3846|  2.46k|    return OPJ_TRUE;
  ------------------
  |  |  117|  2.46k|#define OPJ_TRUE 1
  ------------------
 3847|  2.46k|}
j2k.c:opj_j2k_read_ppm:
 3916|      2|{
 3917|      2|    opj_cp_t *l_cp = 00;
 3918|      2|    OPJ_UINT32 l_Z_ppm;
 3919|       |
 3920|       |    /* preconditions */
 3921|      2|    assert(p_header_data != 00);
 3922|      2|    assert(p_j2k != 00);
 3923|      2|    assert(p_manager != 00);
 3924|       |
 3925|       |    /* We need to have the Z_ppm element + 1 byte of Nppm/Ippm at minimum */
 3926|      2|    if (p_header_size < 2) {
  ------------------
  |  Branch (3926:9): [True: 0, False: 2]
  ------------------
 3927|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading PPM marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3928|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3929|      0|    }
 3930|       |
 3931|      2|    l_cp = &(p_j2k->m_cp);
 3932|      2|    l_cp->ppm = 1;
 3933|       |
 3934|      2|    opj_read_bytes(p_header_data, &l_Z_ppm, 1);             /* Z_ppm */
  ------------------
  |  |   65|      2|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 3935|      2|    ++p_header_data;
 3936|      2|    --p_header_size;
 3937|       |
 3938|       |    /* check allocation needed */
 3939|      2|    if (l_cp->ppm_markers == NULL) { /* first PPM marker */
  ------------------
  |  Branch (3939:9): [True: 2, False: 0]
  ------------------
 3940|      2|        OPJ_UINT32 l_newCount = l_Z_ppm + 1U; /* can't overflow, l_Z_ppm is UINT8 */
 3941|      2|        assert(l_cp->ppm_markers_count == 0U);
 3942|       |
 3943|      2|        l_cp->ppm_markers = (opj_ppx *) opj_calloc(l_newCount, sizeof(opj_ppx));
 3944|      2|        if (l_cp->ppm_markers == NULL) {
  ------------------
  |  Branch (3944:13): [True: 0, False: 2]
  ------------------
 3945|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPM marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3946|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3947|      0|        }
 3948|      2|        l_cp->ppm_markers_count = l_newCount;
 3949|      2|    } else if (l_cp->ppm_markers_count <= l_Z_ppm) {
  ------------------
  |  Branch (3949:16): [True: 0, False: 0]
  ------------------
 3950|      0|        OPJ_UINT32 l_newCount = l_Z_ppm + 1U; /* can't overflow, l_Z_ppm is UINT8 */
 3951|      0|        opj_ppx *new_ppm_markers;
 3952|      0|        new_ppm_markers = (opj_ppx *) opj_realloc(l_cp->ppm_markers,
 3953|      0|                          l_newCount * sizeof(opj_ppx));
 3954|      0|        if (new_ppm_markers == NULL) {
  ------------------
  |  Branch (3954:13): [True: 0, False: 0]
  ------------------
 3955|       |            /* clean up to be done on l_cp destruction */
 3956|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPM marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3957|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3958|      0|        }
 3959|      0|        l_cp->ppm_markers = new_ppm_markers;
 3960|      0|        memset(l_cp->ppm_markers + l_cp->ppm_markers_count, 0,
 3961|      0|               (l_newCount - l_cp->ppm_markers_count) * sizeof(opj_ppx));
 3962|      0|        l_cp->ppm_markers_count = l_newCount;
 3963|      0|    }
 3964|       |
 3965|      2|    if (l_cp->ppm_markers[l_Z_ppm].m_data != NULL) {
  ------------------
  |  Branch (3965:9): [True: 0, False: 2]
  ------------------
 3966|       |        /* clean up to be done on l_cp destruction */
 3967|      0|        opj_event_msg(p_manager, EVT_ERROR, "Zppm %u already read\n", l_Z_ppm);
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3968|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3969|      0|    }
 3970|       |
 3971|      2|    l_cp->ppm_markers[l_Z_ppm].m_data = (OPJ_BYTE *) opj_malloc(p_header_size);
 3972|      2|    if (l_cp->ppm_markers[l_Z_ppm].m_data == NULL) {
  ------------------
  |  Branch (3972:9): [True: 0, False: 2]
  ------------------
 3973|       |        /* clean up to be done on l_cp destruction */
 3974|      0|        opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPM marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 3975|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 3976|      0|    }
 3977|      2|    l_cp->ppm_markers[l_Z_ppm].m_data_size = p_header_size;
 3978|      2|    memcpy(l_cp->ppm_markers[l_Z_ppm].m_data, p_header_data, p_header_size);
 3979|       |
 3980|      2|    return OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
 3981|      2|}
j2k.c:opj_j2k_read_ppt:
 4137|      2|{
 4138|      2|    opj_cp_t *l_cp = 00;
 4139|      2|    opj_tcp_t *l_tcp = 00;
 4140|      2|    OPJ_UINT32 l_Z_ppt;
 4141|       |
 4142|       |    /* preconditions */
 4143|      2|    assert(p_header_data != 00);
 4144|      2|    assert(p_j2k != 00);
 4145|      2|    assert(p_manager != 00);
 4146|       |
 4147|       |    /* We need to have the Z_ppt element + 1 byte of Ippt at minimum */
 4148|      2|    if (p_header_size < 2) {
  ------------------
  |  Branch (4148:9): [True: 0, False: 2]
  ------------------
 4149|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading PPT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4150|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4151|      0|    }
 4152|       |
 4153|      2|    l_cp = &(p_j2k->m_cp);
 4154|      2|    if (l_cp->ppm) {
  ------------------
  |  Branch (4154:9): [True: 0, False: 2]
  ------------------
 4155|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4156|      0|                      "Error reading PPT marker: packet header have been previously found in the main header (PPM marker).\n");
 4157|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4158|      0|    }
 4159|       |
 4160|      2|    l_tcp = &(l_cp->tcps[p_j2k->m_current_tile_number]);
 4161|      2|    l_tcp->ppt = 1;
 4162|       |
 4163|      2|    opj_read_bytes(p_header_data, &l_Z_ppt, 1);             /* Z_ppt */
  ------------------
  |  |   65|      2|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 4164|      2|    ++p_header_data;
 4165|      2|    --p_header_size;
 4166|       |
 4167|       |    /* check allocation needed */
 4168|      2|    if (l_tcp->ppt_markers == NULL) { /* first PPT marker */
  ------------------
  |  Branch (4168:9): [True: 1, False: 1]
  ------------------
 4169|      1|        OPJ_UINT32 l_newCount = l_Z_ppt + 1U; /* can't overflow, l_Z_ppt is UINT8 */
 4170|      1|        assert(l_tcp->ppt_markers_count == 0U);
 4171|       |
 4172|      1|        l_tcp->ppt_markers = (opj_ppx *) opj_calloc(l_newCount, sizeof(opj_ppx));
 4173|      1|        if (l_tcp->ppt_markers == NULL) {
  ------------------
  |  Branch (4173:13): [True: 0, False: 1]
  ------------------
 4174|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4175|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4176|      0|        }
 4177|      1|        l_tcp->ppt_markers_count = l_newCount;
 4178|      1|    } else if (l_tcp->ppt_markers_count <= l_Z_ppt) {
  ------------------
  |  Branch (4178:16): [True: 0, False: 1]
  ------------------
 4179|      0|        OPJ_UINT32 l_newCount = l_Z_ppt + 1U; /* can't overflow, l_Z_ppt is UINT8 */
 4180|      0|        opj_ppx *new_ppt_markers;
 4181|      0|        new_ppt_markers = (opj_ppx *) opj_realloc(l_tcp->ppt_markers,
 4182|      0|                          l_newCount * sizeof(opj_ppx));
 4183|      0|        if (new_ppt_markers == NULL) {
  ------------------
  |  Branch (4183:13): [True: 0, False: 0]
  ------------------
 4184|       |            /* clean up to be done on l_tcp destruction */
 4185|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4186|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4187|      0|        }
 4188|      0|        l_tcp->ppt_markers = new_ppt_markers;
 4189|      0|        memset(l_tcp->ppt_markers + l_tcp->ppt_markers_count, 0,
 4190|      0|               (l_newCount - l_tcp->ppt_markers_count) * sizeof(opj_ppx));
 4191|      0|        l_tcp->ppt_markers_count = l_newCount;
 4192|      0|    }
 4193|       |
 4194|      2|    if (l_tcp->ppt_markers[l_Z_ppt].m_data != NULL) {
  ------------------
  |  Branch (4194:9): [True: 0, False: 2]
  ------------------
 4195|       |        /* clean up to be done on l_tcp destruction */
 4196|      0|        opj_event_msg(p_manager, EVT_ERROR, "Zppt %u already read\n", l_Z_ppt);
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4197|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4198|      0|    }
 4199|       |
 4200|      2|    l_tcp->ppt_markers[l_Z_ppt].m_data = (OPJ_BYTE *) opj_malloc(p_header_size);
 4201|      2|    if (l_tcp->ppt_markers[l_Z_ppt].m_data == NULL) {
  ------------------
  |  Branch (4201:9): [True: 0, False: 2]
  ------------------
 4202|       |        /* clean up to be done on l_tcp destruction */
 4203|      0|        opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4204|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4205|      0|    }
 4206|      2|    l_tcp->ppt_markers[l_Z_ppt].m_data_size = p_header_size;
 4207|      2|    memcpy(l_tcp->ppt_markers[l_Z_ppt].m_data, p_header_data, p_header_size);
 4208|      2|    return OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
 4209|      2|}
j2k.c:opj_j2k_read_com:
 2568|  5.63k|{
 2569|       |    /* preconditions */
 2570|  5.63k|    assert(p_j2k != 00);
 2571|  5.63k|    assert(p_manager != 00);
 2572|  5.63k|    assert(p_header_data != 00);
 2573|       |
 2574|  5.63k|    OPJ_UNUSED(p_j2k);
  ------------------
  |  |  221|  5.63k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2575|  5.63k|    OPJ_UNUSED(p_header_data);
  ------------------
  |  |  221|  5.63k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2576|  5.63k|    OPJ_UNUSED(p_header_size);
  ------------------
  |  |  221|  5.63k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2577|  5.63k|    OPJ_UNUSED(p_manager);
  ------------------
  |  |  221|  5.63k|#define OPJ_UNUSED(x) (void)x
  ------------------
 2578|       |
 2579|  5.63k|    return OPJ_TRUE;
  ------------------
  |  |  117|  5.63k|#define OPJ_TRUE 1
  ------------------
 2580|  5.63k|}
j2k.c:opj_j2k_read_mct:
 5869|  8.73k|{
 5870|  8.73k|    OPJ_UINT32 i;
 5871|  8.73k|    opj_tcp_t *l_tcp = 00;
 5872|  8.73k|    OPJ_UINT32 l_tmp;
 5873|  8.73k|    OPJ_UINT32 l_indix;
 5874|  8.73k|    opj_mct_data_t * l_mct_data;
 5875|       |
 5876|       |    /* preconditions */
 5877|  8.73k|    assert(p_header_data != 00);
 5878|  8.73k|    assert(p_j2k != 00);
 5879|       |
 5880|  8.73k|    l_tcp = p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH ?
  ------------------
  |  Branch (5880:13): [True: 0, False: 8.73k]
  ------------------
 5881|      0|            &p_j2k->m_cp.tcps[p_j2k->m_current_tile_number] :
 5882|  8.73k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 5883|       |
 5884|  8.73k|    if (p_header_size < 2) {
  ------------------
  |  Branch (5884:9): [True: 0, False: 8.73k]
  ------------------
 5885|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5886|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5887|      0|    }
 5888|       |
 5889|       |    /* first marker */
 5890|  8.73k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Zmct */
  ------------------
  |  |   65|  8.73k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5891|  8.73k|    p_header_data += 2;
 5892|  8.73k|    if (l_tmp != 0) {
  ------------------
  |  Branch (5892:9): [True: 6.47k, False: 2.25k]
  ------------------
 5893|  6.47k|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  6.47k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 5894|  6.47k|                      "Cannot take in charge mct data within multiple MCT records\n");
 5895|  6.47k|        return OPJ_TRUE;
  ------------------
  |  |  117|  6.47k|#define OPJ_TRUE 1
  ------------------
 5896|  6.47k|    }
 5897|       |
 5898|  2.25k|    if (p_header_size <= 6) {
  ------------------
  |  Branch (5898:9): [True: 0, False: 2.25k]
  ------------------
 5899|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5900|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5901|      0|    }
 5902|       |
 5903|       |    /* Imct -> no need for other values, take the first, type is double with decorrelation x0000 1101 0000 0000*/
 5904|  2.25k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Imct */
  ------------------
  |  |   65|  2.25k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5905|  2.25k|    p_header_data += 2;
 5906|       |
 5907|  2.25k|    l_indix = l_tmp & 0xff;
 5908|  2.25k|    l_mct_data = l_tcp->m_mct_records;
 5909|       |
 5910|  3.98k|    for (i = 0; i < l_tcp->m_nb_mct_records; ++i) {
  ------------------
  |  Branch (5910:17): [True: 3.96k, False: 12]
  ------------------
 5911|  3.96k|        if (l_mct_data->m_index == l_indix) {
  ------------------
  |  Branch (5911:13): [True: 2.24k, False: 1.72k]
  ------------------
 5912|  2.24k|            break;
 5913|  2.24k|        }
 5914|  1.72k|        ++l_mct_data;
 5915|  1.72k|    }
 5916|       |
 5917|       |    /* NOT FOUND */
 5918|  2.25k|    if (i == l_tcp->m_nb_mct_records) {
  ------------------
  |  Branch (5918:9): [True: 12, False: 2.24k]
  ------------------
 5919|     12|        if (l_tcp->m_nb_mct_records == l_tcp->m_nb_max_mct_records) {
  ------------------
  |  Branch (5919:13): [True: 0, False: 12]
  ------------------
 5920|      0|            opj_mct_data_t *new_mct_records;
 5921|      0|            l_tcp->m_nb_max_mct_records += OPJ_J2K_MCT_DEFAULT_NB_RECORDS;
  ------------------
  |  |  161|      0|#define OPJ_J2K_MCT_DEFAULT_NB_RECORDS      10
  ------------------
 5922|       |
 5923|      0|            new_mct_records = (opj_mct_data_t *) opj_realloc(l_tcp->m_mct_records,
 5924|      0|                              l_tcp->m_nb_max_mct_records * sizeof(opj_mct_data_t));
 5925|      0|            if (! new_mct_records) {
  ------------------
  |  Branch (5925:17): [True: 0, False: 0]
  ------------------
 5926|      0|                opj_free(l_tcp->m_mct_records);
 5927|      0|                l_tcp->m_mct_records = NULL;
 5928|      0|                l_tcp->m_nb_max_mct_records = 0;
 5929|      0|                l_tcp->m_nb_mct_records = 0;
 5930|      0|                opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read MCT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5931|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5932|      0|            }
 5933|       |
 5934|       |            /* Update m_mcc_records[].m_offset_array and m_decorrelation_array
 5935|       |             * to point to the new addresses */
 5936|      0|            if (new_mct_records != l_tcp->m_mct_records) {
  ------------------
  |  Branch (5936:17): [True: 0, False: 0]
  ------------------
 5937|      0|                for (i = 0; i < l_tcp->m_nb_mcc_records; ++i) {
  ------------------
  |  Branch (5937:29): [True: 0, False: 0]
  ------------------
 5938|      0|                    opj_simple_mcc_decorrelation_data_t* l_mcc_record =
 5939|      0|                        &(l_tcp->m_mcc_records[i]);
 5940|      0|                    if (l_mcc_record->m_decorrelation_array) {
  ------------------
  |  Branch (5940:25): [True: 0, False: 0]
  ------------------
 5941|      0|                        l_mcc_record->m_decorrelation_array =
 5942|      0|                            new_mct_records +
 5943|      0|                            (l_mcc_record->m_decorrelation_array -
 5944|      0|                             l_tcp->m_mct_records);
 5945|      0|                    }
 5946|      0|                    if (l_mcc_record->m_offset_array) {
  ------------------
  |  Branch (5946:25): [True: 0, False: 0]
  ------------------
 5947|      0|                        l_mcc_record->m_offset_array =
 5948|      0|                            new_mct_records +
 5949|      0|                            (l_mcc_record->m_offset_array -
 5950|      0|                             l_tcp->m_mct_records);
 5951|      0|                    }
 5952|      0|                }
 5953|      0|            }
 5954|       |
 5955|      0|            l_tcp->m_mct_records = new_mct_records;
 5956|      0|            l_mct_data = l_tcp->m_mct_records + l_tcp->m_nb_mct_records;
 5957|      0|            memset(l_mct_data, 0, (l_tcp->m_nb_max_mct_records - l_tcp->m_nb_mct_records) *
 5958|      0|                   sizeof(opj_mct_data_t));
 5959|      0|        }
 5960|       |
 5961|     12|        l_mct_data = l_tcp->m_mct_records + l_tcp->m_nb_mct_records;
 5962|     12|        ++l_tcp->m_nb_mct_records;
 5963|     12|    }
 5964|       |
 5965|  2.25k|    if (l_mct_data->m_data) {
  ------------------
  |  Branch (5965:9): [True: 1.90k, False: 353]
  ------------------
 5966|  1.90k|        opj_free(l_mct_data->m_data);
 5967|  1.90k|        l_mct_data->m_data = 00;
 5968|  1.90k|        l_mct_data->m_data_size = 0;
 5969|  1.90k|    }
 5970|       |
 5971|  2.25k|    l_mct_data->m_index = l_indix;
 5972|  2.25k|    l_mct_data->m_array_type = (J2K_MCT_ARRAY_TYPE)((l_tmp  >> 8) & 3);
 5973|  2.25k|    l_mct_data->m_element_type = (J2K_MCT_ELEMENT_TYPE)((l_tmp  >> 10) & 3);
 5974|       |
 5975|  2.25k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Ymct */
  ------------------
  |  |   65|  2.25k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 5976|  2.25k|    p_header_data += 2;
 5977|  2.25k|    if (l_tmp != 0) {
  ------------------
  |  Branch (5977:9): [True: 344, False: 1.91k]
  ------------------
 5978|    344|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    344|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 5979|    344|                      "Cannot take in charge multiple MCT markers\n");
 5980|    344|        return OPJ_TRUE;
  ------------------
  |  |  117|    344|#define OPJ_TRUE 1
  ------------------
 5981|    344|    }
 5982|       |
 5983|  1.91k|    p_header_size -= 6;
 5984|       |
 5985|  1.91k|    l_mct_data->m_data = (OPJ_BYTE*)opj_malloc(p_header_size);
 5986|  1.91k|    if (! l_mct_data->m_data) {
  ------------------
  |  Branch (5986:9): [True: 0, False: 1.91k]
  ------------------
 5987|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5988|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5989|      0|    }
 5990|  1.91k|    memcpy(l_mct_data->m_data, p_header_data, p_header_size);
 5991|       |
 5992|  1.91k|    l_mct_data->m_data_size = p_header_size;
 5993|       |
 5994|  1.91k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.91k|#define OPJ_TRUE 1
  ------------------
 5995|  1.91k|}
j2k.c:opj_j2k_read_cap:
 6704|     65|{
 6705|       |    /* preconditions */
 6706|     65|    assert(p_header_data != 00);
 6707|     65|    assert(p_j2k != 00);
 6708|     65|    assert(p_manager != 00);
 6709|       |
 6710|     65|    (void)p_j2k;
 6711|     65|    (void)p_header_data;
 6712|     65|    (void)p_header_size;
 6713|     65|    (void)p_manager;
 6714|       |
 6715|     65|    return OPJ_TRUE;
  ------------------
  |  |  117|     65|#define OPJ_TRUE 1
  ------------------
 6716|     65|}
j2k.c:opj_j2k_read_mcc:
 6116|  20.7k|{
 6117|  20.7k|    OPJ_UINT32 i, j;
 6118|  20.7k|    OPJ_UINT32 l_tmp;
 6119|  20.7k|    OPJ_UINT32 l_indix;
 6120|  20.7k|    opj_tcp_t * l_tcp;
 6121|  20.7k|    opj_simple_mcc_decorrelation_data_t * l_mcc_record;
 6122|  20.7k|    opj_mct_data_t * l_mct_data;
 6123|  20.7k|    OPJ_UINT32 l_nb_collections;
 6124|  20.7k|    OPJ_UINT32 l_nb_comps;
 6125|  20.7k|    OPJ_UINT32 l_nb_bytes_by_comp;
 6126|  20.7k|    OPJ_BOOL l_new_mcc = OPJ_FALSE;
  ------------------
  |  |  118|  20.7k|#define OPJ_FALSE 0
  ------------------
 6127|       |
 6128|       |    /* preconditions */
 6129|  20.7k|    assert(p_header_data != 00);
 6130|  20.7k|    assert(p_j2k != 00);
 6131|  20.7k|    assert(p_manager != 00);
 6132|       |
 6133|  20.7k|    l_tcp = p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH ?
  ------------------
  |  Branch (6133:13): [True: 0, False: 20.7k]
  ------------------
 6134|      0|            &p_j2k->m_cp.tcps[p_j2k->m_current_tile_number] :
 6135|  20.7k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 6136|       |
 6137|  20.7k|    if (p_header_size < 2) {
  ------------------
  |  Branch (6137:9): [True: 0, False: 20.7k]
  ------------------
 6138|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6139|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6140|      0|    }
 6141|       |
 6142|       |    /* first marker */
 6143|  20.7k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Zmcc */
  ------------------
  |  |   65|  20.7k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6144|  20.7k|    p_header_data += 2;
 6145|  20.7k|    if (l_tmp != 0) {
  ------------------
  |  Branch (6145:9): [True: 735, False: 19.9k]
  ------------------
 6146|    735|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    735|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6147|    735|                      "Cannot take in charge multiple data spanning\n");
 6148|    735|        return OPJ_TRUE;
  ------------------
  |  |  117|    735|#define OPJ_TRUE 1
  ------------------
 6149|    735|    }
 6150|       |
 6151|  19.9k|    if (p_header_size < 7) {
  ------------------
  |  Branch (6151:9): [True: 0, False: 19.9k]
  ------------------
 6152|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6153|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6154|      0|    }
 6155|       |
 6156|  19.9k|    opj_read_bytes(p_header_data, &l_indix,
  ------------------
  |  |   65|  19.9k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6157|  19.9k|                   1); /* Imcc -> no need for other values, take the first */
 6158|  19.9k|    ++p_header_data;
 6159|       |
 6160|  19.9k|    l_mcc_record = l_tcp->m_mcc_records;
 6161|       |
 6162|  26.9k|    for (i = 0; i < l_tcp->m_nb_mcc_records; ++i) {
  ------------------
  |  Branch (6162:17): [True: 19.9k, False: 6.95k]
  ------------------
 6163|  19.9k|        if (l_mcc_record->m_index == l_indix) {
  ------------------
  |  Branch (6163:13): [True: 13.0k, False: 6.93k]
  ------------------
 6164|  13.0k|            break;
 6165|  13.0k|        }
 6166|  6.93k|        ++l_mcc_record;
 6167|  6.93k|    }
 6168|       |
 6169|       |    /** NOT FOUND */
 6170|  19.9k|    if (i == l_tcp->m_nb_mcc_records) {
  ------------------
  |  Branch (6170:9): [True: 6.95k, False: 13.0k]
  ------------------
 6171|  6.95k|        if (l_tcp->m_nb_mcc_records == l_tcp->m_nb_max_mcc_records) {
  ------------------
  |  Branch (6171:13): [True: 0, False: 6.95k]
  ------------------
 6172|      0|            opj_simple_mcc_decorrelation_data_t *new_mcc_records;
 6173|      0|            l_tcp->m_nb_max_mcc_records += OPJ_J2K_MCC_DEFAULT_NB_RECORDS;
  ------------------
  |  |  160|      0|#define OPJ_J2K_MCC_DEFAULT_NB_RECORDS      10
  ------------------
 6174|       |
 6175|      0|            new_mcc_records = (opj_simple_mcc_decorrelation_data_t *) opj_realloc(
 6176|      0|                                  l_tcp->m_mcc_records, l_tcp->m_nb_max_mcc_records * sizeof(
 6177|      0|                                      opj_simple_mcc_decorrelation_data_t));
 6178|      0|            if (! new_mcc_records) {
  ------------------
  |  Branch (6178:17): [True: 0, False: 0]
  ------------------
 6179|      0|                opj_free(l_tcp->m_mcc_records);
 6180|      0|                l_tcp->m_mcc_records = NULL;
 6181|      0|                l_tcp->m_nb_max_mcc_records = 0;
 6182|      0|                l_tcp->m_nb_mcc_records = 0;
 6183|      0|                opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read MCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6184|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6185|      0|            }
 6186|      0|            l_tcp->m_mcc_records = new_mcc_records;
 6187|      0|            l_mcc_record = l_tcp->m_mcc_records + l_tcp->m_nb_mcc_records;
 6188|      0|            memset(l_mcc_record, 0, (l_tcp->m_nb_max_mcc_records - l_tcp->m_nb_mcc_records)
 6189|      0|                   * sizeof(opj_simple_mcc_decorrelation_data_t));
 6190|      0|        }
 6191|  6.95k|        l_mcc_record = l_tcp->m_mcc_records + l_tcp->m_nb_mcc_records;
 6192|  6.95k|        l_new_mcc = OPJ_TRUE;
  ------------------
  |  |  117|  6.95k|#define OPJ_TRUE 1
  ------------------
 6193|  6.95k|    }
 6194|  19.9k|    l_mcc_record->m_index = l_indix;
 6195|       |
 6196|       |    /* only one marker atm */
 6197|  19.9k|    opj_read_bytes(p_header_data, &l_tmp, 2);                       /* Ymcc */
  ------------------
  |  |   65|  19.9k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6198|  19.9k|    p_header_data += 2;
 6199|  19.9k|    if (l_tmp != 0) {
  ------------------
  |  Branch (6199:9): [True: 7.02k, False: 12.9k]
  ------------------
 6200|  7.02k|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  7.02k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6201|  7.02k|                      "Cannot take in charge multiple data spanning\n");
 6202|  7.02k|        return OPJ_TRUE;
  ------------------
  |  |  117|  7.02k|#define OPJ_TRUE 1
  ------------------
 6203|  7.02k|    }
 6204|       |
 6205|  12.9k|    opj_read_bytes(p_header_data, &l_nb_collections,
  ------------------
  |  |   65|  12.9k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6206|  12.9k|                   2);                              /* Qmcc -> number of collections -> 1 */
 6207|  12.9k|    p_header_data += 2;
 6208|       |
 6209|  12.9k|    if (l_nb_collections > 1) {
  ------------------
  |  Branch (6209:9): [True: 416, False: 12.5k]
  ------------------
 6210|    416|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    416|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6211|    416|                      "Cannot take in charge multiple collections\n");
 6212|    416|        return OPJ_TRUE;
  ------------------
  |  |  117|    416|#define OPJ_TRUE 1
  ------------------
 6213|    416|    }
 6214|       |
 6215|  12.5k|    p_header_size -= 7;
 6216|       |
 6217|  16.4k|    for (i = 0; i < l_nb_collections; ++i) {
  ------------------
  |  Branch (6217:17): [True: 12.5k, False: 3.88k]
  ------------------
 6218|  12.5k|        if (p_header_size < 3) {
  ------------------
  |  Branch (6218:13): [True: 0, False: 12.5k]
  ------------------
 6219|      0|            opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6220|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6221|      0|        }
 6222|       |
 6223|  12.5k|        opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|  12.5k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6224|  12.5k|                       1); /* Xmcci type of component transformation -> array based decorrelation */
 6225|  12.5k|        ++p_header_data;
 6226|       |
 6227|  12.5k|        if (l_tmp != 1) {
  ------------------
  |  Branch (6227:13): [True: 1, False: 12.5k]
  ------------------
 6228|      1|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      1|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6229|      1|                          "Cannot take in charge collections other than array decorrelation\n");
 6230|      1|            return OPJ_TRUE;
  ------------------
  |  |  117|      1|#define OPJ_TRUE 1
  ------------------
 6231|      1|        }
 6232|       |
 6233|  12.5k|        opj_read_bytes(p_header_data, &l_nb_comps, 2);
  ------------------
  |  |   65|  12.5k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6234|       |
 6235|  12.5k|        p_header_data += 2;
 6236|  12.5k|        p_header_size -= 3;
 6237|       |
 6238|  12.5k|        l_nb_bytes_by_comp = 1 + (l_nb_comps >> 15);
 6239|  12.5k|        l_mcc_record->m_nb_comps = l_nb_comps & 0x7fff;
 6240|       |
 6241|  12.5k|        if (p_header_size < (l_nb_bytes_by_comp * l_mcc_record->m_nb_comps + 2)) {
  ------------------
  |  Branch (6241:13): [True: 0, False: 12.5k]
  ------------------
 6242|      0|            opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6243|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6244|      0|        }
 6245|       |
 6246|  12.5k|        p_header_size -= (l_nb_bytes_by_comp * l_mcc_record->m_nb_comps + 2);
 6247|       |
 6248|  23.5k|        for (j = 0; j < l_mcc_record->m_nb_comps; ++j) {
  ------------------
  |  Branch (6248:21): [True: 11.8k, False: 11.7k]
  ------------------
 6249|  11.8k|            opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|  11.8k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6250|  11.8k|                           l_nb_bytes_by_comp);      /* Cmccij Component offset*/
 6251|  11.8k|            p_header_data += l_nb_bytes_by_comp;
 6252|       |
 6253|  11.8k|            if (l_tmp != j) {
  ------------------
  |  Branch (6253:17): [True: 813, False: 11.0k]
  ------------------
 6254|    813|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|    813|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6255|    813|                              "Cannot take in charge collections with indix shuffle\n");
 6256|    813|                return OPJ_TRUE;
  ------------------
  |  |  117|    813|#define OPJ_TRUE 1
  ------------------
 6257|    813|            }
 6258|  11.8k|        }
 6259|       |
 6260|  11.7k|        opj_read_bytes(p_header_data, &l_nb_comps, 2);
  ------------------
  |  |   65|  11.7k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6261|  11.7k|        p_header_data += 2;
 6262|       |
 6263|  11.7k|        l_nb_bytes_by_comp = 1 + (l_nb_comps >> 15);
 6264|  11.7k|        l_nb_comps &= 0x7fff;
 6265|       |
 6266|  11.7k|        if (l_nb_comps != l_mcc_record->m_nb_comps) {
  ------------------
  |  Branch (6266:13): [True: 4.73k, False: 6.99k]
  ------------------
 6267|  4.73k|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  4.73k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6268|  4.73k|                          "Cannot take in charge collections without same number of indixes\n");
 6269|  4.73k|            return OPJ_TRUE;
  ------------------
  |  |  117|  4.73k|#define OPJ_TRUE 1
  ------------------
 6270|  4.73k|        }
 6271|       |
 6272|  6.99k|        if (p_header_size < (l_nb_bytes_by_comp * l_mcc_record->m_nb_comps + 3)) {
  ------------------
  |  Branch (6272:13): [True: 0, False: 6.99k]
  ------------------
 6273|      0|            opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6274|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6275|      0|        }
 6276|       |
 6277|  6.99k|        p_header_size -= (l_nb_bytes_by_comp * l_mcc_record->m_nb_comps + 3);
 6278|       |
 6279|  10.8k|        for (j = 0; j < l_mcc_record->m_nb_comps; ++j) {
  ------------------
  |  Branch (6279:21): [True: 6.99k, False: 3.88k]
  ------------------
 6280|  6.99k|            opj_read_bytes(p_header_data, &l_tmp,
  ------------------
  |  |   65|  6.99k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6281|  6.99k|                           l_nb_bytes_by_comp);      /* Wmccij Component offset*/
 6282|  6.99k|            p_header_data += l_nb_bytes_by_comp;
 6283|       |
 6284|  6.99k|            if (l_tmp != j) {
  ------------------
  |  Branch (6284:17): [True: 3.10k, False: 3.88k]
  ------------------
 6285|  3.10k|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  3.10k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6286|  3.10k|                              "Cannot take in charge collections with indix shuffle\n");
 6287|  3.10k|                return OPJ_TRUE;
  ------------------
  |  |  117|  3.10k|#define OPJ_TRUE 1
  ------------------
 6288|  3.10k|            }
 6289|  6.99k|        }
 6290|       |
 6291|  3.88k|        opj_read_bytes(p_header_data, &l_tmp, 3); /* Wmccij Component offset*/
  ------------------
  |  |   65|  3.88k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6292|  3.88k|        p_header_data += 3;
 6293|       |
 6294|  3.88k|        l_mcc_record->m_is_irreversible = !((l_tmp >> 16) & 1);
 6295|  3.88k|        l_mcc_record->m_decorrelation_array = 00;
 6296|  3.88k|        l_mcc_record->m_offset_array = 00;
 6297|       |
 6298|  3.88k|        l_indix = l_tmp & 0xff;
 6299|  3.88k|        if (l_indix != 0) {
  ------------------
  |  Branch (6299:13): [True: 0, False: 3.88k]
  ------------------
 6300|      0|            l_mct_data = l_tcp->m_mct_records;
 6301|      0|            for (j = 0; j < l_tcp->m_nb_mct_records; ++j) {
  ------------------
  |  Branch (6301:25): [True: 0, False: 0]
  ------------------
 6302|      0|                if (l_mct_data->m_index == l_indix) {
  ------------------
  |  Branch (6302:21): [True: 0, False: 0]
  ------------------
 6303|      0|                    l_mcc_record->m_decorrelation_array = l_mct_data;
 6304|      0|                    break;
 6305|      0|                }
 6306|      0|                ++l_mct_data;
 6307|      0|            }
 6308|       |
 6309|      0|            if (l_mcc_record->m_decorrelation_array == 00) {
  ------------------
  |  Branch (6309:17): [True: 0, False: 0]
  ------------------
 6310|      0|                opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6311|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6312|      0|            }
 6313|      0|        }
 6314|       |
 6315|  3.88k|        l_indix = (l_tmp >> 8) & 0xff;
 6316|  3.88k|        if (l_indix != 0) {
  ------------------
  |  Branch (6316:13): [True: 1, False: 3.88k]
  ------------------
 6317|      1|            l_mct_data = l_tcp->m_mct_records;
 6318|      2|            for (j = 0; j < l_tcp->m_nb_mct_records; ++j) {
  ------------------
  |  Branch (6318:25): [True: 1, False: 1]
  ------------------
 6319|      1|                if (l_mct_data->m_index == l_indix) {
  ------------------
  |  Branch (6319:21): [True: 0, False: 1]
  ------------------
 6320|      0|                    l_mcc_record->m_offset_array = l_mct_data;
 6321|      0|                    break;
 6322|      0|                }
 6323|      1|                ++l_mct_data;
 6324|      1|            }
 6325|       |
 6326|      1|            if (l_mcc_record->m_offset_array == 00) {
  ------------------
  |  Branch (6326:17): [True: 1, False: 0]
  ------------------
 6327|      1|                opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      1|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6328|      1|                return OPJ_FALSE;
  ------------------
  |  |  118|      1|#define OPJ_FALSE 0
  ------------------
 6329|      1|            }
 6330|      1|        }
 6331|  3.88k|    }
 6332|       |
 6333|  3.88k|    if (p_header_size != 0) {
  ------------------
  |  Branch (6333:9): [True: 0, False: 3.88k]
  ------------------
 6334|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCC marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6335|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6336|      0|    }
 6337|       |
 6338|  3.88k|    if (l_new_mcc) {
  ------------------
  |  Branch (6338:9): [True: 10, False: 3.87k]
  ------------------
 6339|     10|        ++l_tcp->m_nb_mcc_records;
 6340|     10|    }
 6341|       |
 6342|  3.88k|    return OPJ_TRUE;
  ------------------
  |  |  117|  3.88k|#define OPJ_TRUE 1
  ------------------
 6343|  3.88k|}
j2k.c:opj_j2k_read_mco:
 6421|  10.4k|{
 6422|  10.4k|    OPJ_UINT32 l_tmp, i;
 6423|  10.4k|    OPJ_UINT32 l_nb_stages;
 6424|  10.4k|    opj_tcp_t * l_tcp;
 6425|  10.4k|    opj_tccp_t * l_tccp;
 6426|  10.4k|    opj_image_t * l_image;
 6427|       |
 6428|       |    /* preconditions */
 6429|  10.4k|    assert(p_header_data != 00);
 6430|  10.4k|    assert(p_j2k != 00);
 6431|  10.4k|    assert(p_manager != 00);
 6432|       |
 6433|  10.4k|    l_image = p_j2k->m_private_image;
 6434|  10.4k|    l_tcp = p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH ?
  ------------------
  |  Branch (6434:13): [True: 0, False: 10.4k]
  ------------------
 6435|      0|            &p_j2k->m_cp.tcps[p_j2k->m_current_tile_number] :
 6436|  10.4k|            p_j2k->m_specific_param.m_decoder.m_default_tcp;
 6437|       |
 6438|  10.4k|    if (p_header_size < 1) {
  ------------------
  |  Branch (6438:9): [True: 0, False: 10.4k]
  ------------------
 6439|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error reading MCO marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 6440|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6441|      0|    }
 6442|       |
 6443|  10.4k|    opj_read_bytes(p_header_data, &l_nb_stages,
  ------------------
  |  |   65|  10.4k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6444|  10.4k|                   1);                         /* Nmco : only one transform stage*/
 6445|  10.4k|    ++p_header_data;
 6446|       |
 6447|  10.4k|    if (l_nb_stages > 1) {
  ------------------
  |  Branch (6447:9): [True: 1.52k, False: 8.88k]
  ------------------
 6448|  1.52k|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|  1.52k|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6449|  1.52k|                      "Cannot take in charge multiple transformation stages.\n");
 6450|  1.52k|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.52k|#define OPJ_TRUE 1
  ------------------
 6451|  1.52k|    }
 6452|       |
 6453|  8.88k|    if (p_header_size != l_nb_stages + 1) {
  ------------------
  |  Branch (6453:9): [True: 0, False: 8.88k]
  ------------------
 6454|      0|        opj_event_msg(p_manager, EVT_WARNING, "Error reading MCO marker\n");
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 6455|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6456|      0|    }
 6457|       |
 6458|  8.88k|    l_tccp = l_tcp->tccps;
 6459|       |
 6460|  25.1k|    for (i = 0; i < l_image->numcomps; ++i) {
  ------------------
  |  Branch (6460:17): [True: 16.2k, False: 8.88k]
  ------------------
 6461|  16.2k|        l_tccp->m_dc_level_shift = 0;
 6462|  16.2k|        ++l_tccp;
 6463|  16.2k|    }
 6464|       |
 6465|  8.88k|    if (l_tcp->m_mct_decoding_matrix) {
  ------------------
  |  Branch (6465:9): [True: 0, False: 8.88k]
  ------------------
 6466|      0|        opj_free(l_tcp->m_mct_decoding_matrix);
 6467|      0|        l_tcp->m_mct_decoding_matrix = 00;
 6468|      0|    }
 6469|       |
 6470|  17.7k|    for (i = 0; i < l_nb_stages; ++i) {
  ------------------
  |  Branch (6470:17): [True: 8.88k, False: 8.88k]
  ------------------
 6471|  8.88k|        opj_read_bytes(p_header_data, &l_tmp, 1);
  ------------------
  |  |   65|  8.88k|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 6472|  8.88k|        ++p_header_data;
 6473|       |
 6474|  8.88k|        if (! opj_j2k_add_mct(l_tcp, p_j2k->m_private_image, l_tmp)) {
  ------------------
  |  Branch (6474:13): [True: 0, False: 8.88k]
  ------------------
 6475|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6476|      0|        }
 6477|  8.88k|    }
 6478|       |
 6479|  8.88k|    return OPJ_TRUE;
  ------------------
  |  |  117|  8.88k|#define OPJ_TRUE 1
  ------------------
 6480|  8.88k|}
j2k.c:opj_j2k_add_mct:
 6484|  8.88k|{
 6485|  8.88k|    OPJ_UINT32 i;
 6486|  8.88k|    opj_simple_mcc_decorrelation_data_t * l_mcc_record;
 6487|  8.88k|    opj_mct_data_t * l_deco_array, * l_offset_array;
 6488|  8.88k|    OPJ_UINT32 l_data_size, l_mct_size, l_offset_size;
 6489|  8.88k|    OPJ_UINT32 l_nb_elem;
 6490|  8.88k|    OPJ_UINT32 * l_offset_data, * l_current_offset_data;
 6491|  8.88k|    opj_tccp_t * l_tccp;
 6492|       |
 6493|       |    /* preconditions */
 6494|  8.88k|    assert(p_tcp != 00);
 6495|       |
 6496|  8.88k|    l_mcc_record = p_tcp->m_mcc_records;
 6497|       |
 6498|  8.90k|    for (i = 0; i < p_tcp->m_nb_mcc_records; ++i) {
  ------------------
  |  Branch (6498:17): [True: 8.87k, False: 32]
  ------------------
 6499|  8.87k|        if (l_mcc_record->m_index == p_index) {
  ------------------
  |  Branch (6499:13): [True: 8.85k, False: 19]
  ------------------
 6500|  8.85k|            break;
 6501|  8.85k|        }
 6502|  8.87k|    }
 6503|       |
 6504|  8.88k|    if (i == p_tcp->m_nb_mcc_records) {
  ------------------
  |  Branch (6504:9): [True: 32, False: 8.85k]
  ------------------
 6505|       |        /** element discarded **/
 6506|     32|        return OPJ_TRUE;
  ------------------
  |  |  117|     32|#define OPJ_TRUE 1
  ------------------
 6507|     32|    }
 6508|       |
 6509|  8.85k|    if (l_mcc_record->m_nb_comps != p_image->numcomps) {
  ------------------
  |  Branch (6509:9): [True: 3.71k, False: 5.13k]
  ------------------
 6510|       |        /** do not support number of comps != image */
 6511|  3.71k|        return OPJ_TRUE;
  ------------------
  |  |  117|  3.71k|#define OPJ_TRUE 1
  ------------------
 6512|  3.71k|    }
 6513|       |
 6514|  5.13k|    l_deco_array = l_mcc_record->m_decorrelation_array;
 6515|       |
 6516|  5.13k|    if (l_deco_array) {
  ------------------
  |  Branch (6516:9): [True: 0, False: 5.13k]
  ------------------
 6517|      0|        l_data_size = MCT_ELEMENT_SIZE[l_deco_array->m_element_type] * p_image->numcomps
 6518|      0|                      * p_image->numcomps;
 6519|      0|        if (l_deco_array->m_data_size != l_data_size) {
  ------------------
  |  Branch (6519:13): [True: 0, False: 0]
  ------------------
 6520|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6521|      0|        }
 6522|       |
 6523|      0|        l_nb_elem = p_image->numcomps * p_image->numcomps;
 6524|      0|        l_mct_size = l_nb_elem * (OPJ_UINT32)sizeof(OPJ_FLOAT32);
 6525|      0|        p_tcp->m_mct_decoding_matrix = (OPJ_FLOAT32*)opj_malloc(l_mct_size);
 6526|       |
 6527|      0|        if (! p_tcp->m_mct_decoding_matrix) {
  ------------------
  |  Branch (6527:13): [True: 0, False: 0]
  ------------------
 6528|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6529|      0|        }
 6530|       |
 6531|      0|        j2k_mct_read_functions_to_float[l_deco_array->m_element_type](
 6532|      0|            l_deco_array->m_data, p_tcp->m_mct_decoding_matrix, l_nb_elem);
 6533|      0|    }
 6534|       |
 6535|  5.13k|    l_offset_array = l_mcc_record->m_offset_array;
 6536|       |
 6537|  5.13k|    if (l_offset_array) {
  ------------------
  |  Branch (6537:9): [True: 0, False: 5.13k]
  ------------------
 6538|      0|        l_data_size = MCT_ELEMENT_SIZE[l_offset_array->m_element_type] *
 6539|      0|                      p_image->numcomps;
 6540|      0|        if (l_offset_array->m_data_size != l_data_size) {
  ------------------
  |  Branch (6540:13): [True: 0, False: 0]
  ------------------
 6541|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6542|      0|        }
 6543|       |
 6544|      0|        l_nb_elem = p_image->numcomps;
 6545|      0|        l_offset_size = l_nb_elem * (OPJ_UINT32)sizeof(OPJ_UINT32);
 6546|      0|        l_offset_data = (OPJ_UINT32*)opj_malloc(l_offset_size);
 6547|       |
 6548|      0|        if (! l_offset_data) {
  ------------------
  |  Branch (6548:13): [True: 0, False: 0]
  ------------------
 6549|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 6550|      0|        }
 6551|       |
 6552|      0|        j2k_mct_read_functions_to_int32[l_offset_array->m_element_type](
 6553|      0|            l_offset_array->m_data, l_offset_data, l_nb_elem);
 6554|       |
 6555|      0|        l_tccp = p_tcp->tccps;
 6556|      0|        l_current_offset_data = l_offset_data;
 6557|       |
 6558|      0|        for (i = 0; i < p_image->numcomps; ++i) {
  ------------------
  |  Branch (6558:21): [True: 0, False: 0]
  ------------------
 6559|      0|            l_tccp->m_dc_level_shift = (OPJ_INT32) * (l_current_offset_data++);
 6560|      0|            ++l_tccp;
 6561|      0|        }
 6562|       |
 6563|      0|        opj_free(l_offset_data);
 6564|      0|    }
 6565|       |
 6566|  5.13k|    return OPJ_TRUE;
  ------------------
  |  |  117|  5.13k|#define OPJ_TRUE 1
  ------------------
 6567|  5.13k|}
j2k.c:opj_j2k_add_tlmarker:
 8416|     57|{
 8417|     57|    assert(cstr_index != 00);
 8418|     57|    assert(cstr_index->tile_index != 00);
 8419|       |
 8420|       |    /* expand the list? */
 8421|     57|    if ((cstr_index->tile_index[tileno].marknum + 1) >
  ------------------
  |  Branch (8421:9): [True: 0, False: 57]
  ------------------
 8422|     57|            cstr_index->tile_index[tileno].maxmarknum) {
 8423|      0|        opj_marker_info_t *new_marker;
 8424|      0|        cstr_index->tile_index[tileno].maxmarknum = (OPJ_UINT32)(100 +
 8425|      0|                (OPJ_FLOAT32) cstr_index->tile_index[tileno].maxmarknum);
 8426|      0|        new_marker = (opj_marker_info_t *) opj_realloc(
 8427|      0|                         cstr_index->tile_index[tileno].marker,
 8428|      0|                         cstr_index->tile_index[tileno].maxmarknum * sizeof(opj_marker_info_t));
 8429|      0|        if (! new_marker) {
  ------------------
  |  Branch (8429:13): [True: 0, False: 0]
  ------------------
 8430|      0|            opj_free(cstr_index->tile_index[tileno].marker);
 8431|      0|            cstr_index->tile_index[tileno].marker = NULL;
 8432|      0|            cstr_index->tile_index[tileno].maxmarknum = 0;
 8433|      0|            cstr_index->tile_index[tileno].marknum = 0;
 8434|       |            /* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add tl marker\n"); */
 8435|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 8436|      0|        }
 8437|      0|        cstr_index->tile_index[tileno].marker = new_marker;
 8438|      0|    }
 8439|       |
 8440|       |    /* add the marker */
 8441|     57|    cstr_index->tile_index[tileno].marker[cstr_index->tile_index[tileno].marknum].type
 8442|     57|        = (OPJ_UINT16)type;
 8443|     57|    cstr_index->tile_index[tileno].marker[cstr_index->tile_index[tileno].marknum].pos
 8444|     57|        = (OPJ_INT32)pos;
 8445|     57|    cstr_index->tile_index[tileno].marker[cstr_index->tile_index[tileno].marknum].len
 8446|     57|        = (OPJ_INT32)len;
 8447|     57|    cstr_index->tile_index[tileno].marknum++;
 8448|       |
 8449|     57|    if (type == J2K_MS_SOT) {
  ------------------
  |  |   73|     57|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (8449:9): [True: 28, False: 29]
  ------------------
 8450|     28|        OPJ_UINT32 l_current_tile_part = cstr_index->tile_index[tileno].current_tpsno;
 8451|       |
 8452|     28|        if (cstr_index->tile_index[tileno].tp_index) {
  ------------------
  |  Branch (8452:13): [True: 28, False: 0]
  ------------------
 8453|     28|            cstr_index->tile_index[tileno].tp_index[l_current_tile_part].start_pos = pos;
 8454|     28|        }
 8455|       |
 8456|     28|    }
 8457|     57|    return OPJ_TRUE;
  ------------------
  |  |  117|     57|#define OPJ_TRUE 1
  ------------------
 8458|     57|}
j2k.c:opj_j2k_read_sod:
 4982|     27|{
 4983|     27|    OPJ_SIZE_T l_current_read_size;
 4984|     27|    opj_codestream_index_t * l_cstr_index = 00;
 4985|     27|    OPJ_BYTE ** l_current_data = 00;
 4986|     27|    opj_tcp_t * l_tcp = 00;
 4987|     27|    OPJ_UINT32 * l_tile_len = 00;
 4988|     27|    OPJ_BOOL l_sot_length_pb_detected = OPJ_FALSE;
  ------------------
  |  |  118|     27|#define OPJ_FALSE 0
  ------------------
 4989|       |
 4990|       |    /* preconditions */
 4991|     27|    assert(p_j2k != 00);
 4992|     27|    assert(p_manager != 00);
 4993|     27|    assert(p_stream != 00);
 4994|       |
 4995|     27|    l_tcp = &(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]);
 4996|       |
 4997|     27|    if (p_j2k->m_specific_param.m_decoder.m_last_tile_part) {
  ------------------
  |  Branch (4997:9): [True: 21, False: 6]
  ------------------
 4998|       |        /* opj_stream_get_number_byte_left returns OPJ_OFF_T
 4999|       |        // but we are in the last tile part,
 5000|       |        // so its result will fit on OPJ_UINT32 unless we find
 5001|       |        // a file with a single tile part of more than 4 GB...*/
 5002|     21|        p_j2k->m_specific_param.m_decoder.m_sot_length = (OPJ_UINT32)(
 5003|     21|                    opj_stream_get_number_byte_left(p_stream) - 2);
 5004|     21|    } else {
 5005|       |        /* Check to avoid pass the limit of OPJ_UINT32 */
 5006|      6|        if (p_j2k->m_specific_param.m_decoder.m_sot_length >= 2) {
  ------------------
  |  Branch (5006:13): [True: 6, False: 0]
  ------------------
 5007|      6|            p_j2k->m_specific_param.m_decoder.m_sot_length -= 2;
 5008|      6|        } else {
 5009|       |            /* MSD: case commented to support empty SOT marker (PHR data) */
 5010|      0|        }
 5011|      6|    }
 5012|       |
 5013|     27|    l_current_data = &(l_tcp->m_data);
 5014|     27|    l_tile_len = &l_tcp->m_data_size;
 5015|       |
 5016|       |    /* Patch to support new PHR data */
 5017|     27|    if (p_j2k->m_specific_param.m_decoder.m_sot_length) {
  ------------------
  |  Branch (5017:9): [True: 27, False: 0]
  ------------------
 5018|       |        /* If we are here, we'll try to read the data after allocation */
 5019|       |        /* Check enough bytes left in stream before allocation */
 5020|     27|        if ((OPJ_OFF_T)p_j2k->m_specific_param.m_decoder.m_sot_length >
  ------------------
  |  Branch (5020:13): [True: 0, False: 27]
  ------------------
 5021|     27|                opj_stream_get_number_byte_left(p_stream)) {
 5022|      0|            if (p_j2k->m_cp.strict) {
  ------------------
  |  Branch (5022:17): [True: 0, False: 0]
  ------------------
 5023|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5024|      0|                              "Tile part length size inconsistent with stream length\n");
 5025|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5026|      0|            } else {
 5027|      0|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 5028|      0|                              "Tile part length size inconsistent with stream length\n");
 5029|      0|            }
 5030|      0|        }
 5031|     27|        if (p_j2k->m_specific_param.m_decoder.m_sot_length >
  ------------------
  |  Branch (5031:13): [True: 0, False: 27]
  ------------------
 5032|     27|                UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA) {
  ------------------
  |  |   39|     27|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 5033|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5034|      0|                          "p_j2k->m_specific_param.m_decoder.m_sot_length > "
 5035|      0|                          "UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA");
 5036|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5037|      0|        }
 5038|       |        /* Add a margin of OPJ_COMMON_CBLK_DATA_EXTRA to the allocation we */
 5039|       |        /* do so that opj_mqc_init_dec_common() can safely add a synthetic */
 5040|       |        /* 0xFFFF marker. */
 5041|     27|        if (! *l_current_data) {
  ------------------
  |  Branch (5041:13): [True: 26, False: 1]
  ------------------
 5042|       |            /* LH: oddly enough, in this path, l_tile_len!=0.
 5043|       |             * TODO: If this was consistent, we could simplify the code to only use realloc(), as realloc(0,...) default to malloc(0,...).
 5044|       |             */
 5045|     26|            *l_current_data = (OPJ_BYTE*) opj_malloc(
 5046|     26|                                  p_j2k->m_specific_param.m_decoder.m_sot_length + OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|     26|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 5047|     26|        } else {
 5048|      1|            OPJ_BYTE *l_new_current_data;
 5049|      1|            if (*l_tile_len > UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA -
  ------------------
  |  |   39|      1|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
  |  Branch (5049:17): [True: 0, False: 1]
  ------------------
 5050|      1|                    p_j2k->m_specific_param.m_decoder.m_sot_length) {
 5051|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5052|      0|                              "*l_tile_len > UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA - "
 5053|      0|                              "p_j2k->m_specific_param.m_decoder.m_sot_length");
 5054|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5055|      0|            }
 5056|       |
 5057|      1|            l_new_current_data = (OPJ_BYTE *) opj_realloc(*l_current_data,
 5058|      1|                                 *l_tile_len + p_j2k->m_specific_param.m_decoder.m_sot_length +
 5059|      1|                                 OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|      1|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 5060|      1|            if (! l_new_current_data) {
  ------------------
  |  Branch (5060:17): [True: 0, False: 1]
  ------------------
 5061|      0|                opj_free(*l_current_data);
 5062|       |                /*nothing more is done as l_current_data will be set to null, and just
 5063|       |                  afterward we enter in the error path
 5064|       |                  and the actual tile_len is updated (committed) at the end of the
 5065|       |                  function. */
 5066|      0|            }
 5067|      1|            *l_current_data = l_new_current_data;
 5068|      1|        }
 5069|       |
 5070|     27|        if (*l_current_data == 00) {
  ------------------
  |  Branch (5070:13): [True: 0, False: 27]
  ------------------
 5071|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to decode tile\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5072|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5073|      0|        }
 5074|     27|    } else {
 5075|      0|        l_sot_length_pb_detected = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 5076|      0|    }
 5077|       |
 5078|       |    /* Index */
 5079|     27|    l_cstr_index = p_j2k->cstr_index;
 5080|     27|    {
 5081|     27|        OPJ_OFF_T l_current_pos = opj_stream_tell(p_stream) - 2;
 5082|       |
 5083|     27|        OPJ_UINT32 l_current_tile_part =
 5084|     27|            l_cstr_index->tile_index[p_j2k->m_current_tile_number].current_tpsno;
 5085|     27|        l_cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index[l_current_tile_part].end_header
 5086|     27|            =
 5087|     27|                l_current_pos;
 5088|     27|        l_cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index[l_current_tile_part].end_pos
 5089|     27|            =
 5090|     27|                l_current_pos + p_j2k->m_specific_param.m_decoder.m_sot_length + 2;
 5091|       |
 5092|     27|        if (OPJ_FALSE == opj_j2k_add_tlmarker(p_j2k->m_current_tile_number,
  ------------------
  |  |  118|     27|#define OPJ_FALSE 0
  ------------------
  |  Branch (5092:13): [True: 0, False: 27]
  ------------------
 5093|     27|                                              l_cstr_index,
 5094|     27|                                              J2K_MS_SOD,
  ------------------
  |  |   74|     27|#define J2K_MS_SOD 0xff93   /**< SOD marker value */
  ------------------
 5095|     27|                                              l_current_pos,
 5096|     27|                                              p_j2k->m_specific_param.m_decoder.m_sot_length + 2)) {
 5097|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add tl marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5098|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5099|      0|        }
 5100|       |
 5101|       |        /*l_cstr_index->packno = 0;*/
 5102|     27|    }
 5103|       |
 5104|       |    /* Patch to support new PHR data */
 5105|     27|    if (!l_sot_length_pb_detected) {
  ------------------
  |  Branch (5105:9): [True: 27, False: 0]
  ------------------
 5106|     27|        l_current_read_size = opj_stream_read_data(
 5107|     27|                                  p_stream,
 5108|     27|                                  *l_current_data + *l_tile_len,
 5109|     27|                                  p_j2k->m_specific_param.m_decoder.m_sot_length,
 5110|     27|                                  p_manager);
 5111|     27|    } else {
 5112|      0|        l_current_read_size = 0;
 5113|      0|    }
 5114|       |
 5115|     27|    if (l_current_read_size != p_j2k->m_specific_param.m_decoder.m_sot_length) {
  ------------------
  |  Branch (5115:9): [True: 0, False: 27]
  ------------------
 5116|      0|        if (l_current_read_size == (OPJ_SIZE_T)(-1)) {
  ------------------
  |  Branch (5116:13): [True: 0, False: 0]
  ------------------
 5117|       |            /* Avoid issue of https://github.com/uclouvain/openjpeg/issues/1533 */
 5118|      0|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 5119|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 5120|      0|        }
 5121|      0|        p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
 5122|     27|    } else {
 5123|     27|        p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPHSOT;
 5124|     27|    }
 5125|       |
 5126|     27|    *l_tile_len += (OPJ_UINT32)l_current_read_size;
 5127|       |
 5128|     27|    return OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
 5129|     27|}
j2k.c:opj_j2k_need_nb_tile_parts_correction:
 9583|     11|{
 9584|     11|    OPJ_BYTE   l_header_data[10];
 9585|     11|    OPJ_OFF_T  l_stream_pos_backup;
 9586|     11|    OPJ_UINT32 l_current_marker;
 9587|     11|    OPJ_UINT32 l_marker_size;
 9588|     11|    OPJ_UINT32 l_tile_no, l_tot_len, l_current_part, l_num_parts;
 9589|       |
 9590|       |    /* initialize to no correction needed */
 9591|     11|    *p_correction_needed = OPJ_FALSE;
  ------------------
  |  |  118|     11|#define OPJ_FALSE 0
  ------------------
 9592|       |
 9593|     11|    if (!opj_stream_has_seek(p_stream)) {
  ------------------
  |  Branch (9593:9): [True: 0, False: 11]
  ------------------
 9594|       |        /* We can't do much in this case, seek is needed */
 9595|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 9596|      0|    }
 9597|       |
 9598|     11|    l_stream_pos_backup = opj_stream_tell(p_stream);
 9599|     11|    if (l_stream_pos_backup == -1) {
  ------------------
  |  Branch (9599:9): [True: 0, False: 11]
  ------------------
 9600|       |        /* let's do nothing */
 9601|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 9602|      0|    }
 9603|       |
 9604|     13|    for (;;) {
 9605|       |        /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */
 9606|     13|        if (opj_stream_read_data(p_stream, l_header_data, 2, p_manager) != 2) {
  ------------------
  |  Branch (9606:13): [True: 0, False: 13]
  ------------------
 9607|       |            /* assume all is OK */
 9608|      0|            if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9608:17): [True: 0, False: 0]
  ------------------
 9609|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9610|      0|            }
 9611|      0|            return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 9612|      0|        }
 9613|       |
 9614|       |        /* Read 2 bytes from buffer as the new marker ID */
 9615|     13|        opj_read_bytes(l_header_data, &l_current_marker, 2);
  ------------------
  |  |   65|     13|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9616|       |
 9617|     13|        if (l_current_marker != J2K_MS_SOT) {
  ------------------
  |  |   73|     13|#define J2K_MS_SOT 0xff90   /**< SOT marker value */
  ------------------
  |  Branch (9617:13): [True: 10, False: 3]
  ------------------
 9618|       |            /* assume all is OK */
 9619|     10|            if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9619:17): [True: 0, False: 10]
  ------------------
 9620|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9621|      0|            }
 9622|     10|            return OPJ_TRUE;
  ------------------
  |  |  117|     10|#define OPJ_TRUE 1
  ------------------
 9623|     10|        }
 9624|       |
 9625|       |        /* Try to read 2 bytes (the marker size) from stream and copy them into the buffer */
 9626|      3|        if (opj_stream_read_data(p_stream, l_header_data, 2, p_manager) != 2) {
  ------------------
  |  Branch (9626:13): [True: 0, False: 3]
  ------------------
 9627|      0|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9628|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9629|      0|        }
 9630|       |
 9631|       |        /* Read 2 bytes from the buffer as the marker size */
 9632|      3|        opj_read_bytes(l_header_data, &l_marker_size, 2);
  ------------------
  |  |   65|      3|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 9633|       |
 9634|       |        /* Check marker size for SOT Marker */
 9635|      3|        if (l_marker_size != 10) {
  ------------------
  |  Branch (9635:13): [True: 0, False: 3]
  ------------------
 9636|      0|            opj_event_msg(p_manager, EVT_ERROR, "Inconsistent marker size\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9637|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9638|      0|        }
 9639|      3|        l_marker_size -= 2;
 9640|       |
 9641|      3|        if (opj_stream_read_data(p_stream, l_header_data, l_marker_size,
  ------------------
  |  Branch (9641:13): [True: 0, False: 3]
  ------------------
 9642|      3|                                 p_manager) != l_marker_size) {
 9643|      0|            opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 9644|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9645|      0|        }
 9646|       |
 9647|      3|        if (! opj_j2k_get_sot_values(l_header_data, l_marker_size, &l_tile_no,
  ------------------
  |  Branch (9647:13): [True: 0, False: 3]
  ------------------
 9648|      3|                                     &l_tot_len, &l_current_part, &l_num_parts, p_manager)) {
 9649|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9650|      0|        }
 9651|       |
 9652|      3|        if (l_tile_no == tile_no) {
  ------------------
  |  Branch (9652:13): [True: 1, False: 2]
  ------------------
 9653|       |            /* we found what we were looking for */
 9654|      1|            break;
 9655|      1|        }
 9656|       |
 9657|      2|        if (l_tot_len < 14U) {
  ------------------
  |  Branch (9657:13): [True: 0, False: 2]
  ------------------
 9658|       |            /* last SOT until EOC or invalid Psot value */
 9659|       |            /* assume all is OK */
 9660|      0|            if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9660:17): [True: 0, False: 0]
  ------------------
 9661|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9662|      0|            }
 9663|      0|            return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 9664|      0|        }
 9665|      2|        l_tot_len -= 12U;
 9666|       |        /* look for next SOT marker */
 9667|      2|        if (opj_stream_skip(p_stream, (OPJ_OFF_T)(l_tot_len),
  ------------------
  |  Branch (9667:13): [True: 0, False: 2]
  ------------------
 9668|      2|                            p_manager) != (OPJ_OFF_T)(l_tot_len)) {
 9669|       |            /* assume all is OK */
 9670|      0|            if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9670:17): [True: 0, False: 0]
  ------------------
 9671|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9672|      0|            }
 9673|      0|            return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 9674|      0|        }
 9675|      2|    }
 9676|       |
 9677|       |    /* check for correction */
 9678|      1|    if (l_current_part == l_num_parts) {
  ------------------
  |  Branch (9678:9): [True: 1, False: 0]
  ------------------
 9679|      1|        *p_correction_needed = OPJ_TRUE;
  ------------------
  |  |  117|      1|#define OPJ_TRUE 1
  ------------------
 9680|      1|    }
 9681|       |
 9682|      1|    if (! opj_stream_seek(p_stream, l_stream_pos_backup, p_manager)) {
  ------------------
  |  Branch (9682:9): [True: 0, False: 1]
  ------------------
 9683|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 9684|      0|    }
 9685|      1|    return OPJ_TRUE;
  ------------------
  |  |  117|      1|#define OPJ_TRUE 1
  ------------------
 9686|      1|}
j2k.c:opj_j2k_merge_ppt:
 4218|     26|{
 4219|     26|    OPJ_UINT32 i, l_ppt_data_size;
 4220|       |    /* preconditions */
 4221|     26|    assert(p_tcp != 00);
 4222|     26|    assert(p_manager != 00);
 4223|       |
 4224|     26|    if (p_tcp->ppt_buffer != NULL) {
  ------------------
  |  Branch (4224:9): [True: 0, False: 26]
  ------------------
 4225|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4226|      0|                      "opj_j2k_merge_ppt() has already been called\n");
 4227|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4228|      0|    }
 4229|       |
 4230|     26|    if (p_tcp->ppt == 0U) {
  ------------------
  |  Branch (4230:9): [True: 26, False: 0]
  ------------------
 4231|     26|        return OPJ_TRUE;
  ------------------
  |  |  117|     26|#define OPJ_TRUE 1
  ------------------
 4232|     26|    }
 4233|       |
 4234|      0|    l_ppt_data_size = 0U;
 4235|      0|    for (i = 0U; i < p_tcp->ppt_markers_count; ++i) {
  ------------------
  |  Branch (4235:18): [True: 0, False: 0]
  ------------------
 4236|      0|        l_ppt_data_size +=
 4237|      0|            p_tcp->ppt_markers[i].m_data_size; /* can't overflow, max 256 markers of max 65536 bytes */
 4238|      0|    }
 4239|       |
 4240|      0|    p_tcp->ppt_buffer = (OPJ_BYTE *) opj_malloc(l_ppt_data_size);
 4241|      0|    if (p_tcp->ppt_buffer == 00) {
  ------------------
  |  Branch (4241:9): [True: 0, False: 0]
  ------------------
 4242|      0|        opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPT marker\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 4243|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 4244|      0|    }
 4245|      0|    p_tcp->ppt_len = l_ppt_data_size;
 4246|      0|    l_ppt_data_size = 0U;
 4247|      0|    for (i = 0U; i < p_tcp->ppt_markers_count; ++i) {
  ------------------
  |  Branch (4247:18): [True: 0, False: 0]
  ------------------
 4248|      0|        if (p_tcp->ppt_markers[i].m_data !=
  ------------------
  |  Branch (4248:13): [True: 0, False: 0]
  ------------------
 4249|      0|                NULL) { /* standard doesn't seem to require contiguous Zppt */
 4250|      0|            memcpy(p_tcp->ppt_buffer + l_ppt_data_size, p_tcp->ppt_markers[i].m_data,
 4251|      0|                   p_tcp->ppt_markers[i].m_data_size);
 4252|      0|            l_ppt_data_size +=
 4253|      0|                p_tcp->ppt_markers[i].m_data_size; /* can't overflow, max 256 markers of max 65536 bytes */
 4254|       |
 4255|      0|            opj_free(p_tcp->ppt_markers[i].m_data);
 4256|      0|            p_tcp->ppt_markers[i].m_data = NULL;
 4257|      0|            p_tcp->ppt_markers[i].m_data_size = 0U;
 4258|      0|        }
 4259|      0|    }
 4260|       |
 4261|      0|    p_tcp->ppt_markers_count = 0U;
 4262|      0|    opj_free(p_tcp->ppt_markers);
 4263|      0|    p_tcp->ppt_markers = NULL;
 4264|       |
 4265|      0|    p_tcp->ppt_data = p_tcp->ppt_buffer;
 4266|      0|    p_tcp->ppt_data_size = p_tcp->ppt_len;
 4267|      0|    return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 4268|      0|}
j2k.c:opj_j2k_tcp_data_destroy:
 9529|  6.99k|{
 9530|  6.99k|    if (p_tcp->m_data) {
  ------------------
  |  Branch (9530:9): [True: 26, False: 6.96k]
  ------------------
 9531|     26|        opj_free(p_tcp->m_data);
 9532|     26|        p_tcp->m_data = NULL;
 9533|     26|        p_tcp->m_data_size = 0;
 9534|     26|    }
 9535|  6.99k|}
j2k.c:opj_j2k_update_image_dimensions:
10408|     27|{
10409|     27|    OPJ_UINT32 it_comp;
10410|     27|    OPJ_INT32 l_comp_x1, l_comp_y1;
10411|     27|    opj_image_comp_t* l_img_comp = NULL;
10412|       |
10413|     27|    l_img_comp = p_image->comps;
10414|    112|    for (it_comp = 0; it_comp < p_image->numcomps; ++it_comp) {
  ------------------
  |  Branch (10414:23): [True: 85, False: 27]
  ------------------
10415|     85|        OPJ_INT32 l_h, l_w;
10416|     85|        if (p_image->x0 > (OPJ_UINT32)INT_MAX ||
  ------------------
  |  Branch (10416:13): [True: 0, False: 85]
  ------------------
10417|     85|                p_image->y0 > (OPJ_UINT32)INT_MAX ||
  ------------------
  |  Branch (10417:17): [True: 0, False: 85]
  ------------------
10418|     85|                p_image->x1 > (OPJ_UINT32)INT_MAX ||
  ------------------
  |  Branch (10418:17): [True: 0, False: 85]
  ------------------
10419|     85|                p_image->y1 > (OPJ_UINT32)INT_MAX) {
  ------------------
  |  Branch (10419:17): [True: 0, False: 85]
  ------------------
10420|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10421|      0|                          "Image coordinates above INT_MAX are not supported\n");
10422|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10423|      0|        }
10424|       |
10425|     85|        l_img_comp->x0 = opj_uint_ceildiv(p_image->x0, l_img_comp->dx);
10426|     85|        l_img_comp->y0 = opj_uint_ceildiv(p_image->y0, l_img_comp->dy);
10427|     85|        l_comp_x1 = opj_int_ceildiv((OPJ_INT32)p_image->x1, (OPJ_INT32)l_img_comp->dx);
10428|     85|        l_comp_y1 = opj_int_ceildiv((OPJ_INT32)p_image->y1, (OPJ_INT32)l_img_comp->dy);
10429|       |
10430|     85|        l_w = opj_int_ceildivpow2(l_comp_x1, (OPJ_INT32)l_img_comp->factor)
10431|     85|              - opj_int_ceildivpow2((OPJ_INT32)l_img_comp->x0, (OPJ_INT32)l_img_comp->factor);
10432|     85|        if (l_w < 0) {
  ------------------
  |  Branch (10432:13): [True: 0, False: 85]
  ------------------
10433|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10434|      0|                          "Size x of the decoded component image is incorrect (comp[%d].w=%d).\n",
10435|      0|                          it_comp, l_w);
10436|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10437|      0|        }
10438|     85|        l_img_comp->w = (OPJ_UINT32)l_w;
10439|       |
10440|     85|        l_h = opj_int_ceildivpow2(l_comp_y1, (OPJ_INT32)l_img_comp->factor)
10441|     85|              - opj_int_ceildivpow2((OPJ_INT32)l_img_comp->y0, (OPJ_INT32)l_img_comp->factor);
10442|     85|        if (l_h < 0) {
  ------------------
  |  Branch (10442:13): [True: 0, False: 85]
  ------------------
10443|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
10444|      0|                          "Size y of the decoded component image is incorrect (comp[%d].h=%d).\n",
10445|      0|                          it_comp, l_h);
10446|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10447|      0|        }
10448|     85|        l_img_comp->h = (OPJ_UINT32)l_h;
10449|       |
10450|     85|        l_img_comp++;
10451|     85|    }
10452|       |
10453|     27|    return OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
10454|     27|}
j2k.c:opj_j2k_create_cstr_index:
10746|     59|{
10747|     59|    opj_codestream_index_t* cstr_index = (opj_codestream_index_t*)
10748|     59|                                         opj_calloc(1, sizeof(opj_codestream_index_t));
10749|     59|    if (!cstr_index) {
  ------------------
  |  Branch (10749:9): [True: 0, False: 59]
  ------------------
10750|      0|        return NULL;
10751|      0|    }
10752|       |
10753|     59|    cstr_index->maxmarknum = 100;
10754|     59|    cstr_index->marknum = 0;
10755|     59|    cstr_index->marker = (opj_marker_info_t*)
10756|     59|                         opj_calloc(cstr_index->maxmarknum, sizeof(opj_marker_info_t));
10757|     59|    if (!cstr_index-> marker) {
  ------------------
  |  Branch (10757:9): [True: 0, False: 59]
  ------------------
10758|      0|        opj_free(cstr_index);
10759|      0|        return NULL;
10760|      0|    }
10761|       |
10762|     59|    cstr_index->tile_index = NULL;
10763|       |
10764|     59|    return cstr_index;
10765|     59|}
j2k.c:opj_j2k_setup_decoding:
12129|     27|{
12130|       |    /* preconditions*/
12131|     27|    assert(p_j2k != 00);
12132|     27|    assert(p_manager != 00);
12133|       |
12134|     27|    if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,
  ------------------
  |  Branch (12134:9): [True: 0, False: 27]
  ------------------
12135|     27|                                           (opj_procedure)opj_j2k_decode_tiles, p_manager)) {
12136|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12137|      0|    }
12138|       |    /* DEVELOPER CORNER, add your custom procedures */
12139|       |
12140|     27|    return OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
12141|     27|}
j2k.c:opj_j2k_decode_tiles:
11930|     27|{
11931|     27|    OPJ_BOOL l_go_on = OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
11932|     27|    OPJ_UINT32 l_current_tile_no;
11933|     27|    OPJ_INT32 l_tile_x0, l_tile_y0, l_tile_x1, l_tile_y1;
11934|     27|    OPJ_UINT32 l_nb_comps;
11935|     27|    OPJ_UINT32 nr_tiles = 0;
11936|     27|    OPJ_OFF_T end_pos = 0;
11937|       |
11938|       |    /* Particular case for whole single tile decoding */
11939|       |    /* We can avoid allocating intermediate tile buffers */
11940|     27|    if (p_j2k->m_cp.tw == 1 && p_j2k->m_cp.th == 1 &&
  ------------------
  |  Branch (11940:9): [True: 16, False: 11]
  |  Branch (11940:32): [True: 12, False: 4]
  ------------------
11941|     27|            p_j2k->m_cp.tx0 == 0 && p_j2k->m_cp.ty0 == 0 &&
  ------------------
  |  Branch (11941:13): [True: 12, False: 0]
  |  Branch (11941:37): [True: 12, False: 0]
  ------------------
11942|     27|            p_j2k->m_output_image->x0 == 0 &&
  ------------------
  |  Branch (11942:13): [True: 12, False: 0]
  ------------------
11943|     27|            p_j2k->m_output_image->y0 == 0 &&
  ------------------
  |  Branch (11943:13): [True: 12, False: 0]
  ------------------
11944|     27|            p_j2k->m_output_image->x1 == p_j2k->m_cp.tdx &&
  ------------------
  |  Branch (11944:13): [True: 0, False: 12]
  ------------------
11945|     27|            p_j2k->m_output_image->y1 == p_j2k->m_cp.tdy) {
  ------------------
  |  Branch (11945:13): [True: 0, False: 0]
  ------------------
11946|      0|        OPJ_UINT32 i;
11947|      0|        if (! opj_j2k_read_tile_header(p_j2k,
  ------------------
  |  Branch (11947:13): [True: 0, False: 0]
  ------------------
11948|      0|                                       &l_current_tile_no,
11949|      0|                                       NULL,
11950|      0|                                       &l_tile_x0, &l_tile_y0,
11951|      0|                                       &l_tile_x1, &l_tile_y1,
11952|      0|                                       &l_nb_comps,
11953|      0|                                       &l_go_on,
11954|      0|                                       p_stream,
11955|      0|                                       p_manager)) {
11956|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11957|      0|        }
11958|       |
11959|      0|        if (!l_go_on ||
  ------------------
  |  Branch (11959:13): [True: 0, False: 0]
  ------------------
11960|      0|                ! opj_j2k_decode_tile(p_j2k, l_current_tile_no, NULL, 0,
  ------------------
  |  Branch (11960:17): [True: 0, False: 0]
  ------------------
11961|      0|                                      p_stream, p_manager)) {
11962|      0|            opj_event_msg(p_manager, EVT_ERROR, "Failed to decode tile 1/1\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11963|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11964|      0|        }
11965|       |
11966|       |        /* Transfer TCD data to output image data */
11967|      0|        for (i = 0; i < p_j2k->m_output_image->numcomps; i++) {
  ------------------
  |  Branch (11967:21): [True: 0, False: 0]
  ------------------
11968|      0|            opj_image_data_free(p_j2k->m_output_image->comps[i].data);
11969|      0|            p_j2k->m_output_image->comps[i].data =
11970|      0|                p_j2k->m_tcd->tcd_image->tiles->comps[i].data;
11971|      0|            p_j2k->m_output_image->comps[i].resno_decoded =
11972|      0|                p_j2k->m_tcd->image->comps[i].resno_decoded;
11973|      0|            p_j2k->m_tcd->tcd_image->tiles->comps[i].data = NULL;
11974|      0|        }
11975|       |
11976|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
11977|      0|    }
11978|       |
11979|     27|    p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts = 0;
11980|     27|    p_j2k->m_specific_param.m_decoder.m_idx_intersecting_tile_parts = 0;
11981|     27|    opj_free(p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset);
11982|     27|    p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset = NULL;
11983|       |
11984|       |    /* If the area to decode only intersects a subset of tiles, and we have
11985|       |     * valid TLM information, then use it to plan the tilepart offsets to
11986|       |     * seek to.
11987|       |     */
11988|     27|    if (!(p_j2k->m_specific_param.m_decoder.m_start_tile_x == 0 &&
  ------------------
  |  Branch (11988:11): [True: 27, False: 0]
  ------------------
11989|     27|            p_j2k->m_specific_param.m_decoder.m_start_tile_y == 0 &&
  ------------------
  |  Branch (11989:13): [True: 27, False: 0]
  ------------------
11990|     27|            p_j2k->m_specific_param.m_decoder.m_end_tile_x == p_j2k->m_cp.tw &&
  ------------------
  |  Branch (11990:13): [True: 16, False: 11]
  ------------------
11991|     27|            p_j2k->m_specific_param.m_decoder.m_end_tile_y == p_j2k->m_cp.th) &&
  ------------------
  |  Branch (11991:13): [True: 12, False: 4]
  ------------------
11992|     27|            !p_j2k->m_specific_param.m_decoder.m_tlm.m_is_invalid &&
  ------------------
  |  Branch (11992:13): [True: 0, False: 15]
  ------------------
11993|     27|            opj_stream_has_seek(p_stream)) {
  ------------------
  |  Branch (11993:13): [True: 0, False: 0]
  ------------------
11994|      0|        OPJ_UINT32 m_num_intersecting_tile_parts = 0;
11995|       |
11996|      0|        OPJ_UINT32 j;
11997|      0|        for (j = 0; j < p_j2k->m_cp.tw * p_j2k->m_cp.th; ++j) {
  ------------------
  |  Branch (11997:21): [True: 0, False: 0]
  ------------------
11998|      0|            if (p_j2k->cstr_index->tile_index[j].nb_tps > 0 &&
  ------------------
  |  Branch (11998:17): [True: 0, False: 0]
  ------------------
11999|      0|                    p_j2k->cstr_index->tile_index[j].tp_index[
  ------------------
  |  Branch (11999:21): [True: 0, False: 0]
  ------------------
12000|      0|                        p_j2k->cstr_index->tile_index[j].nb_tps - 1].end_pos > end_pos) {
12001|      0|                end_pos = p_j2k->cstr_index->tile_index[j].tp_index[
12002|      0|                              p_j2k->cstr_index->tile_index[j].nb_tps - 1].end_pos;
12003|      0|            }
12004|      0|        }
12005|       |
12006|      0|        for (j = p_j2k->m_specific_param.m_decoder.m_start_tile_y;
12007|      0|                j < p_j2k->m_specific_param.m_decoder.m_end_tile_y; ++j) {
  ------------------
  |  Branch (12007:17): [True: 0, False: 0]
  ------------------
12008|      0|            OPJ_UINT32 i;
12009|      0|            for (i = p_j2k->m_specific_param.m_decoder.m_start_tile_x;
12010|      0|                    i < p_j2k->m_specific_param.m_decoder.m_end_tile_x; ++i) {
  ------------------
  |  Branch (12010:21): [True: 0, False: 0]
  ------------------
12011|      0|                const OPJ_UINT32 tile_number = j * p_j2k->m_cp.tw + i;
12012|      0|                m_num_intersecting_tile_parts +=
12013|      0|                    p_j2k->cstr_index->tile_index[tile_number].nb_tps;
12014|      0|            }
12015|      0|        }
12016|       |
12017|      0|        p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset =
12018|      0|            (OPJ_OFF_T*)
12019|      0|            opj_malloc(m_num_intersecting_tile_parts * sizeof(OPJ_OFF_T));
12020|      0|        if (m_num_intersecting_tile_parts > 0 &&
  ------------------
  |  Branch (12020:13): [True: 0, False: 0]
  ------------------
12021|      0|                p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset) {
  ------------------
  |  Branch (12021:17): [True: 0, False: 0]
  ------------------
12022|      0|            OPJ_UINT32 idx = 0;
12023|      0|            for (j = p_j2k->m_specific_param.m_decoder.m_start_tile_y;
12024|      0|                    j < p_j2k->m_specific_param.m_decoder.m_end_tile_y; ++j) {
  ------------------
  |  Branch (12024:21): [True: 0, False: 0]
  ------------------
12025|      0|                OPJ_UINT32 i;
12026|      0|                for (i = p_j2k->m_specific_param.m_decoder.m_start_tile_x;
12027|      0|                        i < p_j2k->m_specific_param.m_decoder.m_end_tile_x; ++i) {
  ------------------
  |  Branch (12027:25): [True: 0, False: 0]
  ------------------
12028|      0|                    const OPJ_UINT32 tile_number = j * p_j2k->m_cp.tw + i;
12029|      0|                    OPJ_UINT32 k;
12030|      0|                    for (k = 0; k < p_j2k->cstr_index->tile_index[tile_number].nb_tps; ++k) {
  ------------------
  |  Branch (12030:33): [True: 0, False: 0]
  ------------------
12031|      0|                        const OPJ_OFF_T next_tp_sot_pos =
12032|      0|                            p_j2k->cstr_index->tile_index[tile_number].tp_index[k].start_pos;
12033|      0|                        p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset[idx] =
12034|      0|                            next_tp_sot_pos;
12035|      0|                        ++idx;
12036|      0|                    }
12037|      0|                }
12038|      0|            }
12039|       |
12040|      0|            p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts = idx;
12041|       |
12042|       |            /* Sort by increasing offset */
12043|      0|            qsort(p_j2k->m_specific_param.m_decoder.m_intersecting_tile_parts_offset,
12044|      0|                  p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts,
12045|      0|                  sizeof(OPJ_OFF_T),
12046|      0|                  CompareOffT);
12047|      0|        }
12048|      0|    }
12049|       |
12050|     29|    for (;;) {
12051|     29|        if (p_j2k->m_cp.tw == 1 && p_j2k->m_cp.th == 1 &&
  ------------------
  |  Branch (12051:13): [True: 18, False: 11]
  |  Branch (12051:36): [True: 12, False: 6]
  ------------------
12052|     29|                p_j2k->m_cp.tcps[0].m_data != NULL) {
  ------------------
  |  Branch (12052:17): [True: 0, False: 12]
  ------------------
12053|      0|            l_current_tile_no = 0;
12054|      0|            p_j2k->m_current_tile_number = 0;
12055|      0|            p_j2k->m_specific_param.m_decoder.m_state |= J2K_STATE_DATA;
12056|     29|        } else {
12057|     29|            if (! opj_j2k_read_tile_header(p_j2k,
  ------------------
  |  Branch (12057:17): [True: 3, False: 26]
  ------------------
12058|     29|                                           &l_current_tile_no,
12059|     29|                                           NULL,
12060|     29|                                           &l_tile_x0, &l_tile_y0,
12061|     29|                                           &l_tile_x1, &l_tile_y1,
12062|     29|                                           &l_nb_comps,
12063|     29|                                           &l_go_on,
12064|     29|                                           p_stream,
12065|     29|                                           p_manager)) {
12066|      3|                return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
12067|      3|            }
12068|       |
12069|     26|            if (! l_go_on) {
  ------------------
  |  Branch (12069:17): [True: 0, False: 26]
  ------------------
12070|      0|                break;
12071|      0|            }
12072|     26|        }
12073|       |
12074|     26|        if (! opj_j2k_decode_tile(p_j2k, l_current_tile_no, NULL, 0,
  ------------------
  |  Branch (12074:13): [True: 22, False: 4]
  ------------------
12075|     26|                                  p_stream, p_manager)) {
12076|     22|            opj_event_msg(p_manager, EVT_ERROR, "Failed to decode tile %d/%d\n",
  ------------------
  |  |   66|     22|#define EVT_ERROR   1   /**< Error event type */
  ------------------
12077|     22|                          l_current_tile_no + 1, p_j2k->m_cp.th * p_j2k->m_cp.tw);
12078|     22|            return OPJ_FALSE;
  ------------------
  |  |  118|     22|#define OPJ_FALSE 0
  ------------------
12079|     22|        }
12080|       |
12081|      4|        opj_event_msg(p_manager, EVT_INFO, "Tile %d/%d has been decoded.\n",
  ------------------
  |  |   68|      4|#define EVT_INFO    4   /**< Debug event type */
  ------------------
12082|      4|                      l_current_tile_no + 1, p_j2k->m_cp.th * p_j2k->m_cp.tw);
12083|       |
12084|      4|        if (! opj_j2k_update_image_data(p_j2k->m_tcd,
  ------------------
  |  Branch (12084:13): [True: 0, False: 4]
  ------------------
12085|      4|                                        p_j2k->m_output_image)) {
12086|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12087|      0|        }
12088|       |
12089|      4|        if (p_j2k->m_cp.tw == 1 && p_j2k->m_cp.th == 1 &&
  ------------------
  |  Branch (12089:13): [True: 2, False: 2]
  |  Branch (12089:36): [True: 0, False: 2]
  ------------------
12090|      4|                !(p_j2k->m_output_image->x0 == p_j2k->m_private_image->x0 &&
  ------------------
  |  Branch (12090:19): [True: 0, False: 0]
  ------------------
12091|      0|                  p_j2k->m_output_image->y0 == p_j2k->m_private_image->y0 &&
  ------------------
  |  Branch (12091:19): [True: 0, False: 0]
  ------------------
12092|      0|                  p_j2k->m_output_image->x1 == p_j2k->m_private_image->x1 &&
  ------------------
  |  Branch (12092:19): [True: 0, False: 0]
  ------------------
12093|      0|                  p_j2k->m_output_image->y1 == p_j2k->m_private_image->y1)) {
  ------------------
  |  Branch (12093:19): [True: 0, False: 0]
  ------------------
12094|       |            /* Keep current tcp data */
12095|      4|        } else {
12096|      4|            opj_j2k_tcp_data_destroy(&p_j2k->m_cp.tcps[l_current_tile_no]);
12097|      4|        }
12098|       |
12099|      4|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|      4|#define EVT_INFO    4   /**< Debug event type */
  ------------------
12100|      4|                      "Image data has been updated with tile %d.\n\n", l_current_tile_no + 1);
12101|       |
12102|      4|        if (opj_stream_get_number_byte_left(p_stream) == 0
  ------------------
  |  Branch (12102:13): [True: 2, False: 2]
  ------------------
12103|      4|                && p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NEOC) {
  ------------------
  |  Branch (12103:20): [True: 2, False: 0]
  ------------------
12104|      2|            break;
12105|      2|        }
12106|      2|        if (++nr_tiles ==  p_j2k->m_cp.th * p_j2k->m_cp.tw) {
  ------------------
  |  Branch (12106:13): [True: 0, False: 2]
  ------------------
12107|      0|            break;
12108|      0|        }
12109|      2|        if (p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts > 0 &&
  ------------------
  |  Branch (12109:13): [True: 0, False: 2]
  ------------------
12110|      2|                p_j2k->m_specific_param.m_decoder.m_idx_intersecting_tile_parts ==
  ------------------
  |  Branch (12110:17): [True: 0, False: 0]
  ------------------
12111|      0|                p_j2k->m_specific_param.m_decoder.m_num_intersecting_tile_parts) {
12112|      0|            opj_stream_seek(p_stream, end_pos + 2, p_manager);
12113|      0|            break;
12114|      0|        }
12115|      2|    }
12116|       |
12117|      2|    if (! opj_j2k_are_all_used_components_decoded(p_j2k, p_manager)) {
  ------------------
  |  Branch (12117:9): [True: 0, False: 2]
  ------------------
12118|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12119|      0|    }
12120|       |
12121|      2|    return OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
12122|      2|}
j2k.c:opj_j2k_update_image_data:
10191|      4|{
10192|      4|    OPJ_UINT32 i, j;
10193|      4|    OPJ_UINT32 l_width_src, l_height_src;
10194|      4|    OPJ_UINT32 l_width_dest, l_height_dest;
10195|      4|    OPJ_INT32 l_offset_x0_src, l_offset_y0_src, l_offset_x1_src, l_offset_y1_src;
10196|      4|    OPJ_SIZE_T l_start_offset_src;
10197|      4|    OPJ_UINT32 l_start_x_dest, l_start_y_dest;
10198|      4|    OPJ_UINT32 l_x0_dest, l_y0_dest, l_x1_dest, l_y1_dest;
10199|      4|    OPJ_SIZE_T l_start_offset_dest;
10200|       |
10201|      4|    opj_image_comp_t * l_img_comp_src = 00;
10202|      4|    opj_image_comp_t * l_img_comp_dest = 00;
10203|       |
10204|      4|    opj_tcd_tilecomp_t * l_tilec = 00;
10205|      4|    opj_image_t * l_image_src = 00;
10206|      4|    OPJ_INT32 * l_dest_ptr;
10207|       |
10208|      4|    l_tilec = p_tcd->tcd_image->tiles->comps;
10209|      4|    l_image_src = p_tcd->image;
10210|      4|    l_img_comp_src = l_image_src->comps;
10211|       |
10212|      4|    l_img_comp_dest = p_output_image->comps;
10213|       |
10214|     16|    for (i = 0; i < l_image_src->numcomps;
  ------------------
  |  Branch (10214:17): [True: 12, False: 4]
  ------------------
10215|     12|            i++, ++l_img_comp_dest, ++l_img_comp_src,  ++l_tilec) {
10216|     12|        OPJ_INT32 res_x0, res_x1, res_y0, res_y1;
10217|     12|        OPJ_UINT32 src_data_stride;
10218|     12|        const OPJ_INT32* p_src_data;
10219|       |
10220|       |        /* Copy info from decoded comp image to output image */
10221|     12|        l_img_comp_dest->resno_decoded = l_img_comp_src->resno_decoded;
10222|       |
10223|     12|        if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (10223:13): [True: 3, False: 9]
  ------------------
10224|      3|            opj_tcd_resolution_t* l_res = l_tilec->resolutions +
10225|      3|                                          l_img_comp_src->resno_decoded;
10226|      3|            res_x0 = l_res->x0;
10227|      3|            res_y0 = l_res->y0;
10228|      3|            res_x1 = l_res->x1;
10229|      3|            res_y1 = l_res->y1;
10230|      3|            src_data_stride = (OPJ_UINT32)(
10231|      3|                                  l_tilec->resolutions[l_tilec->minimum_num_resolutions - 1].x1 -
10232|      3|                                  l_tilec->resolutions[l_tilec->minimum_num_resolutions - 1].x0);
10233|      3|            p_src_data = l_tilec->data;
10234|      9|        } else {
10235|      9|            opj_tcd_resolution_t* l_res = l_tilec->resolutions +
10236|      9|                                          l_img_comp_src->resno_decoded;
10237|      9|            res_x0 = (OPJ_INT32)l_res->win_x0;
10238|      9|            res_y0 = (OPJ_INT32)l_res->win_y0;
10239|      9|            res_x1 = (OPJ_INT32)l_res->win_x1;
10240|      9|            res_y1 = (OPJ_INT32)l_res->win_y1;
10241|      9|            src_data_stride = l_res->win_x1 - l_res->win_x0;
10242|      9|            p_src_data = l_tilec->data_win;
10243|      9|        }
10244|       |
10245|     12|        if (p_src_data == NULL) {
  ------------------
  |  Branch (10245:13): [True: 0, False: 12]
  ------------------
10246|       |            /* Happens for partial component decoding */
10247|      0|            continue;
10248|      0|        }
10249|       |
10250|     12|        l_width_src = (OPJ_UINT32)(res_x1 - res_x0);
10251|     12|        l_height_src = (OPJ_UINT32)(res_y1 - res_y0);
10252|       |
10253|       |
10254|       |        /* Current tile component size*/
10255|       |        /*if (i == 0) {
10256|       |        fprintf(stdout, "SRC: l_res_x0=%d, l_res_x1=%d, l_res_y0=%d, l_res_y1=%d\n",
10257|       |                        res_x0, res_x1, res_y0, res_y1);
10258|       |        }*/
10259|       |
10260|       |
10261|       |        /* Border of the current output component*/
10262|     12|        l_x0_dest = opj_uint_ceildivpow2(l_img_comp_dest->x0, l_img_comp_dest->factor);
10263|     12|        l_y0_dest = opj_uint_ceildivpow2(l_img_comp_dest->y0, l_img_comp_dest->factor);
10264|     12|        l_x1_dest = l_x0_dest +
10265|     12|                    l_img_comp_dest->w; /* can't overflow given that image->x1 is uint32 */
10266|     12|        l_y1_dest = l_y0_dest + l_img_comp_dest->h;
10267|       |
10268|       |        /*if (i == 0) {
10269|       |        fprintf(stdout, "DEST: l_x0_dest=%d, l_x1_dest=%d, l_y0_dest=%d, l_y1_dest=%d (%d)\n",
10270|       |                        l_x0_dest, l_x1_dest, l_y0_dest, l_y1_dest, l_img_comp_dest->factor );
10271|       |        }*/
10272|       |
10273|       |        /*-----*/
10274|       |        /* Compute the area (l_offset_x0_src, l_offset_y0_src, l_offset_x1_src, l_offset_y1_src)
10275|       |         * of the input buffer (decoded tile component) which will be move
10276|       |         * in the output buffer. Compute the area of the output buffer (l_start_x_dest,
10277|       |         * l_start_y_dest, l_width_dest, l_height_dest)  which will be modified
10278|       |         * by this input area.
10279|       |         * */
10280|     12|        assert(res_x0 >= 0);
10281|     12|        assert(res_x1 >= 0);
10282|     12|        if (l_x0_dest < (OPJ_UINT32)res_x0) {
  ------------------
  |  Branch (10282:13): [True: 0, False: 12]
  ------------------
10283|      0|            l_start_x_dest = (OPJ_UINT32)res_x0 - l_x0_dest;
10284|      0|            l_offset_x0_src = 0;
10285|       |
10286|      0|            if (l_x1_dest >= (OPJ_UINT32)res_x1) {
  ------------------
  |  Branch (10286:17): [True: 0, False: 0]
  ------------------
10287|      0|                l_width_dest = l_width_src;
10288|      0|                l_offset_x1_src = 0;
10289|      0|            } else {
10290|      0|                l_width_dest = l_x1_dest - (OPJ_UINT32)res_x0 ;
10291|      0|                l_offset_x1_src = (OPJ_INT32)(l_width_src - l_width_dest);
10292|      0|            }
10293|     12|        } else {
10294|     12|            l_start_x_dest = 0U;
10295|     12|            l_offset_x0_src = (OPJ_INT32)l_x0_dest - res_x0;
10296|       |
10297|     12|            if (l_x1_dest >= (OPJ_UINT32)res_x1) {
  ------------------
  |  Branch (10297:17): [True: 12, False: 0]
  ------------------
10298|     12|                l_width_dest = l_width_src - (OPJ_UINT32)l_offset_x0_src;
10299|     12|                l_offset_x1_src = 0;
10300|     12|            } else {
10301|      0|                l_width_dest = l_img_comp_dest->w ;
10302|      0|                l_offset_x1_src = res_x1 - (OPJ_INT32)l_x1_dest;
10303|      0|            }
10304|     12|        }
10305|       |
10306|     12|        if (l_y0_dest < (OPJ_UINT32)res_y0) {
  ------------------
  |  Branch (10306:13): [True: 6, False: 6]
  ------------------
10307|      6|            l_start_y_dest = (OPJ_UINT32)res_y0 - l_y0_dest;
10308|      6|            l_offset_y0_src = 0;
10309|       |
10310|      6|            if (l_y1_dest >= (OPJ_UINT32)res_y1) {
  ------------------
  |  Branch (10310:17): [True: 6, False: 0]
  ------------------
10311|      6|                l_height_dest = l_height_src;
10312|      6|                l_offset_y1_src = 0;
10313|      6|            } else {
10314|      0|                l_height_dest = l_y1_dest - (OPJ_UINT32)res_y0 ;
10315|      0|                l_offset_y1_src = (OPJ_INT32)(l_height_src - l_height_dest);
10316|      0|            }
10317|      6|        } else {
10318|      6|            l_start_y_dest = 0U;
10319|      6|            l_offset_y0_src = (OPJ_INT32)l_y0_dest - res_y0;
10320|       |
10321|      6|            if (l_y1_dest >= (OPJ_UINT32)res_y1) {
  ------------------
  |  Branch (10321:17): [True: 6, False: 0]
  ------------------
10322|      6|                l_height_dest = l_height_src - (OPJ_UINT32)l_offset_y0_src;
10323|      6|                l_offset_y1_src = 0;
10324|      6|            } else {
10325|      0|                l_height_dest = l_img_comp_dest->h ;
10326|      0|                l_offset_y1_src = res_y1 - (OPJ_INT32)l_y1_dest;
10327|      0|            }
10328|      6|        }
10329|       |
10330|     12|        if ((l_offset_x0_src < 0) || (l_offset_y0_src < 0) || (l_offset_x1_src < 0) ||
  ------------------
  |  Branch (10330:13): [True: 0, False: 12]
  |  Branch (10330:38): [True: 0, False: 12]
  |  Branch (10330:63): [True: 0, False: 12]
  ------------------
10331|     12|                (l_offset_y1_src < 0)) {
  ------------------
  |  Branch (10331:17): [True: 0, False: 12]
  ------------------
10332|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10333|      0|        }
10334|       |        /* testcase 2977.pdf.asan.67.2198 */
10335|     12|        if ((OPJ_INT32)l_width_dest < 0 || (OPJ_INT32)l_height_dest < 0) {
  ------------------
  |  Branch (10335:13): [True: 0, False: 12]
  |  Branch (10335:44): [True: 0, False: 12]
  ------------------
10336|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10337|      0|        }
10338|       |        /*-----*/
10339|       |
10340|       |        /* Compute the input buffer offset */
10341|     12|        l_start_offset_src = (OPJ_SIZE_T)l_offset_x0_src + (OPJ_SIZE_T)l_offset_y0_src
10342|     12|                             * (OPJ_SIZE_T)src_data_stride;
10343|       |
10344|       |        /* Compute the output buffer offset */
10345|     12|        l_start_offset_dest = (OPJ_SIZE_T)l_start_x_dest + (OPJ_SIZE_T)l_start_y_dest
10346|     12|                              * (OPJ_SIZE_T)l_img_comp_dest->w;
10347|       |
10348|       |        /* Allocate output component buffer if necessary */
10349|     12|        if (l_img_comp_dest->data == NULL &&
  ------------------
  |  Branch (10349:13): [True: 12, False: 0]
  ------------------
10350|     12|                l_start_offset_src == 0 && l_start_offset_dest == 0 &&
  ------------------
  |  Branch (10350:17): [True: 12, False: 0]
  |  Branch (10350:44): [True: 6, False: 6]
  ------------------
10351|     12|                src_data_stride == l_img_comp_dest->w &&
  ------------------
  |  Branch (10351:17): [True: 3, False: 3]
  ------------------
10352|     12|                l_width_dest == l_img_comp_dest->w &&
  ------------------
  |  Branch (10352:17): [True: 3, False: 0]
  ------------------
10353|     12|                l_height_dest == l_img_comp_dest->h) {
  ------------------
  |  Branch (10353:17): [True: 0, False: 3]
  ------------------
10354|       |            /* If the final image matches the tile buffer, then borrow it */
10355|       |            /* directly to save a copy */
10356|      0|            if (p_tcd->whole_tile_decoding) {
  ------------------
  |  Branch (10356:17): [True: 0, False: 0]
  ------------------
10357|      0|                l_img_comp_dest->data = l_tilec->data;
10358|      0|                l_tilec->data = NULL;
10359|      0|            } else {
10360|      0|                l_img_comp_dest->data = l_tilec->data_win;
10361|      0|                l_tilec->data_win = NULL;
10362|      0|            }
10363|      0|            continue;
10364|     12|        } else if (l_img_comp_dest->data == NULL) {
  ------------------
  |  Branch (10364:20): [True: 12, False: 0]
  ------------------
10365|     12|            OPJ_SIZE_T l_width = l_img_comp_dest->w;
10366|     12|            OPJ_SIZE_T l_height = l_img_comp_dest->h;
10367|       |
10368|     12|            if ((l_height == 0U) || (l_width > (SIZE_MAX / l_height)) ||
  ------------------
  |  Branch (10368:17): [True: 0, False: 12]
  |  Branch (10368:37): [True: 0, False: 12]
  ------------------
10369|     12|                    l_width * l_height > SIZE_MAX / sizeof(OPJ_INT32)) {
  ------------------
  |  Branch (10369:21): [True: 0, False: 12]
  ------------------
10370|       |                /* would overflow */
10371|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10372|      0|            }
10373|     12|            l_img_comp_dest->data = (OPJ_INT32*) opj_image_data_alloc(l_width * l_height *
10374|     12|                                    sizeof(OPJ_INT32));
10375|     12|            if (! l_img_comp_dest->data) {
  ------------------
  |  Branch (10375:17): [True: 0, False: 12]
  ------------------
10376|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
10377|      0|            }
10378|       |
10379|     12|            if (l_img_comp_dest->w != l_width_dest ||
  ------------------
  |  Branch (10379:17): [True: 3, False: 9]
  ------------------
10380|     12|                    l_img_comp_dest->h != l_height_dest) {
  ------------------
  |  Branch (10380:21): [True: 9, False: 0]
  ------------------
10381|     12|                memset(l_img_comp_dest->data, 0,
10382|     12|                       (OPJ_SIZE_T)l_img_comp_dest->w * l_img_comp_dest->h * sizeof(OPJ_INT32));
10383|     12|            }
10384|     12|        }
10385|       |
10386|       |        /* Move the output buffer to the first place where we will write*/
10387|     12|        l_dest_ptr = l_img_comp_dest->data + l_start_offset_dest;
10388|       |
10389|     12|        {
10390|     12|            const OPJ_INT32 * l_src_ptr = p_src_data;
10391|     12|            l_src_ptr += l_start_offset_src;
10392|       |
10393|  1.55k|            for (j = 0; j < l_height_dest; ++j) {
  ------------------
  |  Branch (10393:25): [True: 1.54k, False: 12]
  ------------------
10394|  1.54k|                memcpy(l_dest_ptr, l_src_ptr, l_width_dest * sizeof(OPJ_INT32));
10395|  1.54k|                l_dest_ptr += l_img_comp_dest->w;
10396|  1.54k|                l_src_ptr += src_data_stride;
10397|  1.54k|            }
10398|     12|        }
10399|       |
10400|       |
10401|     12|    }
10402|       |
10403|      4|    return OPJ_TRUE;
  ------------------
  |  |  117|      4|#define OPJ_TRUE 1
  ------------------
10404|      4|}
j2k.c:opj_j2k_are_all_used_components_decoded:
11881|      2|{
11882|      2|    OPJ_UINT32 compno;
11883|      2|    OPJ_BOOL decoded_all_used_components = OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
11884|       |
11885|      2|    if (p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode) {
  ------------------
  |  Branch (11885:9): [True: 0, False: 2]
  ------------------
11886|      0|        for (compno = 0;
11887|      0|                compno < p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode; compno++) {
  ------------------
  |  Branch (11887:17): [True: 0, False: 0]
  ------------------
11888|      0|            OPJ_UINT32 dec_compno =
11889|      0|                p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode[compno];
11890|      0|            if (p_j2k->m_output_image->comps[dec_compno].data == NULL) {
  ------------------
  |  Branch (11890:17): [True: 0, False: 0]
  ------------------
11891|      0|                opj_event_msg(p_manager, EVT_WARNING, "Failed to decode component %d\n",
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
11892|      0|                              dec_compno);
11893|      0|                decoded_all_used_components = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11894|      0|            }
11895|      0|        }
11896|      2|    } else {
11897|      8|        for (compno = 0; compno < p_j2k->m_output_image->numcomps; compno++) {
  ------------------
  |  Branch (11897:26): [True: 6, False: 2]
  ------------------
11898|      6|            if (p_j2k->m_output_image->comps[compno].data == NULL) {
  ------------------
  |  Branch (11898:17): [True: 0, False: 6]
  ------------------
11899|      0|                opj_event_msg(p_manager, EVT_WARNING, "Failed to decode component %d\n",
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
11900|      0|                              compno);
11901|      0|                decoded_all_used_components = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11902|      0|            }
11903|      6|        }
11904|      2|    }
11905|       |
11906|      2|    if (decoded_all_used_components == OPJ_FALSE) {
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
  |  Branch (11906:9): [True: 0, False: 2]
  ------------------
11907|      0|        opj_event_msg(p_manager, EVT_ERROR, "Failed to decode all used components\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
11908|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
11909|      0|    }
11910|       |
11911|      2|    return OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
11912|      2|}
j2k.c:opj_j2k_move_data_from_codec_to_output_image:
12297|      2|{
12298|      2|    OPJ_UINT32 compno;
12299|       |
12300|       |    /* Move data and copy one information from codec to output image*/
12301|      2|    if (p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode > 0) {
  ------------------
  |  Branch (12301:9): [True: 0, False: 2]
  ------------------
12302|      0|        opj_image_comp_t* newcomps =
12303|      0|            (opj_image_comp_t*) opj_malloc(
12304|      0|                p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode *
12305|      0|                sizeof(opj_image_comp_t));
12306|      0|        if (newcomps == NULL) {
  ------------------
  |  Branch (12306:13): [True: 0, False: 0]
  ------------------
12307|      0|            opj_image_destroy(p_j2k->m_private_image);
12308|      0|            p_j2k->m_private_image = NULL;
12309|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
12310|      0|        }
12311|      0|        for (compno = 0; compno < p_image->numcomps; compno++) {
  ------------------
  |  Branch (12311:26): [True: 0, False: 0]
  ------------------
12312|      0|            opj_image_data_free(p_image->comps[compno].data);
12313|      0|            p_image->comps[compno].data = NULL;
12314|      0|        }
12315|      0|        for (compno = 0;
12316|      0|                compno < p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode; compno++) {
  ------------------
  |  Branch (12316:17): [True: 0, False: 0]
  ------------------
12317|      0|            OPJ_UINT32 src_compno =
12318|      0|                p_j2k->m_specific_param.m_decoder.m_comps_indices_to_decode[compno];
12319|      0|            memcpy(&(newcomps[compno]),
12320|      0|                   &(p_j2k->m_output_image->comps[src_compno]),
12321|      0|                   sizeof(opj_image_comp_t));
12322|      0|            newcomps[compno].resno_decoded =
12323|      0|                p_j2k->m_output_image->comps[src_compno].resno_decoded;
12324|      0|            newcomps[compno].data = p_j2k->m_output_image->comps[src_compno].data;
12325|      0|            p_j2k->m_output_image->comps[src_compno].data = NULL;
12326|      0|        }
12327|      0|        for (compno = 0; compno < p_image->numcomps; compno++) {
  ------------------
  |  Branch (12327:26): [True: 0, False: 0]
  ------------------
12328|      0|            assert(p_j2k->m_output_image->comps[compno].data == NULL);
12329|      0|            opj_image_data_free(p_j2k->m_output_image->comps[compno].data);
12330|      0|            p_j2k->m_output_image->comps[compno].data = NULL;
12331|      0|        }
12332|      0|        p_image->numcomps = p_j2k->m_specific_param.m_decoder.m_numcomps_to_decode;
12333|      0|        opj_free(p_image->comps);
12334|      0|        p_image->comps = newcomps;
12335|      2|    } else {
12336|      8|        for (compno = 0; compno < p_image->numcomps; compno++) {
  ------------------
  |  Branch (12336:26): [True: 6, False: 2]
  ------------------
12337|      6|            p_image->comps[compno].resno_decoded =
12338|      6|                p_j2k->m_output_image->comps[compno].resno_decoded;
12339|      6|            opj_image_data_free(p_image->comps[compno].data);
12340|      6|            p_image->comps[compno].data = p_j2k->m_output_image->comps[compno].data;
12341|       |#if 0
12342|       |            char fn[256];
12343|       |            snprintf(fn, sizeof fn, "/tmp/%d.raw", compno);
12344|       |            FILE *debug = fopen(fn, "wb");
12345|       |            fwrite(p_image->comps[compno].data, sizeof(OPJ_INT32),
12346|       |                   p_image->comps[compno].w * p_image->comps[compno].h, debug);
12347|       |            fclose(debug);
12348|       |#endif
12349|      6|            p_j2k->m_output_image->comps[compno].data = NULL;
12350|      6|        }
12351|      2|    }
12352|      2|    return OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
12353|      2|}

opj_jp2_decode:
 1635|     27|{
 1636|     27|    if (!p_image) {
  ------------------
  |  Branch (1636:9): [True: 0, False: 27]
  ------------------
 1637|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1638|      0|    }
 1639|       |
 1640|       |    /* J2K decoding */
 1641|     27|    if (! opj_j2k_decode(jp2->j2k, p_stream, p_image, p_manager)) {
  ------------------
  |  Branch (1641:9): [True: 25, False: 2]
  ------------------
 1642|     25|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|     25|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1643|     25|                      "Failed to decode the codestream in the JP2 file\n");
 1644|     25|        return OPJ_FALSE;
  ------------------
  |  |  118|     25|#define OPJ_FALSE 0
  ------------------
 1645|     25|    }
 1646|       |
 1647|      2|    return opj_jp2_apply_color_postprocessing(jp2, p_image, p_manager);
 1648|     27|}
opj_jp2_setup_decoder:
 1880|     59|{
 1881|       |    /* setup the J2K codec */
 1882|     59|    opj_j2k_setup_decoder(jp2->j2k, parameters);
 1883|       |
 1884|       |    /* further JP2 initializations go here */
 1885|     59|    jp2->color.jp2_has_colr = 0;
 1886|     59|    jp2->ignore_pclr_cmap_cdef = parameters->flags &
 1887|     59|                                 OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
  ------------------
  |  |  548|     59|#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG  0x0001
  ------------------
 1888|     59|}
opj_jp2_end_decompress:
 2106|     27|{
 2107|       |    /* preconditions */
 2108|     27|    assert(jp2 != 00);
 2109|     27|    assert(cio != 00);
 2110|     27|    assert(p_manager != 00);
 2111|       |
 2112|       |    /* customization of the end encoding */
 2113|     27|    if (! opj_jp2_setup_end_header_reading(jp2, p_manager)) {
  ------------------
  |  Branch (2113:9): [True: 0, False: 27]
  ------------------
 2114|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2115|      0|    }
 2116|       |
 2117|       |    /* write header */
 2118|     27|    if (! opj_jp2_exec(jp2, jp2->m_procedure_list, cio, p_manager)) {
  ------------------
  |  Branch (2118:9): [True: 0, False: 27]
  ------------------
 2119|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2120|      0|    }
 2121|       |
 2122|     27|    return opj_j2k_end_decompress(jp2->j2k, cio, p_manager);
 2123|     27|}
opj_jp2_read_header:
 2835|     59|{
 2836|     59|    int ret;
 2837|       |
 2838|       |    /* preconditions */
 2839|     59|    assert(jp2 != 00);
 2840|     59|    assert(p_stream != 00);
 2841|     59|    assert(p_manager != 00);
 2842|       |
 2843|       |    /* customization of the validation */
 2844|     59|    if (! opj_jp2_setup_decoding_validation(jp2, p_manager)) {
  ------------------
  |  Branch (2844:9): [True: 0, False: 59]
  ------------------
 2845|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2846|      0|    }
 2847|       |
 2848|       |    /* customization of the encoding */
 2849|     59|    if (! opj_jp2_setup_header_reading(jp2, p_manager)) {
  ------------------
  |  Branch (2849:9): [True: 0, False: 59]
  ------------------
 2850|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2851|      0|    }
 2852|       |
 2853|       |    /* validation of the parameters codec */
 2854|     59|    if (! opj_jp2_exec(jp2, jp2->m_validation_list, p_stream, p_manager)) {
  ------------------
  |  Branch (2854:9): [True: 0, False: 59]
  ------------------
 2855|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2856|      0|    }
 2857|       |
 2858|       |    /* read header */
 2859|     59|    if (! opj_jp2_exec(jp2, jp2->m_procedure_list, p_stream, p_manager)) {
  ------------------
  |  Branch (2859:9): [True: 3, False: 56]
  ------------------
 2860|      3|        return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 2861|      3|    }
 2862|     56|    if (jp2->has_jp2h == 0) {
  ------------------
  |  Branch (2862:9): [True: 16, False: 40]
  ------------------
 2863|     16|        opj_event_msg(p_manager, EVT_ERROR, "JP2H box missing. Required.\n");
  ------------------
  |  |   66|     16|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2864|     16|        return OPJ_FALSE;
  ------------------
  |  |  118|     16|#define OPJ_FALSE 0
  ------------------
 2865|     16|    }
 2866|     40|    if (jp2->has_ihdr == 0) {
  ------------------
  |  Branch (2866:9): [True: 0, False: 40]
  ------------------
 2867|      0|        opj_event_msg(p_manager, EVT_ERROR, "IHDR box_missing. Required.\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2868|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2869|      0|    }
 2870|       |
 2871|     40|    ret = opj_j2k_read_header(p_stream,
 2872|     40|                              jp2->j2k,
 2873|     40|                              p_image,
 2874|     40|                              p_manager);
 2875|       |
 2876|     40|    if (p_image && *p_image) {
  ------------------
  |  Branch (2876:9): [True: 40, False: 0]
  |  Branch (2876:20): [True: 27, False: 13]
  ------------------
 2877|       |        /* Set Image Color Space */
 2878|     27|        if (jp2->enumcs == 16) {
  ------------------
  |  Branch (2878:13): [True: 0, False: 27]
  ------------------
 2879|      0|            (*p_image)->color_space = OPJ_CLRSPC_SRGB;
 2880|     27|        } else if (jp2->enumcs == 17) {
  ------------------
  |  Branch (2880:20): [True: 0, False: 27]
  ------------------
 2881|      0|            (*p_image)->color_space = OPJ_CLRSPC_GRAY;
 2882|     27|        } else if (jp2->enumcs == 18) {
  ------------------
  |  Branch (2882:20): [True: 0, False: 27]
  ------------------
 2883|      0|            (*p_image)->color_space = OPJ_CLRSPC_SYCC;
 2884|     27|        } else if (jp2->enumcs == 24) {
  ------------------
  |  Branch (2884:20): [True: 0, False: 27]
  ------------------
 2885|      0|            (*p_image)->color_space = OPJ_CLRSPC_EYCC;
 2886|     27|        } else if (jp2->enumcs == 12) {
  ------------------
  |  Branch (2886:20): [True: 0, False: 27]
  ------------------
 2887|      0|            (*p_image)->color_space = OPJ_CLRSPC_CMYK;
 2888|     27|        } else {
 2889|     27|            (*p_image)->color_space = OPJ_CLRSPC_UNKNOWN;
 2890|     27|        }
 2891|       |
 2892|     27|        if (jp2->color.icc_profile_buf) {
  ------------------
  |  Branch (2892:13): [True: 2, False: 25]
  ------------------
 2893|      2|            (*p_image)->icc_profile_buf = jp2->color.icc_profile_buf;
 2894|      2|            (*p_image)->icc_profile_len = jp2->color.icc_profile_len;
 2895|      2|            jp2->color.icc_profile_buf = NULL;
 2896|      2|        }
 2897|     27|    }
 2898|     40|    return ret;
 2899|     40|}
opj_jp2_destroy:
 3034|     59|{
 3035|     59|    if (jp2) {
  ------------------
  |  Branch (3035:9): [True: 59, False: 0]
  ------------------
 3036|       |        /* destroy the J2K codec */
 3037|     59|        opj_j2k_destroy(jp2->j2k);
 3038|     59|        jp2->j2k = 00;
 3039|       |
 3040|     59|        if (jp2->comps) {
  ------------------
  |  Branch (3040:13): [True: 40, False: 19]
  ------------------
 3041|     40|            opj_free(jp2->comps);
 3042|     40|            jp2->comps = 00;
 3043|     40|        }
 3044|       |
 3045|     59|        if (jp2->cl) {
  ------------------
  |  Branch (3045:13): [True: 30, False: 29]
  ------------------
 3046|     30|            opj_free(jp2->cl);
 3047|     30|            jp2->cl = 00;
 3048|     30|        }
 3049|       |
 3050|     59|        if (jp2->color.icc_profile_buf) {
  ------------------
  |  Branch (3050:13): [True: 5, False: 54]
  ------------------
 3051|      5|            opj_free(jp2->color.icc_profile_buf);
 3052|      5|            jp2->color.icc_profile_buf = 00;
 3053|      5|        }
 3054|       |
 3055|     59|        if (jp2->color.jp2_cdef) {
  ------------------
  |  Branch (3055:13): [True: 3, False: 56]
  ------------------
 3056|      3|            if (jp2->color.jp2_cdef->info) {
  ------------------
  |  Branch (3056:17): [True: 3, False: 0]
  ------------------
 3057|      3|                opj_free(jp2->color.jp2_cdef->info);
 3058|      3|                jp2->color.jp2_cdef->info = NULL;
 3059|      3|            }
 3060|       |
 3061|      3|            opj_free(jp2->color.jp2_cdef);
 3062|      3|            jp2->color.jp2_cdef = 00;
 3063|      3|        }
 3064|       |
 3065|     59|        if (jp2->color.jp2_pclr) {
  ------------------
  |  Branch (3065:13): [True: 12, False: 47]
  ------------------
 3066|     12|            if (jp2->color.jp2_pclr->cmap) {
  ------------------
  |  Branch (3066:17): [True: 6, False: 6]
  ------------------
 3067|      6|                opj_free(jp2->color.jp2_pclr->cmap);
 3068|      6|                jp2->color.jp2_pclr->cmap = NULL;
 3069|      6|            }
 3070|     12|            if (jp2->color.jp2_pclr->channel_sign) {
  ------------------
  |  Branch (3070:17): [True: 12, False: 0]
  ------------------
 3071|     12|                opj_free(jp2->color.jp2_pclr->channel_sign);
 3072|     12|                jp2->color.jp2_pclr->channel_sign = NULL;
 3073|     12|            }
 3074|     12|            if (jp2->color.jp2_pclr->channel_size) {
  ------------------
  |  Branch (3074:17): [True: 12, False: 0]
  ------------------
 3075|     12|                opj_free(jp2->color.jp2_pclr->channel_size);
 3076|     12|                jp2->color.jp2_pclr->channel_size = NULL;
 3077|     12|            }
 3078|     12|            if (jp2->color.jp2_pclr->entries) {
  ------------------
  |  Branch (3078:17): [True: 12, False: 0]
  ------------------
 3079|     12|                opj_free(jp2->color.jp2_pclr->entries);
 3080|     12|                jp2->color.jp2_pclr->entries = NULL;
 3081|     12|            }
 3082|       |
 3083|     12|            opj_free(jp2->color.jp2_pclr);
 3084|     12|            jp2->color.jp2_pclr = 00;
 3085|     12|        }
 3086|       |
 3087|     59|        if (jp2->m_validation_list) {
  ------------------
  |  Branch (3087:13): [True: 59, False: 0]
  ------------------
 3088|     59|            opj_procedure_list_destroy(jp2->m_validation_list);
 3089|     59|            jp2->m_validation_list = 00;
 3090|     59|        }
 3091|       |
 3092|     59|        if (jp2->m_procedure_list) {
  ------------------
  |  Branch (3092:13): [True: 59, False: 0]
  ------------------
 3093|     59|            opj_procedure_list_destroy(jp2->m_procedure_list);
 3094|     59|            jp2->m_procedure_list = 00;
 3095|     59|        }
 3096|       |
 3097|     59|        opj_free(jp2);
 3098|     59|    }
 3099|     59|}
opj_jp2_set_decode_area:
 3117|     27|{
 3118|     27|    return opj_j2k_set_decode_area(p_jp2->j2k, p_image, p_start_x, p_start_y,
 3119|     27|                                   p_end_x, p_end_y, p_manager);
 3120|     27|}
opj_jp2_create:
 3150|     59|{
 3151|     59|    opj_jp2_t *jp2 = (opj_jp2_t*)opj_calloc(1, sizeof(opj_jp2_t));
 3152|     59|    if (jp2) {
  ------------------
  |  Branch (3152:9): [True: 59, False: 0]
  ------------------
 3153|       |
 3154|       |        /* create the J2K codec */
 3155|     59|        if (! p_is_decoder) {
  ------------------
  |  Branch (3155:13): [True: 0, False: 59]
  ------------------
 3156|      0|            jp2->j2k = opj_j2k_create_compress();
 3157|     59|        } else {
 3158|     59|            jp2->j2k = opj_j2k_create_decompress();
 3159|     59|        }
 3160|       |
 3161|     59|        if (jp2->j2k == 00) {
  ------------------
  |  Branch (3161:13): [True: 0, False: 59]
  ------------------
 3162|      0|            opj_jp2_destroy(jp2);
 3163|      0|            return 00;
 3164|      0|        }
 3165|       |
 3166|       |        /* Color structure */
 3167|     59|        jp2->color.icc_profile_buf = NULL;
 3168|     59|        jp2->color.icc_profile_len = 0;
 3169|     59|        jp2->color.jp2_cdef = NULL;
 3170|     59|        jp2->color.jp2_pclr = NULL;
 3171|     59|        jp2->color.jp2_has_colr = 0;
 3172|       |
 3173|       |        /* validation list creation */
 3174|     59|        jp2->m_validation_list = opj_procedure_list_create();
 3175|     59|        if (! jp2->m_validation_list) {
  ------------------
  |  Branch (3175:13): [True: 0, False: 59]
  ------------------
 3176|      0|            opj_jp2_destroy(jp2);
 3177|      0|            return 00;
 3178|      0|        }
 3179|       |
 3180|       |        /* execution list creation */
 3181|     59|        jp2->m_procedure_list = opj_procedure_list_create();
 3182|     59|        if (! jp2->m_procedure_list) {
  ------------------
  |  Branch (3182:13): [True: 0, False: 59]
  ------------------
 3183|      0|            opj_jp2_destroy(jp2);
 3184|      0|            return 00;
 3185|      0|        }
 3186|     59|    }
 3187|       |
 3188|     59|    return jp2;
 3189|     59|}
jp2.c:opj_jp2_apply_color_postprocessing:
 1600|      2|{
 1601|      2|    if (jp2->j2k->m_specific_param.m_decoder.m_numcomps_to_decode) {
  ------------------
  |  Branch (1601:9): [True: 0, False: 2]
  ------------------
 1602|       |        /* Bypass all JP2 component transforms */
 1603|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1604|      0|    }
 1605|       |
 1606|      2|    if (!jp2->ignore_pclr_cmap_cdef) {
  ------------------
  |  Branch (1606:9): [True: 2, False: 0]
  ------------------
 1607|      2|        if (!opj_jp2_check_color(p_image, &(jp2->color), p_manager)) {
  ------------------
  |  Branch (1607:13): [True: 0, False: 2]
  ------------------
 1608|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1609|      0|        }
 1610|       |
 1611|      2|        if (jp2->color.jp2_pclr) {
  ------------------
  |  Branch (1611:13): [True: 0, False: 2]
  ------------------
 1612|       |            /* Part 1, I.5.3.4: Either both or none : */
 1613|      0|            if (!jp2->color.jp2_pclr->cmap) {
  ------------------
  |  Branch (1613:17): [True: 0, False: 0]
  ------------------
 1614|      0|                opj_jp2_free_pclr(&(jp2->color));
 1615|      0|            } else {
 1616|      0|                if (!opj_jp2_apply_pclr(p_image, &(jp2->color), p_manager)) {
  ------------------
  |  Branch (1616:21): [True: 0, False: 0]
  ------------------
 1617|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1618|      0|                }
 1619|      0|            }
 1620|      0|        }
 1621|       |
 1622|       |        /* Apply the color space if needed */
 1623|      2|        if (jp2->color.jp2_cdef) {
  ------------------
  |  Branch (1623:13): [True: 0, False: 2]
  ------------------
 1624|      0|            opj_jp2_apply_cdef(p_image, &(jp2->color), p_manager);
 1625|      0|        }
 1626|      2|    }
 1627|       |
 1628|      2|    return OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
 1629|      2|}
jp2.c:opj_jp2_check_color:
  896|      2|{
  897|      2|    OPJ_UINT16 i;
  898|       |
  899|       |    /* testcase 4149.pdf.SIGSEGV.cf7.3501 */
  900|      2|    if (color->jp2_cdef) {
  ------------------
  |  Branch (900:9): [True: 0, False: 2]
  ------------------
  901|      0|        opj_jp2_cdef_info_t *info = color->jp2_cdef->info;
  902|      0|        OPJ_UINT16 n = color->jp2_cdef->n;
  903|      0|        OPJ_UINT32 nr_channels =
  904|      0|            image->numcomps; /* FIXME image->numcomps == jp2->numcomps before color is applied ??? */
  905|       |
  906|       |        /* cdef applies to cmap channels if any */
  907|      0|        if (color->jp2_pclr && color->jp2_pclr->cmap) {
  ------------------
  |  Branch (907:13): [True: 0, False: 0]
  |  Branch (907:32): [True: 0, False: 0]
  ------------------
  908|      0|            nr_channels = (OPJ_UINT32)color->jp2_pclr->nr_channels;
  909|      0|        }
  910|       |
  911|      0|        for (i = 0; i < n; i++) {
  ------------------
  |  Branch (911:21): [True: 0, False: 0]
  ------------------
  912|      0|            if (info[i].cn >= nr_channels) {
  ------------------
  |  Branch (912:17): [True: 0, False: 0]
  ------------------
  913|      0|                opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n",
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  914|      0|                              info[i].cn, nr_channels);
  915|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  916|      0|            }
  917|      0|            if (info[i].asoc == 65535U) {
  ------------------
  |  Branch (917:17): [True: 0, False: 0]
  ------------------
  918|      0|                continue;
  919|      0|            }
  920|       |
  921|      0|            if (info[i].asoc > 0 && (OPJ_UINT32)(info[i].asoc - 1) >= nr_channels) {
  ------------------
  |  Branch (921:17): [True: 0, False: 0]
  |  Branch (921:37): [True: 0, False: 0]
  ------------------
  922|      0|                opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n",
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  923|      0|                              info[i].asoc - 1, nr_channels);
  924|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  925|      0|            }
  926|      0|        }
  927|       |
  928|       |        /* issue 397 */
  929|       |        /* ISO 15444-1 states that if cdef is present, it shall contain a complete list of channel definitions. */
  930|      0|        while (nr_channels > 0) {
  ------------------
  |  Branch (930:16): [True: 0, False: 0]
  ------------------
  931|      0|            for (i = 0; i < n; ++i) {
  ------------------
  |  Branch (931:25): [True: 0, False: 0]
  ------------------
  932|      0|                if ((OPJ_UINT32)info[i].cn == (nr_channels - 1U)) {
  ------------------
  |  Branch (932:21): [True: 0, False: 0]
  ------------------
  933|      0|                    break;
  934|      0|                }
  935|      0|            }
  936|      0|            if (i == n) {
  ------------------
  |  Branch (936:17): [True: 0, False: 0]
  ------------------
  937|      0|                opj_event_msg(p_manager, EVT_ERROR, "Incomplete channel definitions.\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  938|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  939|      0|            }
  940|      0|            --nr_channels;
  941|      0|        }
  942|      0|    }
  943|       |
  944|       |    /* testcases 451.pdf.SIGSEGV.f4c.3723, 451.pdf.SIGSEGV.5b5.3723 and
  945|       |       66ea31acbb0f23a2bbc91f64d69a03f5_signal_sigsegv_13937c0_7030_5725.pdf */
  946|      2|    if (color->jp2_pclr && color->jp2_pclr->cmap) {
  ------------------
  |  Branch (946:9): [True: 0, False: 2]
  |  Branch (946:28): [True: 0, False: 0]
  ------------------
  947|      0|        OPJ_UINT16 nr_channels = color->jp2_pclr->nr_channels;
  948|      0|        opj_jp2_cmap_comp_t *cmap = color->jp2_pclr->cmap;
  949|      0|        OPJ_BOOL *pcol_usage, is_sane = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
  950|       |
  951|       |        /* verify that all original components match an existing one */
  952|      0|        for (i = 0; i < nr_channels; i++) {
  ------------------
  |  Branch (952:21): [True: 0, False: 0]
  ------------------
  953|      0|            if (cmap[i].cmp >= image->numcomps) {
  ------------------
  |  Branch (953:17): [True: 0, False: 0]
  ------------------
  954|      0|                opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n",
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  955|      0|                              cmap[i].cmp, image->numcomps);
  956|      0|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  957|      0|            }
  958|      0|        }
  959|       |
  960|      0|        pcol_usage = (OPJ_BOOL *) opj_calloc(nr_channels, sizeof(OPJ_BOOL));
  961|      0|        if (!pcol_usage) {
  ------------------
  |  Branch (961:13): [True: 0, False: 0]
  ------------------
  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|      0|        for (i = 0; i < nr_channels; i++) {
  ------------------
  |  Branch (966:21): [True: 0, False: 0]
  ------------------
  967|      0|            OPJ_BYTE mtyp = cmap[i].mtyp;
  968|      0|            OPJ_BYTE pcol = cmap[i].pcol;
  969|       |            /* See ISO 15444-1 Table I.14 – MTYPi field values */
  970|      0|            if (mtyp != 0 && mtyp != 1) {
  ------------------
  |  Branch (970:17): [True: 0, False: 0]
  |  Branch (970:30): [True: 0, False: 0]
  ------------------
  971|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  972|      0|                              "Invalid value for cmap[%d].mtyp = %d.\n", i,
  973|      0|                              mtyp);
  974|      0|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  975|      0|            } else if (pcol >= nr_channels) {
  ------------------
  |  Branch (975:24): [True: 0, False: 0]
  ------------------
  976|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  977|      0|                              "Invalid component/palette index for direct mapping %d.\n", pcol);
  978|      0|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  979|      0|            } else if (pcol_usage[pcol] && mtyp == 1) {
  ------------------
  |  Branch (979:24): [True: 0, False: 0]
  |  Branch (979:44): [True: 0, False: 0]
  ------------------
  980|      0|                opj_event_msg(p_manager, EVT_ERROR, "Component %d is mapped twice.\n", pcol);
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  981|      0|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  982|      0|            } else if (mtyp == 0 && pcol != 0) {
  ------------------
  |  Branch (982:24): [True: 0, False: 0]
  |  Branch (982:37): [True: 0, False: 0]
  ------------------
  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|      0|                opj_event_msg(p_manager, EVT_ERROR, "Direct use at #%d however pcol=%d.\n", i,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  986|      0|                              pcol);
  987|      0|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  988|      0|            } else if (mtyp == 1 && pcol != i) {
  ------------------
  |  Branch (988:24): [True: 0, False: 0]
  |  Branch (988:37): [True: 0, False: 0]
  ------------------
  989|       |                /* OpenJPEG implementation limitation. See assert(i == pcol); */
  990|       |                /* in opj_jp2_apply_pclr() */
  991|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  992|      0|                              "Implementation limitation: for palette mapping, "
  993|      0|                              "pcol[%d] should be equal to %d, but is equal "
  994|      0|                              "to %d.\n", i, i, pcol);
  995|      0|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  996|      0|            } else {
  997|      0|                pcol_usage[pcol] = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
  998|      0|            }
  999|      0|        }
 1000|       |        /* verify that all components are targeted at least once */
 1001|      0|        for (i = 0; i < nr_channels; i++) {
  ------------------
  |  Branch (1001:21): [True: 0, False: 0]
  ------------------
 1002|      0|            if (!pcol_usage[i] && cmap[i].mtyp != 0) {
  ------------------
  |  Branch (1002:17): [True: 0, False: 0]
  |  Branch (1002:35): [True: 0, False: 0]
  ------------------
 1003|      0|                opj_event_msg(p_manager, EVT_ERROR, "Component %d doesn't have a mapping.\n",
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1004|      0|                              i);
 1005|      0|                is_sane = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1006|      0|            }
 1007|      0|        }
 1008|       |        /* Issue 235/447 weird cmap */
 1009|      0|        if (1 && is_sane && (image->numcomps == 1U)) {
  ------------------
  |  Branch (1009:13): [Folded - Ignored]
  |  Branch (1009:18): [True: 0, False: 0]
  |  Branch (1009:29): [True: 0, False: 0]
  ------------------
 1010|      0|            for (i = 0; i < nr_channels; i++) {
  ------------------
  |  Branch (1010:25): [True: 0, False: 0]
  ------------------
 1011|      0|                if (!pcol_usage[i]) {
  ------------------
  |  Branch (1011:21): [True: 0, False: 0]
  ------------------
 1012|      0|                    is_sane = 0U;
 1013|      0|                    opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1014|      0|                                  "Component mapping seems wrong. Trying to correct.\n");
 1015|      0|                    break;
 1016|      0|                }
 1017|      0|            }
 1018|      0|            if (!is_sane) {
  ------------------
  |  Branch (1018:17): [True: 0, False: 0]
  ------------------
 1019|      0|                is_sane = OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1020|      0|                for (i = 0; i < nr_channels; i++) {
  ------------------
  |  Branch (1020:29): [True: 0, False: 0]
  ------------------
 1021|      0|                    cmap[i].mtyp = 1U;
 1022|      0|                    cmap[i].pcol = (OPJ_BYTE) i;
 1023|      0|                }
 1024|      0|            }
 1025|      0|        }
 1026|      0|        opj_free(pcol_usage);
 1027|      0|        if (!is_sane) {
  ------------------
  |  Branch (1027:13): [True: 0, False: 0]
  ------------------
 1028|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1029|      0|        }
 1030|      0|    }
 1031|       |
 1032|      2|    return OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
 1033|      2|}
jp2.c:opj_jp2_setup_end_header_reading:
 2185|     27|{
 2186|       |    /* preconditions */
 2187|     27|    assert(jp2 != 00);
 2188|     27|    assert(p_manager != 00);
 2189|       |
 2190|     27|    if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,
  ------------------
  |  Branch (2190:9): [True: 0, False: 27]
  ------------------
 2191|     27|                                           (opj_procedure)opj_jp2_read_header_procedure, p_manager)) {
 2192|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2193|      0|    }
 2194|       |    /* DEVELOPER CORNER, add your custom procedures */
 2195|       |
 2196|     27|    return OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
 2197|     27|}
jp2.c:opj_jp2_read_header_procedure:
 2260|     86|{
 2261|     86|    opj_jp2_box_t box;
 2262|     86|    OPJ_UINT32 l_nb_bytes_read;
 2263|     86|    const opj_jp2_header_handler_t * l_current_handler;
 2264|     86|    const opj_jp2_header_handler_t * l_current_handler_misplaced;
 2265|     86|    OPJ_UINT32 l_last_data_size = OPJ_BOX_SIZE;
  ------------------
  |  |   45|     86|#define OPJ_BOX_SIZE    1024
  ------------------
 2266|     86|    OPJ_UINT32 l_current_data_size;
 2267|     86|    OPJ_BYTE * l_current_data = 00;
 2268|       |
 2269|       |    /* preconditions */
 2270|     86|    assert(stream != 00);
 2271|     86|    assert(jp2 != 00);
 2272|     86|    assert(p_manager != 00);
 2273|       |
 2274|     86|    l_current_data = (OPJ_BYTE*)opj_calloc(1, l_last_data_size);
 2275|       |
 2276|     86|    if (l_current_data == 00) {
  ------------------
  |  Branch (2276:9): [True: 0, False: 86]
  ------------------
 2277|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2278|      0|                      "Not enough memory to handle jpeg2000 file header\n");
 2279|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2280|      0|    }
 2281|       |
 2282|    305|    while (opj_jp2_read_boxhdr(&box, &l_nb_bytes_read, stream, p_manager)) {
  ------------------
  |  Branch (2282:12): [True: 259, False: 46]
  ------------------
 2283|       |        /* is it the codestream box ? */
 2284|    259|        if (box.type == JP2_JP2C) {
  ------------------
  |  |   54|    259|#define     JP2_JP2C 0x6a703263    /**< Contiguous codestream box */
  ------------------
  |  Branch (2284:13): [True: 35, False: 224]
  ------------------
 2285|     35|            if (jp2->jp2_state & JP2_STATE_HEADER) {
  ------------------
  |  Branch (2285:17): [True: 35, False: 0]
  ------------------
 2286|     35|                jp2->jp2_state |= JP2_STATE_CODESTREAM;
 2287|     35|                opj_free(l_current_data);
 2288|     35|                return OPJ_TRUE;
  ------------------
  |  |  117|     35|#define OPJ_TRUE 1
  ------------------
 2289|     35|            } else {
 2290|      0|                opj_event_msg(p_manager, EVT_ERROR, "bad placed jpeg codestream\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2291|      0|                opj_free(l_current_data);
 2292|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2293|      0|            }
 2294|    224|        } else if (box.length == 0) {
  ------------------
  |  Branch (2294:20): [True: 0, False: 224]
  ------------------
 2295|      0|            opj_event_msg(p_manager, EVT_ERROR, "Cannot handle box of undefined sizes\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2296|      0|            opj_free(l_current_data);
 2297|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2298|      0|        }
 2299|       |        /* testcase 1851.pdf.SIGSEGV.ce9.948 */
 2300|    224|        else if (box.length < l_nb_bytes_read) {
  ------------------
  |  Branch (2300:18): [True: 0, False: 224]
  ------------------
 2301|      0|            opj_event_msg(p_manager, EVT_ERROR, "invalid box size %d (%x)\n", box.length,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2302|      0|                          box.type);
 2303|      0|            opj_free(l_current_data);
 2304|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2305|      0|        }
 2306|       |
 2307|    224|        l_current_handler = opj_jp2_find_handler(box.type);
 2308|    224|        l_current_handler_misplaced = opj_jp2_img_find_handler(box.type);
 2309|    224|        l_current_data_size = box.length - l_nb_bytes_read;
 2310|       |
 2311|    224|        if ((l_current_handler != 00) || (l_current_handler_misplaced != 00)) {
  ------------------
  |  Branch (2311:13): [True: 132, False: 92]
  |  Branch (2311:42): [True: 60, False: 32]
  ------------------
 2312|    192|            if (l_current_handler == 00) {
  ------------------
  |  Branch (2312:17): [True: 60, False: 132]
  ------------------
 2313|     60|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|     60|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2314|     60|                              "Found a misplaced '%c%c%c%c' box outside jp2h box\n",
 2315|     60|                              (OPJ_BYTE)(box.type >> 24), (OPJ_BYTE)(box.type >> 16),
 2316|     60|                              (OPJ_BYTE)(box.type >> 8), (OPJ_BYTE)(box.type >> 0));
 2317|     60|                if (jp2->jp2_state & JP2_STATE_HEADER) {
  ------------------
  |  Branch (2317:21): [True: 31, False: 29]
  ------------------
 2318|       |                    /* read anyway, we already have jp2h */
 2319|     31|                    l_current_handler = l_current_handler_misplaced;
 2320|     31|                } else {
 2321|     29|                    opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|     29|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2322|     29|                                  "JPEG2000 Header box not read yet, '%c%c%c%c' box will be ignored\n",
 2323|     29|                                  (OPJ_BYTE)(box.type >> 24), (OPJ_BYTE)(box.type >> 16),
 2324|     29|                                  (OPJ_BYTE)(box.type >> 8), (OPJ_BYTE)(box.type >> 0));
 2325|     29|                    jp2->jp2_state |= JP2_STATE_UNKNOWN;
 2326|     29|                    if (opj_stream_skip(stream, l_current_data_size,
  ------------------
  |  Branch (2326:25): [True: 0, False: 29]
  ------------------
 2327|     29|                                        p_manager) != l_current_data_size) {
 2328|      0|                        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2329|      0|                                      "Problem with skipping JPEG2000 box, stream error\n");
 2330|      0|                        opj_free(l_current_data);
 2331|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2332|      0|                    }
 2333|     29|                    continue;
 2334|     29|                }
 2335|     60|            }
 2336|    163|            if ((OPJ_OFF_T)l_current_data_size > opj_stream_get_number_byte_left(stream)) {
  ------------------
  |  Branch (2336:17): [True: 0, False: 163]
  ------------------
 2337|       |                /* do not even try to malloc if we can't read */
 2338|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2339|      0|                              "Invalid box size %d for box '%c%c%c%c'. Need %d bytes, %d bytes remaining \n",
 2340|      0|                              box.length, (OPJ_BYTE)(box.type >> 24), (OPJ_BYTE)(box.type >> 16),
 2341|      0|                              (OPJ_BYTE)(box.type >> 8), (OPJ_BYTE)(box.type >> 0), l_current_data_size,
 2342|      0|                              (OPJ_UINT32)opj_stream_get_number_byte_left(stream));
 2343|      0|                opj_free(l_current_data);
 2344|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2345|      0|            }
 2346|    163|            if (l_current_data_size > l_last_data_size) {
  ------------------
  |  Branch (2346:17): [True: 18, False: 145]
  ------------------
 2347|     18|                OPJ_BYTE* new_current_data = (OPJ_BYTE*)opj_realloc(l_current_data,
 2348|     18|                                             l_current_data_size);
 2349|     18|                if (!new_current_data) {
  ------------------
  |  Branch (2349:21): [True: 0, False: 18]
  ------------------
 2350|      0|                    opj_free(l_current_data);
 2351|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2352|      0|                                  "Not enough memory to handle jpeg2000 box\n");
 2353|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2354|      0|                }
 2355|     18|                l_current_data = new_current_data;
 2356|     18|                l_last_data_size = l_current_data_size;
 2357|     18|            }
 2358|       |
 2359|    163|            l_nb_bytes_read = (OPJ_UINT32)opj_stream_read_data(stream, l_current_data,
 2360|    163|                              l_current_data_size, p_manager);
 2361|    163|            if (l_nb_bytes_read != l_current_data_size) {
  ------------------
  |  Branch (2361:17): [True: 0, False: 163]
  ------------------
 2362|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2363|      0|                              "Problem with reading JPEG2000 box, stream error\n");
 2364|      0|                opj_free(l_current_data);
 2365|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2366|      0|            }
 2367|       |
 2368|    163|            if (! l_current_handler->handler(jp2, l_current_data, l_current_data_size,
  ------------------
  |  Branch (2368:17): [True: 3, False: 160]
  ------------------
 2369|    163|                                             p_manager)) {
 2370|      3|                opj_free(l_current_data);
 2371|      3|                return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 2372|      3|            }
 2373|    163|        } else {
 2374|     32|            if (!(jp2->jp2_state & JP2_STATE_SIGNATURE)) {
  ------------------
  |  Branch (2374:17): [True: 0, False: 32]
  ------------------
 2375|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2376|      0|                              "Malformed JP2 file format: first box must be JPEG 2000 signature box\n");
 2377|      0|                opj_free(l_current_data);
 2378|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2379|      0|            }
 2380|     32|            if (!(jp2->jp2_state & JP2_STATE_FILE_TYPE)) {
  ------------------
  |  Branch (2380:17): [True: 0, False: 32]
  ------------------
 2381|      0|                opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2382|      0|                              "Malformed JP2 file format: second box must be file type box\n");
 2383|      0|                opj_free(l_current_data);
 2384|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2385|      0|            }
 2386|     32|            jp2->jp2_state |= JP2_STATE_UNKNOWN;
 2387|     32|            if (opj_stream_skip(stream, l_current_data_size,
  ------------------
  |  Branch (2387:17): [True: 2, False: 30]
  ------------------
 2388|     32|                                p_manager) != l_current_data_size) {
 2389|      2|                if (jp2->jp2_state & JP2_STATE_CODESTREAM) {
  ------------------
  |  Branch (2389:21): [True: 2, False: 0]
  ------------------
 2390|       |                    /* If we already read the codestream, do not error out */
 2391|       |                    /* Needed for data/input/nonregression/issue254.jp2 */
 2392|      2|                    opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      2|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2393|      2|                                  "Problem with skipping JPEG2000 box, stream error\n");
 2394|      2|                    opj_free(l_current_data);
 2395|      2|                    return OPJ_TRUE;
  ------------------
  |  |  117|      2|#define OPJ_TRUE 1
  ------------------
 2396|      2|                } else {
 2397|      0|                    opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2398|      0|                                  "Problem with skipping JPEG2000 box, stream error\n");
 2399|      0|                    opj_free(l_current_data);
 2400|      0|                    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2401|      0|                }
 2402|      2|            }
 2403|     32|        }
 2404|    224|    }
 2405|       |
 2406|     46|    opj_free(l_current_data);
 2407|       |
 2408|     46|    return OPJ_TRUE;
  ------------------
  |  |  117|     46|#define OPJ_TRUE 1
  ------------------
 2409|     86|}
jp2.c:opj_jp2_read_boxhdr:
  477|    305|{
  478|       |    /* read header from file */
  479|    305|    OPJ_BYTE l_data_header [8];
  480|       |
  481|       |    /* preconditions */
  482|    305|    assert(cio != 00);
  483|    305|    assert(box != 00);
  484|    305|    assert(p_number_bytes_read != 00);
  485|    305|    assert(p_manager != 00);
  486|       |
  487|    305|    *p_number_bytes_read = (OPJ_UINT32)opj_stream_read_data(cio, l_data_header, 8,
  488|    305|                           p_manager);
  489|    305|    if (*p_number_bytes_read != 8) {
  ------------------
  |  Branch (489:9): [True: 42, False: 263]
  ------------------
  490|     42|        return OPJ_FALSE;
  ------------------
  |  |  118|     42|#define OPJ_FALSE 0
  ------------------
  491|     42|    }
  492|       |
  493|       |    /* process read data */
  494|    263|    opj_read_bytes(l_data_header, &(box->length), 4);
  ------------------
  |  |   65|    263|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  495|    263|    opj_read_bytes(l_data_header + 4, &(box->type), 4);
  ------------------
  |  |   65|    263|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  496|       |
  497|    263|    if (box->length == 0) { /* last box */
  ------------------
  |  Branch (497:9): [True: 27, False: 236]
  ------------------
  498|     27|        const OPJ_OFF_T bleft = opj_stream_get_number_byte_left(cio);
  499|     27|        if (bleft > (OPJ_OFF_T)(0xFFFFFFFFU - 8U)) {
  ------------------
  |  Branch (499:13): [True: 0, False: 27]
  ------------------
  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|     27|        box->length = (OPJ_UINT32)bleft + 8U;
  505|     27|        assert((OPJ_OFF_T)box->length == bleft + 8);
  506|     27|        return OPJ_TRUE;
  ------------------
  |  |  117|     27|#define OPJ_TRUE 1
  ------------------
  507|     27|    }
  508|       |
  509|       |    /* do we have a "special very large box ?" */
  510|       |    /* read then the XLBox */
  511|    236|    if (box->length == 1) {
  ------------------
  |  Branch (511:9): [True: 4, False: 232]
  ------------------
  512|      4|        OPJ_UINT32 l_xl_part_size;
  513|       |
  514|      4|        OPJ_UINT32 l_nb_bytes_read = (OPJ_UINT32)opj_stream_read_data(cio,
  515|      4|                                     l_data_header, 8, p_manager);
  516|      4|        if (l_nb_bytes_read != 8) {
  ------------------
  |  Branch (516:13): [True: 0, False: 4]
  ------------------
  517|      0|            if (l_nb_bytes_read > 0) {
  ------------------
  |  Branch (517:17): [True: 0, False: 0]
  ------------------
  518|      0|                *p_number_bytes_read += l_nb_bytes_read;
  519|      0|            }
  520|       |
  521|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  522|      0|        }
  523|       |
  524|      4|        *p_number_bytes_read = 16;
  525|      4|        opj_read_bytes(l_data_header, &l_xl_part_size, 4);
  ------------------
  |  |   65|      4|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  526|      4|        if (l_xl_part_size != 0) {
  ------------------
  |  Branch (526:13): [True: 4, False: 0]
  ------------------
  527|      4|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      4|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  528|      4|                          "Cannot handle box sizes higher than 2^32\n");
  529|      4|            return OPJ_FALSE;
  ------------------
  |  |  118|      4|#define OPJ_FALSE 0
  ------------------
  530|      4|        }
  531|      0|        opj_read_bytes(l_data_header + 4, &(box->length), 4);
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  532|      0|    }
  533|    232|    return OPJ_TRUE;
  ------------------
  |  |  117|    232|#define OPJ_TRUE 1
  ------------------
  534|    236|}
jp2.c:opj_jp2_find_handler:
 2488|    224|{
 2489|    224|    OPJ_UINT32 i, l_handler_size = sizeof(jp2_header) / sizeof(
 2490|    224|                                       opj_jp2_header_handler_t);
 2491|       |
 2492|    616|    for (i = 0; i < l_handler_size; ++i) {
  ------------------
  |  Branch (2492:17): [True: 524, False: 92]
  ------------------
 2493|    524|        if (jp2_header[i].id == p_id) {
  ------------------
  |  Branch (2493:13): [True: 132, False: 392]
  ------------------
 2494|    132|            return &jp2_header[i];
 2495|    132|        }
 2496|    524|    }
 2497|     92|    return NULL;
 2498|    224|}
jp2.c:opj_jp2_read_jp:
 2537|     59|{
 2538|     59|    OPJ_UINT32 l_magic_number;
 2539|       |
 2540|       |    /* preconditions */
 2541|     59|    assert(p_header_data != 00);
 2542|     59|    assert(jp2 != 00);
 2543|     59|    assert(p_manager != 00);
 2544|       |
 2545|     59|    if (jp2->jp2_state != JP2_STATE_NONE) {
  ------------------
  |  Branch (2545:9): [True: 0, False: 59]
  ------------------
 2546|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2547|      0|                      "The signature box must be the first box in the file.\n");
 2548|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2549|      0|    }
 2550|       |
 2551|       |    /* assure length of data is correct (4 -> magic number) */
 2552|     59|    if (p_header_size != 4) {
  ------------------
  |  Branch (2552:9): [True: 0, False: 59]
  ------------------
 2553|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error with JP signature Box size\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2554|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2555|      0|    }
 2556|       |
 2557|       |    /* rearrange data */
 2558|     59|    opj_read_bytes(p_header_data, &l_magic_number, 4);
  ------------------
  |  |   65|     59|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2559|     59|    if (l_magic_number != 0x0d0a870a) {
  ------------------
  |  Branch (2559:9): [True: 0, False: 59]
  ------------------
 2560|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2561|      0|                      "Error with JP Signature : bad magic number\n");
 2562|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2563|      0|    }
 2564|       |
 2565|     59|    jp2->jp2_state |= JP2_STATE_SIGNATURE;
 2566|       |
 2567|     59|    return OPJ_TRUE;
  ------------------
  |  |  117|     59|#define OPJ_TRUE 1
  ------------------
 2568|     59|}
jp2.c:opj_jp2_read_ftyp:
 2585|     30|{
 2586|     30|    OPJ_UINT32 i, l_remaining_bytes;
 2587|       |
 2588|       |    /* preconditions */
 2589|     30|    assert(p_header_data != 00);
 2590|     30|    assert(jp2 != 00);
 2591|     30|    assert(p_manager != 00);
 2592|       |
 2593|     30|    if (jp2->jp2_state != JP2_STATE_SIGNATURE) {
  ------------------
  |  Branch (2593:9): [True: 0, False: 30]
  ------------------
 2594|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2595|      0|                      "The ftyp box must be the second box in the file.\n");
 2596|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2597|      0|    }
 2598|       |
 2599|       |    /* assure length of data is correct */
 2600|     30|    if (p_header_size < 8) {
  ------------------
  |  Branch (2600:9): [True: 0, False: 30]
  ------------------
 2601|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error with FTYP signature Box size\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2602|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2603|      0|    }
 2604|       |
 2605|     30|    opj_read_bytes(p_header_data, &jp2->brand, 4);      /* BR */
  ------------------
  |  |   65|     30|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2606|     30|    p_header_data += 4;
 2607|       |
 2608|     30|    opj_read_bytes(p_header_data, &jp2->minversion, 4);     /* MinV */
  ------------------
  |  |   65|     30|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2609|     30|    p_header_data += 4;
 2610|       |
 2611|     30|    l_remaining_bytes = p_header_size - 8;
 2612|       |
 2613|       |    /* the number of remaining bytes should be a multiple of 4 */
 2614|     30|    if ((l_remaining_bytes & 0x3) != 0) {
  ------------------
  |  Branch (2614:9): [True: 0, False: 30]
  ------------------
 2615|      0|        opj_event_msg(p_manager, EVT_ERROR, "Error with FTYP signature Box size\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2616|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2617|      0|    }
 2618|       |
 2619|       |    /* div by 4 */
 2620|     30|    jp2->numcl = l_remaining_bytes >> 2;
 2621|     30|    if (jp2->numcl) {
  ------------------
  |  Branch (2621:9): [True: 30, False: 0]
  ------------------
 2622|     30|        jp2->cl = (OPJ_UINT32 *) opj_calloc(jp2->numcl, sizeof(OPJ_UINT32));
 2623|     30|        if (jp2->cl == 00) {
  ------------------
  |  Branch (2623:13): [True: 0, False: 30]
  ------------------
 2624|      0|            opj_event_msg(p_manager, EVT_ERROR, "Not enough memory with FTYP Box\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2625|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2626|      0|        }
 2627|     30|    }
 2628|       |
 2629|     60|    for (i = 0; i < jp2->numcl; ++i) {
  ------------------
  |  Branch (2629:17): [True: 30, False: 30]
  ------------------
 2630|     30|        opj_read_bytes(p_header_data, &jp2->cl[i], 4);      /* CLi */
  ------------------
  |  |   65|     30|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2631|     30|        p_header_data += 4;
 2632|     30|    }
 2633|       |
 2634|     30|    jp2->jp2_state |= JP2_STATE_FILE_TYPE;
 2635|       |
 2636|     30|    return OPJ_TRUE;
  ------------------
  |  |  117|     30|#define OPJ_TRUE 1
  ------------------
 2637|     30|}
jp2.c:opj_jp2_read_jp2h:
 2690|     43|{
 2691|     43|    OPJ_UINT32 l_box_size = 0, l_current_data_size = 0;
 2692|     43|    opj_jp2_box_t box;
 2693|     43|    const opj_jp2_header_handler_t * l_current_handler;
 2694|     43|    OPJ_BOOL l_has_ihdr = 0;
 2695|       |
 2696|       |    /* preconditions */
 2697|     43|    assert(p_header_data != 00);
 2698|     43|    assert(jp2 != 00);
 2699|     43|    assert(p_manager != 00);
 2700|       |
 2701|       |    /* make sure the box is well placed */
 2702|     43|    if ((jp2->jp2_state & JP2_STATE_FILE_TYPE) != JP2_STATE_FILE_TYPE) {
  ------------------
  |  Branch (2702:9): [True: 0, False: 43]
  ------------------
 2703|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2704|      0|                      "The  box must be the first box in the file.\n");
 2705|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2706|      0|    }
 2707|       |
 2708|     43|    jp2->jp2_img_state = JP2_IMG_STATE_NONE;
 2709|       |
 2710|       |    /* iterate while remaining data */
 2711|    144|    while (p_header_size > 0) {
  ------------------
  |  Branch (2711:12): [True: 104, False: 40]
  ------------------
 2712|       |
 2713|    104|        if (! opj_jp2_read_boxhdr_char(&box, p_header_data, &l_box_size, p_header_size,
  ------------------
  |  Branch (2713:13): [True: 0, False: 104]
  ------------------
 2714|    104|                                       p_manager)) {
 2715|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2716|      0|                          "Stream error while reading JP2 Header box\n");
 2717|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2718|      0|        }
 2719|       |
 2720|    104|        if (box.length > p_header_size) {
  ------------------
  |  Branch (2720:13): [True: 3, False: 101]
  ------------------
 2721|      3|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      3|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2722|      3|                          "Stream error while reading JP2 Header box: box length is inconsistent.\n");
 2723|      3|            return OPJ_FALSE;
  ------------------
  |  |  118|      3|#define OPJ_FALSE 0
  ------------------
 2724|      3|        }
 2725|       |
 2726|    101|        l_current_handler = opj_jp2_img_find_handler(box.type);
 2727|    101|        l_current_data_size = box.length - l_box_size;
 2728|    101|        p_header_data += l_box_size;
 2729|       |
 2730|    101|        if (l_current_handler != 00) {
  ------------------
  |  Branch (2730:13): [True: 50, False: 51]
  ------------------
 2731|     50|            if (! l_current_handler->handler(jp2, p_header_data, l_current_data_size,
  ------------------
  |  Branch (2731:17): [True: 0, False: 50]
  ------------------
 2732|     50|                                             p_manager)) {
 2733|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2734|      0|            }
 2735|     51|        } else {
 2736|     51|            jp2->jp2_img_state |= JP2_IMG_STATE_UNKNOWN;
 2737|     51|        }
 2738|       |
 2739|    101|        if (box.type == JP2_IHDR) {
  ------------------
  |  |   52|    101|#define     JP2_IHDR 0x69686472    /**< Image header box */
  ------------------
  |  Branch (2739:13): [True: 41, False: 60]
  ------------------
 2740|     41|            l_has_ihdr = 1;
 2741|     41|        }
 2742|       |
 2743|    101|        p_header_data += l_current_data_size;
 2744|    101|        p_header_size -= box.length;
 2745|    101|    }
 2746|       |
 2747|     40|    if (l_has_ihdr == 0) {
  ------------------
  |  Branch (2747:9): [True: 0, False: 40]
  ------------------
 2748|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2749|      0|                      "Stream error while reading JP2 Header box: no 'ihdr' box.\n");
 2750|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2751|      0|    }
 2752|       |
 2753|     40|    jp2->jp2_state |= JP2_STATE_HEADER;
 2754|     40|    jp2->has_jp2h = 1;
 2755|       |
 2756|     40|    return OPJ_TRUE;
  ------------------
  |  |  117|     40|#define OPJ_TRUE 1
  ------------------
 2757|     40|}
jp2.c:opj_jp2_read_boxhdr_char:
 2765|    104|{
 2766|    104|    OPJ_UINT32 l_value;
 2767|       |
 2768|       |    /* preconditions */
 2769|    104|    assert(p_data != 00);
 2770|    104|    assert(box != 00);
 2771|    104|    assert(p_number_bytes_read != 00);
 2772|    104|    assert(p_manager != 00);
 2773|       |
 2774|    104|    if (p_box_max_size < 8) {
  ------------------
  |  Branch (2774:9): [True: 0, False: 104]
  ------------------
 2775|      0|        opj_event_msg(p_manager, EVT_ERROR, "Cannot handle box of less than 8 bytes\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2776|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2777|      0|    }
 2778|       |
 2779|       |    /* process read data */
 2780|    104|    opj_read_bytes(p_data, &l_value, 4);
  ------------------
  |  |   65|    104|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2781|    104|    p_data += 4;
 2782|    104|    box->length = (OPJ_UINT32)(l_value);
 2783|       |
 2784|    104|    opj_read_bytes(p_data, &l_value, 4);
  ------------------
  |  |   65|    104|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2785|    104|    p_data += 4;
 2786|    104|    box->type = (OPJ_UINT32)(l_value);
 2787|       |
 2788|    104|    *p_number_bytes_read = 8;
 2789|       |
 2790|       |    /* do we have a "special very large box ?" */
 2791|       |    /* read then the XLBox */
 2792|    104|    if (box->length == 1) {
  ------------------
  |  Branch (2792:9): [True: 9, False: 95]
  ------------------
 2793|      9|        OPJ_UINT32 l_xl_part_size;
 2794|       |
 2795|      9|        if (p_box_max_size < 16) {
  ------------------
  |  Branch (2795:13): [True: 0, False: 9]
  ------------------
 2796|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2797|      0|                          "Cannot handle XL box of less than 16 bytes\n");
 2798|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2799|      0|        }
 2800|       |
 2801|      9|        opj_read_bytes(p_data, &l_xl_part_size, 4);
  ------------------
  |  |   65|      9|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2802|      9|        p_data += 4;
 2803|      9|        *p_number_bytes_read += 4;
 2804|       |
 2805|      9|        if (l_xl_part_size != 0) {
  ------------------
  |  Branch (2805:13): [True: 0, False: 9]
  ------------------
 2806|      0|            opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2807|      0|                          "Cannot handle box sizes higher than 2^32\n");
 2808|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2809|      0|        }
 2810|       |
 2811|      9|        opj_read_bytes(p_data, &l_value, 4);
  ------------------
  |  |   65|      9|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 2812|      9|        *p_number_bytes_read += 4;
 2813|      9|        box->length = (OPJ_UINT32)(l_value);
 2814|       |
 2815|      9|        if (box->length == 0) {
  ------------------
  |  Branch (2815:13): [True: 0, False: 9]
  ------------------
 2816|      0|            opj_event_msg(p_manager, EVT_ERROR, "Cannot handle box of undefined sizes\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2817|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2818|      0|        }
 2819|     95|    } else if (box->length == 0) {
  ------------------
  |  Branch (2819:16): [True: 0, False: 95]
  ------------------
 2820|      0|        opj_event_msg(p_manager, EVT_ERROR, "Cannot handle box of undefined sizes\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2821|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2822|      0|    }
 2823|    104|    if (box->length < *p_number_bytes_read) {
  ------------------
  |  Branch (2823:9): [True: 0, False: 104]
  ------------------
 2824|      0|        opj_event_msg(p_manager, EVT_ERROR, "Box length is inconsistent.\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 2825|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2826|      0|    }
 2827|    104|    return OPJ_TRUE;
  ------------------
  |  |  117|    104|#define OPJ_TRUE 1
  ------------------
 2828|    104|}
jp2.c:opj_jp2_img_find_handler:
 2509|    325|{
 2510|    325|    OPJ_UINT32 i, l_handler_size = sizeof(jp2_img_header) / sizeof(
 2511|    325|                                       opj_jp2_header_handler_t);
 2512|  1.81k|    for (i = 0; i < l_handler_size; ++i) {
  ------------------
  |  Branch (2512:17): [True: 1.60k, False: 215]
  ------------------
 2513|  1.60k|        if (jp2_img_header[i].id == p_id) {
  ------------------
  |  Branch (2513:13): [True: 110, False: 1.49k]
  ------------------
 2514|    110|            return &jp2_img_header[i];
 2515|    110|        }
 2516|  1.60k|    }
 2517|       |
 2518|    215|    return NULL;
 2519|    325|}
jp2.c:opj_jp2_read_ihdr:
  565|     45|{
  566|       |    /* preconditions */
  567|     45|    assert(p_image_header_data != 00);
  568|     45|    assert(jp2 != 00);
  569|     45|    assert(p_manager != 00);
  570|       |
  571|     45|    if (jp2->comps != NULL) {
  ------------------
  |  Branch (571:9): [True: 5, False: 40]
  ------------------
  572|      5|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      5|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
  573|      5|                      "Ignoring ihdr box. First ihdr box already read\n");
  574|      5|        return OPJ_TRUE;
  ------------------
  |  |  117|      5|#define OPJ_TRUE 1
  ------------------
  575|      5|    }
  576|       |
  577|     40|    if (p_image_header_size != 14) {
  ------------------
  |  Branch (577:9): [True: 0, False: 40]
  ------------------
  578|      0|        opj_event_msg(p_manager, EVT_ERROR, "Bad image header box (bad size)\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  579|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  580|      0|    }
  581|       |
  582|     40|    opj_read_bytes(p_image_header_data, &(jp2->h), 4);          /* HEIGHT */
  ------------------
  |  |   65|     40|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  583|     40|    p_image_header_data += 4;
  584|     40|    opj_read_bytes(p_image_header_data, &(jp2->w), 4);          /* WIDTH */
  ------------------
  |  |   65|     40|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  585|     40|    p_image_header_data += 4;
  586|     40|    opj_read_bytes(p_image_header_data, &(jp2->numcomps), 2);   /* NC */
  ------------------
  |  |   65|     40|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  587|     40|    p_image_header_data += 2;
  588|       |
  589|     40|    if (jp2->h < 1 || jp2->w < 1 || jp2->numcomps < 1) {
  ------------------
  |  Branch (589:9): [True: 0, False: 40]
  |  Branch (589:23): [True: 0, False: 40]
  |  Branch (589:37): [True: 0, False: 40]
  ------------------
  590|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  591|      0|                      "Wrong values for: w(%d) h(%d) numcomps(%d) (ihdr)\n",
  592|      0|                      jp2->w, jp2->h, jp2->numcomps);
  593|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  594|      0|    }
  595|     40|    if ((jp2->numcomps - 1U) >=
  ------------------
  |  Branch (595:9): [True: 0, False: 40]
  ------------------
  596|     40|            16384U) { /* unsigned underflow is well defined: 1U <= jp2->numcomps <= 16384U */
  597|      0|        opj_event_msg(p_manager, EVT_ERROR, "Invalid number of components (ihdr)\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
  598|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  599|      0|    }
  600|       |
  601|       |    /* allocate memory for components */
  602|     40|    jp2->comps = (opj_jp2_comps_t*) opj_calloc(jp2->numcomps,
  603|     40|                 sizeof(opj_jp2_comps_t));
  604|     40|    if (jp2->comps == 0) {
  ------------------
  |  Branch (604:9): [True: 0, False: 40]
  ------------------
  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|     40|    opj_read_bytes(p_image_header_data, &(jp2->bpc), 1);        /* BPC */
  ------------------
  |  |   65|     40|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  611|     40|    ++ p_image_header_data;
  612|       |
  613|     40|    opj_read_bytes(p_image_header_data, &(jp2->C), 1);          /* C */
  ------------------
  |  |   65|     40|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  614|     40|    ++ p_image_header_data;
  615|       |
  616|       |    /* Should be equal to 7 cf. chapter about image header box of the norm */
  617|     40|    if (jp2->C != 7) {
  ------------------
  |  Branch (617:9): [True: 18, False: 22]
  ------------------
  618|     18|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|     18|#define EVT_INFO    4   /**< Debug event type */
  ------------------
  619|     18|                      "JP2 IHDR box: compression type indicate that the file is not a conforming JP2 file (%d) \n",
  620|     18|                      jp2->C);
  621|     18|    }
  622|       |
  623|     40|    opj_read_bytes(p_image_header_data, &(jp2->UnkC), 1);       /* UnkC */
  ------------------
  |  |   65|     40|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  624|     40|    ++ p_image_header_data;
  625|     40|    opj_read_bytes(p_image_header_data, &(jp2->IPR), 1);        /* IPR */
  ------------------
  |  |   65|     40|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
  626|     40|    ++ p_image_header_data;
  627|       |
  628|     40|    jp2->j2k->m_cp.allow_different_bit_depth_sign = (jp2->bpc == 255);
  629|     40|    jp2->j2k->ihdr_w = jp2->w;
  630|     40|    jp2->j2k->ihdr_h = jp2->h;
  631|     40|    jp2->has_ihdr = 1;
  632|       |
  633|     40|    return OPJ_TRUE;
  ------------------
  |  |  117|     40|#define OPJ_TRUE 1
  ------------------
  634|     40|}
jp2.c:opj_jp2_read_colr:
 1469|     15|{
 1470|     15|    OPJ_UINT32 l_value;
 1471|       |
 1472|       |    /* preconditions */
 1473|     15|    assert(jp2 != 00);
 1474|     15|    assert(p_colr_header_data != 00);
 1475|     15|    assert(p_manager != 00);
 1476|       |
 1477|     15|    if (p_colr_header_size < 3) {
  ------------------
  |  Branch (1477:9): [True: 0, False: 15]
  ------------------
 1478|      0|        opj_event_msg(p_manager, EVT_ERROR, "Bad COLR header box (bad size)\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1479|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1480|      0|    }
 1481|       |
 1482|       |    /* Part 1, I.5.3.3 : 'A conforming JP2 reader shall ignore all Colour
 1483|       |     * Specification boxes after the first.'
 1484|       |    */
 1485|     15|    if (jp2->color.jp2_has_colr) {
  ------------------
  |  Branch (1485:9): [True: 0, False: 15]
  ------------------
 1486|      0|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|      0|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 1487|      0|                      "A conforming JP2 reader shall ignore all Colour Specification boxes after the first, so we ignore this one.\n");
 1488|      0|        p_colr_header_data += p_colr_header_size;
 1489|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 1490|      0|    }
 1491|       |
 1492|     15|    opj_read_bytes(p_colr_header_data, &jp2->meth, 1);          /* METH */
  ------------------
  |  |   65|     15|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1493|     15|    ++p_colr_header_data;
 1494|       |
 1495|     15|    opj_read_bytes(p_colr_header_data, &jp2->precedence, 1);    /* PRECEDENCE */
  ------------------
  |  |   65|     15|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1496|     15|    ++p_colr_header_data;
 1497|       |
 1498|     15|    opj_read_bytes(p_colr_header_data, &jp2->approx, 1);        /* APPROX */
  ------------------
  |  |   65|     15|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1499|     15|    ++p_colr_header_data;
 1500|       |
 1501|     15|    if (jp2->meth == 1) {
  ------------------
  |  Branch (1501:9): [True: 1, False: 14]
  ------------------
 1502|      1|        if (p_colr_header_size < 7) {
  ------------------
  |  Branch (1502:13): [True: 0, False: 1]
  ------------------
 1503|      0|            opj_event_msg(p_manager, EVT_ERROR, "Bad COLR header box (bad size: %d)\n",
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1504|      0|                          p_colr_header_size);
 1505|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1506|      0|        }
 1507|      1|        if ((p_colr_header_size > 7) &&
  ------------------
  |  Branch (1507:13): [True: 1, False: 0]
  ------------------
 1508|      1|                (jp2->enumcs != 14)) { /* handled below for CIELab) */
  ------------------
  |  Branch (1508:17): [True: 1, False: 0]
  ------------------
 1509|       |            /* testcase Altona_Technical_v20_x4.pdf */
 1510|      1|            opj_event_msg(p_manager, EVT_WARNING, "Bad COLR header box (bad size: %d)\n",
  ------------------
  |  |   67|      1|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1511|      1|                          p_colr_header_size);
 1512|      1|        }
 1513|       |
 1514|      1|        opj_read_bytes(p_colr_header_data, &jp2->enumcs, 4);        /* EnumCS */
  ------------------
  |  |   65|      1|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1515|       |
 1516|      1|        p_colr_header_data += 4;
 1517|       |
 1518|      1|        if (jp2->enumcs == 14) { /* CIELab */
  ------------------
  |  Branch (1518:13): [True: 0, False: 1]
  ------------------
 1519|      0|            OPJ_UINT32 *cielab;
 1520|      0|            OPJ_UINT32 rl, ol, ra, oa, rb, ob, il;
 1521|       |
 1522|      0|            cielab = (OPJ_UINT32*)opj_malloc(9 * sizeof(OPJ_UINT32));
 1523|      0|            if (cielab == NULL) {
  ------------------
  |  Branch (1523:17): [True: 0, False: 0]
  ------------------
 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|      0|            cielab[0] = 14; /* enumcs */
 1528|       |
 1529|       |            /* default values */
 1530|      0|            rl = ra = rb = ol = oa = ob = 0;
 1531|      0|            il = 0x00443530; /* D50 */
 1532|      0|            cielab[1] = 0x44454600;/* DEF */
 1533|       |
 1534|      0|            if (p_colr_header_size == 35) {
  ------------------
  |  Branch (1534:17): [True: 0, False: 0]
  ------------------
 1535|      0|                opj_read_bytes(p_colr_header_data, &rl, 4);
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1536|      0|                p_colr_header_data += 4;
 1537|      0|                opj_read_bytes(p_colr_header_data, &ol, 4);
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1538|      0|                p_colr_header_data += 4;
 1539|      0|                opj_read_bytes(p_colr_header_data, &ra, 4);
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1540|      0|                p_colr_header_data += 4;
 1541|      0|                opj_read_bytes(p_colr_header_data, &oa, 4);
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1542|      0|                p_colr_header_data += 4;
 1543|      0|                opj_read_bytes(p_colr_header_data, &rb, 4);
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1544|      0|                p_colr_header_data += 4;
 1545|      0|                opj_read_bytes(p_colr_header_data, &ob, 4);
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1546|      0|                p_colr_header_data += 4;
 1547|      0|                opj_read_bytes(p_colr_header_data, &il, 4);
  ------------------
  |  |   65|      0|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1548|      0|                p_colr_header_data += 4;
 1549|       |
 1550|      0|                cielab[1] = 0;
 1551|      0|            } else if (p_colr_header_size != 7) {
  ------------------
  |  Branch (1551:24): [True: 0, False: 0]
  ------------------
 1552|      0|                opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 1553|      0|                              "Bad COLR header box (CIELab, bad size: %d)\n", p_colr_header_size);
 1554|      0|            }
 1555|      0|            cielab[2] = rl;
 1556|      0|            cielab[4] = ra;
 1557|      0|            cielab[6] = rb;
 1558|      0|            cielab[3] = ol;
 1559|      0|            cielab[5] = oa;
 1560|      0|            cielab[7] = ob;
 1561|      0|            cielab[8] = il;
 1562|       |
 1563|      0|            jp2->color.icc_profile_buf = (OPJ_BYTE*)cielab;
 1564|      0|            jp2->color.icc_profile_len = 0;
 1565|      0|        }
 1566|      1|        jp2->color.jp2_has_colr = 1;
 1567|     14|    } else if (jp2->meth == 2) {
  ------------------
  |  Branch (1567:16): [True: 7, False: 7]
  ------------------
 1568|       |        /* ICC profile */
 1569|      7|        OPJ_INT32 it_icc_value = 0;
 1570|      7|        OPJ_INT32 icc_len = (OPJ_INT32)p_colr_header_size - 3;
 1571|       |
 1572|      7|        jp2->color.icc_profile_len = (OPJ_UINT32)icc_len;
 1573|      7|        jp2->color.icc_profile_buf = (OPJ_BYTE*) opj_calloc(1, (size_t)icc_len);
 1574|      7|        if (!jp2->color.icc_profile_buf) {
  ------------------
  |  Branch (1574:13): [True: 0, False: 7]
  ------------------
 1575|      0|            jp2->color.icc_profile_len = 0;
 1576|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1577|      0|        }
 1578|       |
 1579|  2.09M|        for (it_icc_value = 0; it_icc_value < icc_len; ++it_icc_value) {
  ------------------
  |  Branch (1579:32): [True: 2.09M, False: 7]
  ------------------
 1580|  2.09M|            opj_read_bytes(p_colr_header_data, &l_value, 1);    /* icc values */
  ------------------
  |  |   65|  2.09M|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1581|  2.09M|            ++p_colr_header_data;
 1582|  2.09M|            jp2->color.icc_profile_buf[it_icc_value] = (OPJ_BYTE) l_value;
 1583|  2.09M|        }
 1584|       |
 1585|      7|        jp2->color.jp2_has_colr = 1;
 1586|      7|    } else if (jp2->meth > 2) {
  ------------------
  |  Branch (1586:16): [True: 7, False: 0]
  ------------------
 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|      7|        opj_event_msg(p_manager, EVT_INFO,
  ------------------
  |  |   68|      7|#define EVT_INFO    4   /**< Debug event type */
  ------------------
 1590|      7|                      "COLR BOX meth value is not a regular value (%d), "
 1591|      7|                      "so we will ignore the entire Colour Specification box. \n", jp2->meth);
 1592|      7|    }
 1593|       |
 1594|     15|    return OPJ_TRUE;
  ------------------
  |  |  117|     15|#define OPJ_TRUE 1
  ------------------
 1595|     15|}
jp2.c:opj_jp2_read_pclr:
 1157|     12|{
 1158|     12|    opj_jp2_pclr_t *jp2_pclr;
 1159|     12|    OPJ_BYTE *channel_size, *channel_sign;
 1160|     12|    OPJ_UINT32 *entries;
 1161|     12|    OPJ_UINT16 nr_entries, nr_channels;
 1162|     12|    OPJ_UINT16 i, j;
 1163|     12|    OPJ_UINT32 l_value;
 1164|     12|    OPJ_BYTE *orig_header_data = p_pclr_header_data;
 1165|       |
 1166|       |    /* preconditions */
 1167|     12|    assert(p_pclr_header_data != 00);
 1168|     12|    assert(jp2 != 00);
 1169|     12|    assert(p_manager != 00);
 1170|     12|    (void)p_pclr_header_size;
 1171|       |
 1172|     12|    if (jp2->color.jp2_pclr) {
  ------------------
  |  Branch (1172:9): [True: 0, False: 12]
  ------------------
 1173|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1174|      0|    }
 1175|       |
 1176|     12|    if (p_pclr_header_size < 3) {
  ------------------
  |  Branch (1176:9): [True: 0, False: 12]
  ------------------
 1177|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1178|      0|    }
 1179|       |
 1180|     12|    opj_read_bytes(p_pclr_header_data, &l_value, 2);    /* NE */
  ------------------
  |  |   65|     12|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1181|     12|    p_pclr_header_data += 2;
 1182|     12|    nr_entries = (OPJ_UINT16) l_value;
 1183|     12|    if ((nr_entries == 0U) || (nr_entries > 1024U)) {
  ------------------
  |  Branch (1183:9): [True: 0, False: 12]
  |  Branch (1183:31): [True: 0, False: 12]
  ------------------
 1184|      0|        opj_event_msg(p_manager, EVT_ERROR, "Invalid PCLR box. Reports %d entries\n",
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1185|      0|                      (int)nr_entries);
 1186|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1187|      0|    }
 1188|       |
 1189|     12|    opj_read_bytes(p_pclr_header_data, &l_value, 1);    /* NPC */
  ------------------
  |  |   65|     12|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1190|     12|    ++p_pclr_header_data;
 1191|     12|    nr_channels = (OPJ_UINT16) l_value;
 1192|     12|    if (nr_channels == 0U) {
  ------------------
  |  Branch (1192:9): [True: 0, False: 12]
  ------------------
 1193|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1194|      0|                      "Invalid PCLR box. Reports 0 palette columns\n");
 1195|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1196|      0|    }
 1197|       |
 1198|     12|    if (p_pclr_header_size < 3 + (OPJ_UINT32)nr_channels) {
  ------------------
  |  Branch (1198:9): [True: 0, False: 12]
  ------------------
 1199|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1200|      0|    }
 1201|       |
 1202|     12|    entries = (OPJ_UINT32*) opj_malloc(sizeof(OPJ_UINT32) * nr_channels *
 1203|     12|                                       nr_entries);
 1204|     12|    if (!entries) {
  ------------------
  |  Branch (1204:9): [True: 0, False: 12]
  ------------------
 1205|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1206|      0|    }
 1207|     12|    channel_size = (OPJ_BYTE*) opj_malloc(nr_channels);
 1208|     12|    if (!channel_size) {
  ------------------
  |  Branch (1208:9): [True: 0, False: 12]
  ------------------
 1209|      0|        opj_free(entries);
 1210|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1211|      0|    }
 1212|     12|    channel_sign = (OPJ_BYTE*) opj_malloc(nr_channels);
 1213|     12|    if (!channel_sign) {
  ------------------
  |  Branch (1213:9): [True: 0, False: 12]
  ------------------
 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|     12|    jp2_pclr = (opj_jp2_pclr_t*)opj_malloc(sizeof(opj_jp2_pclr_t));
 1220|     12|    if (!jp2_pclr) {
  ------------------
  |  Branch (1220:9): [True: 0, False: 12]
  ------------------
 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|     12|    jp2_pclr->channel_sign = channel_sign;
 1228|     12|    jp2_pclr->channel_size = channel_size;
 1229|     12|    jp2_pclr->entries = entries;
 1230|     12|    jp2_pclr->nr_entries = nr_entries;
 1231|     12|    jp2_pclr->nr_channels = (OPJ_BYTE) l_value;
 1232|     12|    jp2_pclr->cmap = NULL;
 1233|       |
 1234|     12|    jp2->color.jp2_pclr = jp2_pclr;
 1235|       |
 1236|     56|    for (i = 0; i < nr_channels; ++i) {
  ------------------
  |  Branch (1236:17): [True: 44, False: 12]
  ------------------
 1237|     44|        opj_read_bytes(p_pclr_header_data, &l_value, 1);    /* Bi */
  ------------------
  |  |   65|     44|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1238|     44|        ++p_pclr_header_data;
 1239|       |
 1240|     44|        channel_size[i] = (OPJ_BYTE)((l_value & 0x7f) + 1);
 1241|     44|        channel_sign[i] = (l_value & 0x80) ? 1 : 0;
  ------------------
  |  Branch (1241:27): [True: 12, False: 32]
  ------------------
 1242|     44|    }
 1243|       |
 1244|    930|    for (j = 0; j < nr_entries; ++j) {
  ------------------
  |  Branch (1244:17): [True: 918, False: 12]
  ------------------
 1245|  1.86k|        for (i = 0; i < nr_channels; ++i) {
  ------------------
  |  Branch (1245:21): [True: 950, False: 918]
  ------------------
 1246|    950|            OPJ_UINT32 bytes_to_read = (OPJ_UINT32)((channel_size[i] + 7) >> 3);
 1247|       |
 1248|    950|            if (bytes_to_read > sizeof(OPJ_UINT32)) {
  ------------------
  |  Branch (1248:17): [True: 918, False: 32]
  ------------------
 1249|    918|                bytes_to_read = sizeof(OPJ_UINT32);
 1250|    918|            }
 1251|    950|            if ((ptrdiff_t)p_pclr_header_size < (ptrdiff_t)(p_pclr_header_data -
  ------------------
  |  Branch (1251:17): [True: 0, False: 950]
  ------------------
 1252|    950|                    orig_header_data) + (ptrdiff_t)bytes_to_read) {
 1253|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1254|      0|            }
 1255|       |
 1256|    950|            opj_read_bytes(p_pclr_header_data, &l_value, bytes_to_read);    /* Cji */
  ------------------
  |  |   65|    950|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1257|    950|            p_pclr_header_data += bytes_to_read;
 1258|    950|            *entries = (OPJ_UINT32) l_value;
 1259|    950|            entries++;
 1260|    950|        }
 1261|    918|    }
 1262|       |
 1263|     12|    return OPJ_TRUE;
  ------------------
  |  |  117|     12|#define OPJ_TRUE 1
  ------------------
 1264|     12|}
jp2.c:opj_jp2_read_cmap:
 1271|      6|{
 1272|      6|    opj_jp2_cmap_comp_t *cmap;
 1273|      6|    OPJ_BYTE i, nr_channels;
 1274|      6|    OPJ_UINT32 l_value;
 1275|       |
 1276|       |    /* preconditions */
 1277|      6|    assert(jp2 != 00);
 1278|      6|    assert(p_cmap_header_data != 00);
 1279|      6|    assert(p_manager != 00);
 1280|      6|    (void)p_cmap_header_size;
 1281|       |
 1282|       |    /* Need nr_channels: */
 1283|      6|    if (jp2->color.jp2_pclr == NULL) {
  ------------------
  |  Branch (1283:9): [True: 0, False: 6]
  ------------------
 1284|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1285|      0|                      "Need to read a PCLR box before the CMAP box.\n");
 1286|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1287|      0|    }
 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|      6|    if (jp2->color.jp2_pclr->cmap) {
  ------------------
  |  Branch (1292:9): [True: 0, False: 6]
  ------------------
 1293|      0|        opj_event_msg(p_manager, EVT_ERROR, "Only one CMAP box is allowed.\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1294|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1295|      0|    }
 1296|       |
 1297|      6|    nr_channels = jp2->color.jp2_pclr->nr_channels;
 1298|      6|    if (p_cmap_header_size < (OPJ_UINT32)nr_channels * 4) {
  ------------------
  |  Branch (1298:9): [True: 0, False: 6]
  ------------------
 1299|      0|        opj_event_msg(p_manager, EVT_ERROR, "Insufficient data for CMAP box.\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1300|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1301|      0|    }
 1302|       |
 1303|      6|    cmap = (opj_jp2_cmap_comp_t*) opj_malloc(nr_channels * sizeof(
 1304|      6|                opj_jp2_cmap_comp_t));
 1305|      6|    if (!cmap) {
  ------------------
  |  Branch (1305:9): [True: 0, False: 6]
  ------------------
 1306|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1307|      0|    }
 1308|       |
 1309|       |
 1310|     44|    for (i = 0; i < nr_channels; ++i) {
  ------------------
  |  Branch (1310:17): [True: 38, False: 6]
  ------------------
 1311|     38|        opj_read_bytes(p_cmap_header_data, &l_value, 2);            /* CMP^i */
  ------------------
  |  |   65|     38|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1312|     38|        p_cmap_header_data += 2;
 1313|     38|        cmap[i].cmp = (OPJ_UINT16) l_value;
 1314|       |
 1315|     38|        opj_read_bytes(p_cmap_header_data, &l_value, 1);            /* MTYP^i */
  ------------------
  |  |   65|     38|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1316|     38|        ++p_cmap_header_data;
 1317|     38|        cmap[i].mtyp = (OPJ_BYTE) l_value;
 1318|       |
 1319|     38|        opj_read_bytes(p_cmap_header_data, &l_value, 1);            /* PCOL^i */
  ------------------
  |  |   65|     38|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1320|     38|        ++p_cmap_header_data;
 1321|     38|        cmap[i].pcol = (OPJ_BYTE) l_value;
 1322|     38|    }
 1323|       |
 1324|      6|    jp2->color.jp2_pclr->cmap = cmap;
 1325|       |
 1326|      6|    return OPJ_TRUE;
  ------------------
  |  |  117|      6|#define OPJ_TRUE 1
  ------------------
 1327|      6|}
jp2.c:opj_jp2_read_cdef:
 1397|      3|{
 1398|      3|    opj_jp2_cdef_info_t *cdef_info;
 1399|      3|    OPJ_UINT16 i;
 1400|      3|    OPJ_UINT32 l_value;
 1401|       |
 1402|       |    /* preconditions */
 1403|      3|    assert(jp2 != 00);
 1404|      3|    assert(p_cdef_header_data != 00);
 1405|      3|    assert(p_manager != 00);
 1406|      3|    (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|      3|    if (jp2->color.jp2_cdef) {
  ------------------
  |  Branch (1410:9): [True: 0, False: 3]
  ------------------
 1411|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1412|      0|    }
 1413|       |
 1414|      3|    if (p_cdef_header_size < 2) {
  ------------------
  |  Branch (1414:9): [True: 0, False: 3]
  ------------------
 1415|      0|        opj_event_msg(p_manager, EVT_ERROR, "Insufficient data for CDEF box.\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1416|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1417|      0|    }
 1418|       |
 1419|      3|    opj_read_bytes(p_cdef_header_data, &l_value, 2);        /* N */
  ------------------
  |  |   65|      3|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1420|      3|    p_cdef_header_data += 2;
 1421|       |
 1422|      3|    if ((OPJ_UINT16)l_value == 0) { /* szukw000: FIXME */
  ------------------
  |  Branch (1422:9): [True: 0, False: 3]
  ------------------
 1423|      0|        opj_event_msg(p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1424|      0|                      "Number of channel description is equal to zero in CDEF box.\n");
 1425|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1426|      0|    }
 1427|       |
 1428|      3|    if (p_cdef_header_size < 2 + (OPJ_UINT32)(OPJ_UINT16)l_value * 6) {
  ------------------
  |  Branch (1428:9): [True: 0, False: 3]
  ------------------
 1429|      0|        opj_event_msg(p_manager, EVT_ERROR, "Insufficient data for CDEF box.\n");
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1430|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1431|      0|    }
 1432|       |
 1433|      3|    cdef_info = (opj_jp2_cdef_info_t*) opj_malloc(l_value * sizeof(
 1434|      3|                    opj_jp2_cdef_info_t));
 1435|      3|    if (!cdef_info) {
  ------------------
  |  Branch (1435:9): [True: 0, False: 3]
  ------------------
 1436|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1437|      0|    }
 1438|       |
 1439|      3|    jp2->color.jp2_cdef = (opj_jp2_cdef_t*)opj_malloc(sizeof(opj_jp2_cdef_t));
 1440|      3|    if (!jp2->color.jp2_cdef) {
  ------------------
  |  Branch (1440:9): [True: 0, False: 3]
  ------------------
 1441|      0|        opj_free(cdef_info);
 1442|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1443|      0|    }
 1444|      3|    jp2->color.jp2_cdef->info = cdef_info;
 1445|      3|    jp2->color.jp2_cdef->n = (OPJ_UINT16) l_value;
 1446|       |
 1447|    381|    for (i = 0; i < jp2->color.jp2_cdef->n; ++i) {
  ------------------
  |  Branch (1447:17): [True: 378, False: 3]
  ------------------
 1448|    378|        opj_read_bytes(p_cdef_header_data, &l_value, 2);            /* Cn^i */
  ------------------
  |  |   65|    378|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1449|    378|        p_cdef_header_data += 2;
 1450|    378|        cdef_info[i].cn = (OPJ_UINT16) l_value;
 1451|       |
 1452|    378|        opj_read_bytes(p_cdef_header_data, &l_value, 2);            /* Typ^i */
  ------------------
  |  |   65|    378|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1453|    378|        p_cdef_header_data += 2;
 1454|    378|        cdef_info[i].typ = (OPJ_UINT16) l_value;
 1455|       |
 1456|    378|        opj_read_bytes(p_cdef_header_data, &l_value, 2);            /* Asoc^i */
  ------------------
  |  |   65|    378|#define opj_read_bytes      opj_read_bytes_LE
  ------------------
 1457|    378|        p_cdef_header_data += 2;
 1458|    378|        cdef_info[i].asoc = (OPJ_UINT16) l_value;
 1459|    378|    }
 1460|       |
 1461|      3|    return OPJ_TRUE;
  ------------------
  |  |  117|      3|#define OPJ_TRUE 1
  ------------------
 1462|      3|}
jp2.c:opj_jp2_exec:
 2427|    145|{
 2428|    145|    OPJ_BOOL(** l_procedure)(opj_jp2_t * jp2, opj_stream_private_t *,
 2429|    145|                             opj_event_mgr_t *) = 00;
 2430|    145|    OPJ_BOOL l_result = OPJ_TRUE;
  ------------------
  |  |  117|    145|#define OPJ_TRUE 1
  ------------------
 2431|    145|    OPJ_UINT32 l_nb_proc, i;
 2432|       |
 2433|       |    /* preconditions */
 2434|    145|    assert(p_procedure_list != 00);
 2435|    145|    assert(jp2 != 00);
 2436|    145|    assert(stream != 00);
 2437|    145|    assert(p_manager != 00);
 2438|       |
 2439|    145|    l_nb_proc = opj_procedure_list_get_nb_procedures(p_procedure_list);
 2440|    145|    l_procedure = (OPJ_BOOL(**)(opj_jp2_t * jp2, opj_stream_private_t *,
 2441|    145|                                opj_event_mgr_t *)) opj_procedure_list_get_first_procedure(p_procedure_list);
 2442|       |
 2443|    231|    for (i = 0; i < l_nb_proc; ++i) {
  ------------------
  |  Branch (2443:17): [True: 86, False: 145]
  ------------------
 2444|     86|        l_result = l_result && (*l_procedure)(jp2, stream, p_manager);
  ------------------
  |  Branch (2444:20): [True: 86, False: 0]
  |  Branch (2444:32): [True: 83, False: 3]
  ------------------
 2445|     86|        ++l_procedure;
 2446|     86|    }
 2447|       |
 2448|       |    /* and clear the procedure list at the end. */
 2449|    145|    opj_procedure_list_clear(p_procedure_list);
 2450|    145|    return l_result;
 2451|    145|}
jp2.c:opj_jp2_setup_decoding_validation:
 2919|     59|{
 2920|       |    /* preconditions */
 2921|     59|    assert(jp2 != 00);
 2922|     59|    assert(p_manager != 00);
 2923|       |
 2924|     59|    OPJ_UNUSED(jp2);
  ------------------
  |  |   47|     59|#define OPJ_UNUSED(x) (void)x
  ------------------
 2925|     59|    OPJ_UNUSED(p_manager);
  ------------------
  |  |   47|     59|#define OPJ_UNUSED(x) (void)x
  ------------------
 2926|       |
 2927|       |    /* DEVELOPER CORNER, add your custom validation procedure */
 2928|       |
 2929|     59|    return OPJ_TRUE;
  ------------------
  |  |  117|     59|#define OPJ_TRUE 1
  ------------------
 2930|     59|}
jp2.c:opj_jp2_setup_header_reading:
 2969|     59|{
 2970|       |    /* preconditions */
 2971|     59|    assert(jp2 != 00);
 2972|     59|    assert(p_manager != 00);
 2973|       |
 2974|     59|    if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,
  ------------------
  |  Branch (2974:9): [True: 0, False: 59]
  ------------------
 2975|     59|                                           (opj_procedure)opj_jp2_read_header_procedure, p_manager)) {
 2976|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2977|      0|    }
 2978|       |
 2979|       |    /* DEVELOPER CORNER, add your custom procedures */
 2980|       |
 2981|     59|    return OPJ_TRUE;
  ------------------
  |  |  117|     59|#define OPJ_TRUE 1
  ------------------
 2982|     59|}

opj_mct_decode_real:
  287|      4|{
  288|      4|    OPJ_SIZE_T i;
  289|      4|#ifdef __SSE__
  290|      4|    __m128 vrv, vgu, vgv, vbu;
  291|      4|    vrv = _mm_set1_ps(1.402f);
  292|      4|    vgu = _mm_set1_ps(0.34413f);
  293|      4|    vgv = _mm_set1_ps(0.71414f);
  294|      4|    vbu = _mm_set1_ps(1.772f);
  295|     28|    for (i = 0; i < (n >> 3); ++i) {
  ------------------
  |  Branch (295:17): [True: 24, False: 4]
  ------------------
  296|     24|        __m128 vy, vu, vv;
  297|     24|        __m128 vr, vg, vb;
  298|       |
  299|     24|        vy = _mm_load_ps(c0);
  300|     24|        vu = _mm_load_ps(c1);
  301|     24|        vv = _mm_load_ps(c2);
  302|     24|        vr = _mm_add_ps(vy, _mm_mul_ps(vv, vrv));
  303|     24|        vg = _mm_sub_ps(_mm_sub_ps(vy, _mm_mul_ps(vu, vgu)), _mm_mul_ps(vv, vgv));
  304|     24|        vb = _mm_add_ps(vy, _mm_mul_ps(vu, vbu));
  305|     24|        _mm_store_ps(c0, vr);
  306|     24|        _mm_store_ps(c1, vg);
  307|     24|        _mm_store_ps(c2, vb);
  308|     24|        c0 += 4;
  309|     24|        c1 += 4;
  310|     24|        c2 += 4;
  311|       |
  312|     24|        vy = _mm_load_ps(c0);
  313|     24|        vu = _mm_load_ps(c1);
  314|     24|        vv = _mm_load_ps(c2);
  315|     24|        vr = _mm_add_ps(vy, _mm_mul_ps(vv, vrv));
  316|     24|        vg = _mm_sub_ps(_mm_sub_ps(vy, _mm_mul_ps(vu, vgu)), _mm_mul_ps(vv, vgv));
  317|     24|        vb = _mm_add_ps(vy, _mm_mul_ps(vu, vbu));
  318|     24|        _mm_store_ps(c0, vr);
  319|     24|        _mm_store_ps(c1, vg);
  320|     24|        _mm_store_ps(c2, vb);
  321|     24|        c0 += 4;
  322|     24|        c1 += 4;
  323|     24|        c2 += 4;
  324|     24|    }
  325|      4|    n &= 7;
  326|      4|#endif
  327|     32|    for (i = 0; i < n; ++i) {
  ------------------
  |  Branch (327:17): [True: 28, False: 4]
  ------------------
  328|     28|        OPJ_FLOAT32 y = c0[i];
  329|     28|        OPJ_FLOAT32 u = c1[i];
  330|     28|        OPJ_FLOAT32 v = c2[i];
  331|     28|        OPJ_FLOAT32 r = y + (v * 1.402f);
  332|     28|        OPJ_FLOAT32 g = y - (u * 0.34413f) - (v * (0.71414f));
  333|     28|        OPJ_FLOAT32 b = y + (u * 1.772f);
  334|     28|        c0[i] = r;
  335|     28|        c1[i] = g;
  336|     28|        c2[i] = b;
  337|     28|    }
  338|      4|}

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

mqc.c:opj_mqc_bytein:
  176|    470|{
  177|    470|    opj_mqc_bytein_macro(mqc, mqc->c, mqc->ct);
  ------------------
  |  |  102|    470|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  103|    470|{ \
  |  |  104|    470|        OPJ_UINT32 l_c;  \
  |  |  105|    470|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  106|    470|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  107|    470|        l_c = *(mqc->bp + 1); \
  |  |  108|    470|        if (*mqc->bp == 0xff) { \
  |  |  ------------------
  |  |  |  Branch (108:13): [True: 189, False: 281]
  |  |  ------------------
  |  |  109|    189|            if (l_c > 0x8f) { \
  |  |  ------------------
  |  |  |  Branch (109:17): [True: 130, False: 59]
  |  |  ------------------
  |  |  110|    130|                c += 0xff00; \
  |  |  111|    130|                ct = 8; \
  |  |  112|    130|                mqc->end_of_byte_stream_counter ++; \
  |  |  113|    130|            } else { \
  |  |  114|     59|                mqc->bp++; \
  |  |  115|     59|                c += l_c << 9; \
  |  |  116|     59|                ct = 7; \
  |  |  117|     59|            } \
  |  |  118|    281|        } else { \
  |  |  119|    281|            mqc->bp++; \
  |  |  120|    281|            c += l_c << 8; \
  |  |  121|    281|            ct = 8; \
  |  |  122|    281|        } \
  |  |  123|    470|}
  ------------------
  178|    470|}

opj_set_info_handler:
   47|     59|{
   48|     59|    opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
   49|     59|    if (! l_codec) {
  ------------------
  |  Branch (49:9): [True: 0, False: 59]
  ------------------
   50|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
   51|      0|    }
   52|       |
   53|     59|    l_codec->m_event_mgr.info_handler = p_callback;
   54|     59|    l_codec->m_event_mgr.m_info_data = p_user_data;
   55|       |
   56|     59|    return OPJ_TRUE;
  ------------------
  |  |  117|     59|#define OPJ_TRUE 1
  ------------------
   57|     59|}
opj_set_warning_handler:
   62|     59|{
   63|     59|    opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
   64|     59|    if (! l_codec) {
  ------------------
  |  Branch (64:9): [True: 0, False: 59]
  ------------------
   65|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
   66|      0|    }
   67|       |
   68|     59|    l_codec->m_event_mgr.warning_handler = p_callback;
   69|     59|    l_codec->m_event_mgr.m_warning_data = p_user_data;
   70|       |
   71|     59|    return OPJ_TRUE;
  ------------------
  |  |  117|     59|#define OPJ_TRUE 1
  ------------------
   72|     59|}
opj_set_error_handler:
   77|     59|{
   78|     59|    opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
   79|     59|    if (! l_codec) {
  ------------------
  |  Branch (79:9): [True: 0, False: 59]
  ------------------
   80|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
   81|      0|    }
   82|       |
   83|     59|    l_codec->m_event_mgr.error_handler = p_callback;
   84|     59|    l_codec->m_event_mgr.m_error_data = p_user_data;
   85|       |
   86|     59|    return OPJ_TRUE;
  ------------------
  |  |  117|     59|#define OPJ_TRUE 1
  ------------------
   87|     59|}
opj_create_decompress:
  185|     59|{
  186|     59|    opj_codec_private_t *l_codec = 00;
  187|       |
  188|     59|    l_codec = (opj_codec_private_t*) opj_calloc(1, sizeof(opj_codec_private_t));
  189|     59|    if (!l_codec) {
  ------------------
  |  Branch (189:9): [True: 0, False: 59]
  ------------------
  190|      0|        return 00;
  191|      0|    }
  192|       |
  193|     59|    l_codec->is_decompressor = 1;
  194|       |
  195|     59|    switch (p_format) {
  196|      0|    case OPJ_CODEC_J2K:
  ------------------
  |  Branch (196:5): [True: 0, False: 59]
  ------------------
  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|     59|    case OPJ_CODEC_JP2:
  ------------------
  |  Branch (286:5): [True: 59, False: 0]
  ------------------
  287|       |        /* get a JP2 decoder handle */
  288|     59|        l_codec->opj_dump_codec = (void (*)(void*, OPJ_INT32, FILE*)) jp2_dump;
  289|       |
  290|     59|        l_codec->opj_get_codec_info = (opj_codestream_info_v2_t* (*)(
  291|     59|                                           void*)) jp2_get_cstr_info;
  292|       |
  293|     59|        l_codec->opj_get_codec_index = (opj_codestream_index_t* (*)(
  294|     59|                                            void*)) jp2_get_cstr_index;
  295|       |
  296|     59|        l_codec->m_codec_data.m_decompression.opj_decode =
  297|     59|            (OPJ_BOOL(*)(void *,
  298|     59|                         struct opj_stream_private *,
  299|     59|                         opj_image_t*,
  300|     59|                         struct opj_event_mgr *)) opj_jp2_decode;
  301|       |
  302|     59|        l_codec->m_codec_data.m_decompression.opj_end_decompress =
  303|     59|            (OPJ_BOOL(*)(void *,
  304|     59|                         struct opj_stream_private *,
  305|     59|                         struct opj_event_mgr *)) opj_jp2_end_decompress;
  306|       |
  307|     59|        l_codec->m_codec_data.m_decompression.opj_read_header =
  308|     59|            (OPJ_BOOL(*)(struct opj_stream_private *,
  309|     59|                         void *,
  310|     59|                         opj_image_t **,
  311|     59|                         struct opj_event_mgr *)) opj_jp2_read_header;
  312|       |
  313|     59|        l_codec->m_codec_data.m_decompression.opj_read_tile_header =
  314|     59|            (OPJ_BOOL(*)(void *,
  315|     59|                         OPJ_UINT32*,
  316|     59|                         OPJ_UINT32*,
  317|     59|                         OPJ_INT32*,
  318|     59|                         OPJ_INT32*,
  319|     59|                         OPJ_INT32 *,
  320|     59|                         OPJ_INT32 *,
  321|     59|                         OPJ_UINT32 *,
  322|     59|                         OPJ_BOOL *,
  323|     59|                         struct opj_stream_private *,
  324|     59|                         struct opj_event_mgr *)) opj_jp2_read_tile_header;
  325|       |
  326|     59|        l_codec->m_codec_data.m_decompression.opj_decode_tile_data =
  327|     59|            (OPJ_BOOL(*)(void *,
  328|     59|                         OPJ_UINT32, OPJ_BYTE*, OPJ_UINT32,
  329|     59|                         struct opj_stream_private *,
  330|     59|                         struct opj_event_mgr *)) opj_jp2_decode_tile;
  331|       |
  332|     59|        l_codec->m_codec_data.m_decompression.opj_destroy = (void (*)(
  333|     59|                    void *))opj_jp2_destroy;
  334|       |
  335|     59|        l_codec->m_codec_data.m_decompression.opj_setup_decoder =
  336|     59|            (void (*)(void *, opj_dparameters_t *)) opj_jp2_setup_decoder;
  337|       |
  338|     59|        l_codec->m_codec_data.m_decompression.opj_decoder_set_strict_mode =
  339|     59|            (void (*)(void *, OPJ_BOOL)) opj_jp2_decoder_set_strict_mode;
  340|       |
  341|     59|        l_codec->m_codec_data.m_decompression.opj_set_decode_area =
  342|     59|            (OPJ_BOOL(*)(void *,
  343|     59|                         opj_image_t*,
  344|     59|                         OPJ_INT32, OPJ_INT32, OPJ_INT32, OPJ_INT32,
  345|     59|                         struct opj_event_mgr *)) opj_jp2_set_decode_area;
  346|       |
  347|     59|        l_codec->m_codec_data.m_decompression.opj_get_decoded_tile =
  348|     59|            (OPJ_BOOL(*)(void *p_codec,
  349|     59|                         opj_stream_private_t *p_cio,
  350|     59|                         opj_image_t *p_image,
  351|     59|                         struct opj_event_mgr * p_manager,
  352|     59|                         OPJ_UINT32 tile_index)) opj_jp2_get_tile;
  353|       |
  354|     59|        l_codec->m_codec_data.m_decompression.opj_set_decoded_resolution_factor =
  355|     59|            (OPJ_BOOL(*)(void * p_codec,
  356|     59|                         OPJ_UINT32 res_factor,
  357|     59|                         opj_event_mgr_t * p_manager)) opj_jp2_set_decoded_resolution_factor;
  358|       |
  359|     59|        l_codec->m_codec_data.m_decompression.opj_set_decoded_components =
  360|     59|            (OPJ_BOOL(*)(void * p_codec,
  361|     59|                         OPJ_UINT32 numcomps,
  362|     59|                         const OPJ_UINT32 * comps_indices,
  363|     59|                         struct opj_event_mgr * p_manager)) opj_jp2_set_decoded_components;
  364|       |
  365|     59|        l_codec->opj_set_threads =
  366|     59|            (OPJ_BOOL(*)(void * p_codec, OPJ_UINT32 num_threads)) opj_jp2_set_threads;
  367|       |
  368|     59|        l_codec->m_codec = opj_jp2_create(OPJ_TRUE);
  ------------------
  |  |  117|     59|#define OPJ_TRUE 1
  ------------------
  369|       |
  370|     59|        if (! l_codec->m_codec) {
  ------------------
  |  Branch (370:13): [True: 0, False: 59]
  ------------------
  371|      0|            opj_free(l_codec);
  372|      0|            return 00;
  373|      0|        }
  374|       |
  375|     59|        break;
  376|     59|    case OPJ_CODEC_UNKNOWN:
  ------------------
  |  Branch (376:5): [True: 0, False: 59]
  ------------------
  377|      0|    case OPJ_CODEC_JPT:
  ------------------
  |  Branch (377:5): [True: 0, False: 59]
  ------------------
  378|      0|    default:
  ------------------
  |  Branch (378:5): [True: 0, False: 59]
  ------------------
  379|      0|        opj_free(l_codec);
  380|      0|        return 00;
  381|     59|    }
  382|       |
  383|     59|    opj_set_default_event_handler(&(l_codec->m_event_mgr));
  384|     59|    return (opj_codec_t*) l_codec;
  385|     59|}
opj_set_default_decoder_parameters:
  389|     59|{
  390|     59|    if (parameters) {
  ------------------
  |  Branch (390:9): [True: 59, False: 0]
  ------------------
  391|     59|        memset(parameters, 0, sizeof(opj_dparameters_t));
  392|       |        /* default decoding parameters */
  393|     59|        parameters->cp_layer = 0;
  394|     59|        parameters->cp_reduce = 0;
  395|       |
  396|     59|        parameters->decod_format = -1;
  397|     59|        parameters->cod_format = -1;
  398|     59|        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|     59|    }
  407|     59|}
opj_setup_decoder:
  424|     59|{
  425|     59|    if (p_codec && parameters) {
  ------------------
  |  Branch (425:9): [True: 59, False: 0]
  |  Branch (425:20): [True: 59, False: 0]
  ------------------
  426|     59|        opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
  427|       |
  428|     59|        if (! l_codec->is_decompressor) {
  ------------------
  |  Branch (428:13): [True: 0, False: 59]
  ------------------
  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|     59|        l_codec->m_codec_data.m_decompression.opj_setup_decoder(l_codec->m_codec,
  435|     59|                parameters);
  436|     59|        return OPJ_TRUE;
  ------------------
  |  |  117|     59|#define OPJ_TRUE 1
  ------------------
  437|     59|    }
  438|      0|    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  439|     59|}
opj_read_header:
  464|     59|{
  465|     59|    if (p_codec && p_stream) {
  ------------------
  |  Branch (465:9): [True: 59, False: 0]
  |  Branch (465:20): [True: 59, False: 0]
  ------------------
  466|     59|        opj_codec_private_t* l_codec = (opj_codec_private_t*) p_codec;
  467|     59|        opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
  468|       |
  469|     59|        if (! l_codec->is_decompressor) {
  ------------------
  |  Branch (469:13): [True: 0, False: 59]
  ------------------
  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|     59|        return l_codec->m_codec_data.m_decompression.opj_read_header(l_stream,
  476|     59|                l_codec->m_codec,
  477|     59|                p_image,
  478|     59|                &(l_codec->m_event_mgr));
  479|     59|    }
  480|       |
  481|      0|    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  482|     59|}
opj_decode:
  517|     27|{
  518|     27|    if (p_codec && p_stream) {
  ------------------
  |  Branch (518:9): [True: 27, False: 0]
  |  Branch (518:20): [True: 27, False: 0]
  ------------------
  519|     27|        opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
  520|     27|        opj_stream_private_t * l_stream = (opj_stream_private_t *) p_stream;
  521|       |
  522|     27|        if (! l_codec->is_decompressor) {
  ------------------
  |  Branch (522:13): [True: 0, False: 27]
  ------------------
  523|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  524|      0|        }
  525|       |
  526|     27|        return l_codec->m_codec_data.m_decompression.opj_decode(l_codec->m_codec,
  527|     27|                l_stream,
  528|     27|                p_image,
  529|     27|                &(l_codec->m_event_mgr));
  530|     27|    }
  531|       |
  532|      0|    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  533|     27|}
opj_set_decode_area:
  540|     27|{
  541|     27|    if (p_codec) {
  ------------------
  |  Branch (541:9): [True: 27, False: 0]
  ------------------
  542|     27|        opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
  543|       |
  544|     27|        if (! l_codec->is_decompressor) {
  ------------------
  |  Branch (544:13): [True: 0, False: 27]
  ------------------
  545|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  546|      0|        }
  547|       |
  548|     27|        return  l_codec->m_codec_data.m_decompression.opj_set_decode_area(
  549|     27|                    l_codec->m_codec,
  550|     27|                    p_image,
  551|     27|                    p_start_x, p_start_y,
  552|     27|                    p_end_x, p_end_y,
  553|     27|                    &(l_codec->m_event_mgr));
  554|     27|    }
  555|      0|    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  556|     27|}
opj_end_decompress:
  926|     27|{
  927|     27|    if (p_codec && p_stream) {
  ------------------
  |  Branch (927:9): [True: 27, False: 0]
  |  Branch (927:20): [True: 27, False: 0]
  ------------------
  928|     27|        opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
  929|     27|        opj_stream_private_t * l_stream = (opj_stream_private_t *) p_stream;
  930|       |
  931|     27|        if (! l_codec->is_decompressor) {
  ------------------
  |  Branch (931:13): [True: 0, False: 27]
  ------------------
  932|      0|            return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  933|      0|        }
  934|       |
  935|     27|        return l_codec->m_codec_data.m_decompression.opj_end_decompress(
  936|     27|                   l_codec->m_codec,
  937|     27|                   l_stream,
  938|     27|                   &(l_codec->m_event_mgr));
  939|     27|    }
  940|       |
  941|      0|    return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  942|     27|}
opj_destroy_codec:
 1002|     59|{
 1003|     59|    if (p_codec) {
  ------------------
  |  Branch (1003:9): [True: 59, False: 0]
  ------------------
 1004|     59|        opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
 1005|       |
 1006|     59|        if (l_codec->is_decompressor) {
  ------------------
  |  Branch (1006:13): [True: 59, False: 0]
  ------------------
 1007|     59|            l_codec->m_codec_data.m_decompression.opj_destroy(l_codec->m_codec);
 1008|     59|        } else {
 1009|      0|            l_codec->m_codec_data.m_compression.opj_destroy(l_codec->m_codec);
 1010|      0|        }
 1011|       |
 1012|     59|        l_codec->m_codec = 00;
 1013|     59|        opj_free(l_codec);
 1014|     59|    }
 1015|     59|}
opj_image_data_alloc:
 1134|     48|{
 1135|     48|    void* ret = opj_aligned_malloc(size);
 1136|       |    /* printf("opj_image_data_alloc %p\n", ret); */
 1137|     48|    return ret;
 1138|     48|}
opj_image_data_free:
 1141|    220|{
 1142|       |    /* printf("opj_image_data_free %p\n", ptr); */
 1143|    220|    opj_aligned_free(ptr);
 1144|    220|}

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

image.c:opj_uint_max:
   84|     78|{
   85|     78|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 0, False: 78]
  ------------------
   86|     78|}
image.c:opj_uint_min:
   66|     78|{
   67|     78|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 0, False: 78]
  ------------------
   68|     78|}
image.c:opj_uint_adds:
   93|     78|{
   94|     78|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|     78|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|     78|}
image.c:opj_uint_ceildiv:
  171|    436|{
  172|    436|    assert(b);
  173|    436|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|    436|}
image.c:opj_uint_ceildivpow2:
  210|    218|{
  211|    218|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|    218|}
j2k.c:opj_uint_ceildiv:
  171|    302|{
  172|    302|    assert(b);
  173|    302|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|    302|}
j2k.c:opj_uint_min:
   66|     54|{
   67|     54|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 30, False: 24]
  ------------------
   68|     54|}
j2k.c:opj_uint_adds:
   93|     78|{
   94|     78|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|     78|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|     78|}
j2k.c:opj_uint_ceildivpow2:
  210|     24|{
  211|     24|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|     24|}
j2k.c:opj_int_ceildiv:
  161|    170|{
  162|    170|    assert(b);
  163|    170|    return (OPJ_INT32)(((OPJ_INT64)a + b - 1) / b);
  164|    170|}
j2k.c:opj_int_ceildivpow2:
  192|    340|{
  193|    340|    return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
  194|    340|}
pi.c:opj_uint_max:
   84|     52|{
   85|     52|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 6, False: 46]
  ------------------
   86|     52|}
pi.c:opj_uint_min:
   66|  1.30k|{
   67|  1.30k|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 869, False: 436]
  ------------------
   68|  1.30k|}
pi.c:opj_uint_adds:
   93|     52|{
   94|     52|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|     52|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|     52|}
pi.c:opj_uint_ceildiv:
  171|    324|{
  172|    324|    assert(b);
  173|    324|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|    324|}
pi.c:opj_uint_ceildivpow2:
  210|  4.50k|{
  211|  4.50k|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|  4.50k|}
pi.c:opj_uint_floordivpow2:
  228|   144k|{
  229|   144k|    return a >> b;
  230|   144k|}
pi.c:opj_uint64_ceildiv_res_uint32:
  182|  1.28M|{
  183|  1.28M|    assert(b);
  184|  1.28M|    return (OPJ_UINT32)((a + b - 1) / b);
  185|  1.28M|}
tcd.c:opj_int_ceildiv:
  161|    324|{
  162|    324|    assert(b);
  163|    324|    return (OPJ_INT32)(((OPJ_INT64)a + b - 1) / b);
  164|    324|}
tcd.c:opj_int_ceildivpow2:
  192|   329k|{
  193|   329k|    return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
  194|   329k|}
tcd.c:opj_int_floordivpow2:
  219|   325k|{
  220|   325k|    return a >> b;
  221|   325k|}
tcd.c:opj_int64_ceildivpow2:
  201|  8.02k|{
  202|  8.02k|    return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
  203|  8.02k|}
tcd.c:opj_int_max:
   75|  6.50M|{
   76|  6.50M|    return (a > b) ? a : b;
  ------------------
  |  Branch (76:12): [True: 3.22M, False: 3.28M]
  ------------------
   77|  6.50M|}
tcd.c:opj_int_min:
   57|  6.50M|{
   58|  6.50M|    return a < b ? a : b;
  ------------------
  |  Branch (58:12): [True: 3.22M, False: 3.28M]
  ------------------
   59|  6.50M|}
tcd.c:opj_uint_max:
   84|  5.82M|{
   85|  5.82M|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 898, False: 5.82M]
  ------------------
   86|  5.82M|}
tcd.c:opj_uint_ceildiv:
  171|  11.6M|{
  172|  11.6M|    assert(b);
  173|  11.6M|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|  11.6M|}
tcd.c:opj_uint_min:
   66|  5.82M|{
   67|  5.82M|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 8.15k, False: 5.81M]
  ------------------
   68|  5.82M|}
tcd.c:opj_uint_ceildivpow2:
  210|  9.97M|{
  211|  9.97M|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|  9.97M|}
tcd.c:opj_int_clamp:
  118|  1.02M|{
  119|  1.02M|    if (a < min) {
  ------------------
  |  Branch (119:9): [True: 318k, False: 704k]
  ------------------
  120|   318k|        return min;
  121|   318k|    }
  122|   704k|    if (a > max) {
  ------------------
  |  Branch (122:9): [True: 315k, False: 389k]
  ------------------
  123|   315k|        return max;
  124|   315k|    }
  125|   389k|    return a;
  126|   704k|}
tcd.c:opj_int64_clamp:
  139|    708|{
  140|    708|    if (a < min) {
  ------------------
  |  Branch (140:9): [True: 0, False: 708]
  ------------------
  141|      0|        return min;
  142|      0|    }
  143|    708|    if (a > max) {
  ------------------
  |  Branch (143:9): [True: 0, False: 708]
  ------------------
  144|      0|        return max;
  145|      0|    }
  146|    708|    return a;
  147|    708|}
tcd.c:opj_uint_adds:
   93|  5.82M|{
   94|  5.82M|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|  5.82M|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|  5.82M|}
dwt.c:opj_uint_min:
   66|  6.65k|{
   67|  6.65k|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 2.11k, False: 4.53k]
  ------------------
   68|  6.65k|}
dwt.c:opj_int_min:
   57|  2.57k|{
   58|  2.57k|    return a < b ? a : b;
  ------------------
  |  Branch (58:12): [True: 0, False: 2.57k]
  ------------------
   59|  2.57k|}
dwt.c:opj_int_add_no_overflow:
  298|  1.18k|{
  299|  1.18k|    void* pa = &a;
  300|  1.18k|    void* pb = &b;
  301|  1.18k|    OPJ_UINT32* upa = (OPJ_UINT32*)pa;
  302|  1.18k|    OPJ_UINT32* upb = (OPJ_UINT32*)pb;
  303|  1.18k|    OPJ_UINT32 ures = *upa + *upb;
  304|  1.18k|    void* pures = &ures;
  305|  1.18k|    OPJ_INT32* ipres = (OPJ_INT32*)pures;
  306|  1.18k|    return *ipres;
  307|  1.18k|}
dwt.c:opj_int_sub_no_overflow:
  317|    295|{
  318|    295|    void* pa = &a;
  319|    295|    void* pb = &b;
  320|    295|    OPJ_UINT32* upa = (OPJ_UINT32*)pa;
  321|    295|    OPJ_UINT32* upb = (OPJ_UINT32*)pb;
  322|    295|    OPJ_UINT32 ures = *upa - *upb;
  323|    295|    void* pures = &ures;
  324|    295|    OPJ_INT32* ipres = (OPJ_INT32*)pures;
  325|    295|    return *ipres;
  326|    295|}
dwt.c:opj_uint_ceildivpow2:
  210|  1.40k|{
  211|  1.40k|    return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
  212|  1.40k|}
dwt.c:opj_uint_subs:
  103|  4.68k|{
  104|  4.68k|    return (a >= b) ? a - b : 0;
  ------------------
  |  Branch (104:12): [True: 3.12k, False: 1.56k]
  ------------------
  105|  4.68k|}
dwt.c:opj_uint_adds:
   93|  1.56k|{
   94|  1.56k|    OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
   95|  1.56k|    return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
   96|  1.56k|}
dwt.c:opj_uint_max:
   84|    780|{
   85|    780|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 430, False: 350]
  ------------------
   86|    780|}
t2.c:opj_uint_max:
   84|   550k|{
   85|   550k|    return (a > b) ? a : b;
  ------------------
  |  Branch (85:12): [True: 104, False: 550k]
  ------------------
   86|   550k|}
t2.c:opj_uint_floorlog2:
  249|  77.4k|{
  250|  77.4k|    OPJ_UINT32  l;
  251|   230k|    for (l = 0; a > 1; ++l) {
  ------------------
  |  Branch (251:17): [True: 153k, False: 77.4k]
  ------------------
  252|   153k|        a >>= 1;
  253|   153k|    }
  254|  77.4k|    return l;
  255|  77.4k|}
t2.c:opj_int_min:
   57|  53.8k|{
   58|  53.8k|    return a < b ? a : b;
  ------------------
  |  Branch (58:12): [True: 9.95k, False: 43.9k]
  ------------------
   59|  53.8k|}
sparse_array.c:opj_uint_ceildiv:
  171|     36|{
  172|     36|    assert(b);
  173|     36|    return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
  174|     36|}
sparse_array.c:opj_uint_min:
   66|  27.6k|{
   67|  27.6k|    return a < b ? a : b;
  ------------------
  |  Branch (67:12): [True: 14.5k, False: 13.0k]
  ------------------
   68|  27.6k|}

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

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

opj_sparse_array_int32_create:
   49|     18|{
   50|     18|    opj_sparse_array_int32_t* sa;
   51|       |
   52|     18|    if (width == 0 || height == 0 || block_width == 0 || block_height == 0) {
  ------------------
  |  Branch (52:9): [True: 0, False: 18]
  |  Branch (52:23): [True: 0, False: 18]
  |  Branch (52:38): [True: 0, False: 18]
  |  Branch (52:58): [True: 0, False: 18]
  ------------------
   53|      0|        return NULL;
   54|      0|    }
   55|     18|    if (block_width > ((OPJ_UINT32)~0U) / block_height / sizeof(OPJ_INT32)) {
  ------------------
  |  Branch (55:9): [True: 0, False: 18]
  ------------------
   56|      0|        return NULL;
   57|      0|    }
   58|       |
   59|     18|    sa = (opj_sparse_array_int32_t*) opj_calloc(1,
   60|     18|            sizeof(opj_sparse_array_int32_t));
   61|     18|    sa->width = width;
   62|     18|    sa->height = height;
   63|     18|    sa->block_width = block_width;
   64|     18|    sa->block_height = block_height;
   65|     18|    sa->block_count_hor = opj_uint_ceildiv(width, block_width);
   66|     18|    sa->block_count_ver = opj_uint_ceildiv(height, block_height);
   67|     18|    if (sa->block_count_hor > ((OPJ_UINT32)~0U) / sa->block_count_ver) {
  ------------------
  |  Branch (67:9): [True: 0, False: 18]
  ------------------
   68|      0|        opj_free(sa);
   69|      0|        return NULL;
   70|      0|    }
   71|     18|    sa->data_blocks = (OPJ_INT32**) opj_calloc(sizeof(OPJ_INT32*),
   72|     18|                      (size_t) sa->block_count_hor * sa->block_count_ver);
   73|     18|    if (sa->data_blocks == NULL) {
  ------------------
  |  Branch (73:9): [True: 0, False: 18]
  ------------------
   74|      0|        opj_free(sa);
   75|      0|        return NULL;
   76|      0|    }
   77|       |
   78|     18|    return sa;
   79|     18|}
opj_sparse_array_int32_free:
   82|     18|{
   83|     18|    if (sa) {
  ------------------
  |  Branch (83:9): [True: 18, False: 0]
  ------------------
   84|     18|        OPJ_UINT32 i;
   85|    796|        for (i = 0; i < sa->block_count_hor * sa->block_count_ver; i++) {
  ------------------
  |  Branch (85:21): [True: 778, False: 18]
  ------------------
   86|    778|            if (sa->data_blocks[i]) {
  ------------------
  |  Branch (86:17): [True: 699, False: 79]
  ------------------
   87|    699|                opj_free(sa->data_blocks[i]);
   88|    699|            }
   89|    778|        }
   90|     18|        opj_free(sa->data_blocks);
   91|     18|        opj_free(sa);
   92|     18|    }
   93|     18|}
opj_sparse_array_is_region_valid:
  100|  6.67k|{
  101|  6.67k|    return !(x0 >= sa->width || x1 <= x0 || x1 > sa->width ||
  ------------------
  |  Branch (101:14): [True: 0, False: 6.67k]
  |  Branch (101:33): [True: 16, False: 6.65k]
  |  Branch (101:45): [True: 0, False: 6.65k]
  ------------------
  102|  6.67k|             y0 >= sa->height || y1 <= y0 || y1 > sa->height);
  ------------------
  |  Branch (102:14): [True: 0, False: 6.65k]
  |  Branch (102:34): [True: 972, False: 5.68k]
  |  Branch (102:46): [True: 0, False: 5.68k]
  ------------------
  103|  6.67k|}
opj_sparse_array_int32_read:
  320|  4.55k|{
  321|  4.55k|    return opj_sparse_array_int32_read_or_write(
  322|  4.55k|               (opj_sparse_array_int32_t*)sa, x0, y0, x1, y1,
  323|  4.55k|               dest,
  324|  4.55k|               dest_col_stride,
  325|  4.55k|               dest_line_stride,
  326|  4.55k|               forgiving,
  327|  4.55k|               OPJ_TRUE);
  ------------------
  |  |  117|  4.55k|#define OPJ_TRUE 1
  ------------------
  328|  4.55k|}
opj_sparse_array_int32_write:
  339|  2.11k|{
  340|  2.11k|    return opj_sparse_array_int32_read_or_write(sa, x0, y0, x1, y1,
  341|  2.11k|            (OPJ_INT32*)src,
  342|  2.11k|            src_col_stride,
  343|  2.11k|            src_line_stride,
  344|  2.11k|            forgiving,
  345|  2.11k|            OPJ_FALSE);
  ------------------
  |  |  118|  2.11k|#define OPJ_FALSE 0
  ------------------
  346|  2.11k|}
sparse_array.c:opj_sparse_array_int32_read_or_write:
  116|  6.67k|{
  117|  6.67k|    OPJ_UINT32 y, block_y;
  118|  6.67k|    OPJ_UINT32 y_incr = 0;
  119|  6.67k|    const OPJ_UINT32 block_width = sa->block_width;
  120|       |
  121|  6.67k|    if (!opj_sparse_array_is_region_valid(sa, x0, y0, x1, y1)) {
  ------------------
  |  Branch (121:9): [True: 988, False: 5.68k]
  ------------------
  122|    988|        return forgiving;
  123|    988|    }
  124|       |
  125|  5.68k|    block_y = y0 / sa->block_height;
  126|  13.0k|    for (y = y0; y < y1; block_y ++, y += y_incr) {
  ------------------
  |  Branch (126:18): [True: 7.39k, False: 5.68k]
  ------------------
  127|  7.39k|        OPJ_UINT32 x, block_x;
  128|  7.39k|        OPJ_UINT32 x_incr = 0;
  129|  7.39k|        OPJ_UINT32 block_y_offset;
  130|  7.39k|        y_incr = (y == y0) ? sa->block_height - (y0 % sa->block_height) :
  ------------------
  |  Branch (130:18): [True: 5.68k, False: 1.71k]
  ------------------
  131|  7.39k|                 sa->block_height;
  132|  7.39k|        block_y_offset = sa->block_height - y_incr;
  133|  7.39k|        y_incr = opj_uint_min(y_incr, y1 - y);
  134|  7.39k|        block_x = x0 / block_width;
  135|  27.6k|        for (x = x0; x < x1; block_x ++, x += x_incr) {
  ------------------
  |  Branch (135:22): [True: 20.2k, False: 7.39k]
  ------------------
  136|  20.2k|            OPJ_UINT32 j;
  137|  20.2k|            OPJ_UINT32 block_x_offset;
  138|  20.2k|            OPJ_INT32* src_block;
  139|  20.2k|            x_incr = (x == x0) ? block_width - (x0 % block_width) : block_width;
  ------------------
  |  Branch (139:22): [True: 7.39k, False: 12.8k]
  ------------------
  140|  20.2k|            block_x_offset = block_width - x_incr;
  141|  20.2k|            x_incr = opj_uint_min(x_incr, x1 - x);
  142|  20.2k|            src_block = sa->data_blocks[block_y * sa->block_count_hor + block_x];
  143|  20.2k|            if (is_read_op) {
  ------------------
  |  Branch (143:17): [True: 11.2k, False: 8.93k]
  ------------------
  144|  11.2k|                if (src_block == NULL) {
  ------------------
  |  Branch (144:21): [True: 0, False: 11.2k]
  ------------------
  145|      0|                    if (buf_col_stride == 1) {
  ------------------
  |  Branch (145:25): [True: 0, False: 0]
  ------------------
  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|      0|                    } else {
  153|      0|                        OPJ_INT32* dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride +
  154|      0|                                              (x - x0) * buf_col_stride;
  155|      0|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (155:37): [True: 0, False: 0]
  ------------------
  156|      0|                            OPJ_UINT32 k;
  157|      0|                            for (k = 0; k < x_incr; k++) {
  ------------------
  |  Branch (157:41): [True: 0, False: 0]
  ------------------
  158|      0|                                dest_ptr[k * buf_col_stride] = 0;
  159|      0|                            }
  160|      0|                            dest_ptr += buf_line_stride;
  161|      0|                        }
  162|      0|                    }
  163|  11.2k|                } else {
  164|  11.2k|                    const OPJ_INT32* OPJ_RESTRICT src_ptr = src_block + block_y_offset *
  165|  11.2k|                                                            (OPJ_SIZE_T)block_width + block_x_offset;
  166|  11.2k|                    if (buf_col_stride == 1) {
  ------------------
  |  Branch (166:25): [True: 2.08k, False: 9.21k]
  ------------------
  167|  2.08k|                        OPJ_INT32* OPJ_RESTRICT dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride
  168|  2.08k|                                                           +
  169|  2.08k|                                                           (x - x0) * buf_col_stride;
  170|  2.08k|                        if (x_incr == 4) {
  ------------------
  |  Branch (170:29): [True: 13, False: 2.07k]
  ------------------
  171|       |                            /* Same code as general branch, but the compiler */
  172|       |                            /* can have an efficient memcpy() */
  173|     13|                            (void)(x_incr); /* trick to silent cppcheck duplicateBranch warning */
  174|    228|                            for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (174:41): [True: 215, False: 13]
  ------------------
  175|    215|                                memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
  176|    215|                                dest_ptr += buf_line_stride;
  177|    215|                                src_ptr += block_width;
  178|    215|                            }
  179|  2.07k|                        } else {
  180|  81.5k|                            for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (180:41): [True: 79.4k, False: 2.07k]
  ------------------
  181|  79.4k|                                memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
  182|  79.4k|                                dest_ptr += buf_line_stride;
  183|  79.4k|                                src_ptr += block_width;
  184|  79.4k|                            }
  185|  2.07k|                        }
  186|  9.21k|                    } else {
  187|  9.21k|                        OPJ_INT32* OPJ_RESTRICT dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride
  188|  9.21k|                                                           +
  189|  9.21k|                                                           (x - x0) * buf_col_stride;
  190|  9.21k|                        if (x_incr == 1) {
  ------------------
  |  Branch (190:29): [True: 48, False: 9.16k]
  ------------------
  191|     96|                            for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (191:41): [True: 48, False: 48]
  ------------------
  192|     48|                                *dest_ptr = *src_ptr;
  193|     48|                                dest_ptr += buf_line_stride;
  194|     48|                                src_ptr += block_width;
  195|     48|                            }
  196|  9.16k|                        } else if (y_incr == 1 && buf_col_stride == 2) {
  ------------------
  |  Branch (196:36): [True: 9.16k, False: 0]
  |  Branch (196:51): [True: 0, False: 9.16k]
  ------------------
  197|      0|                            OPJ_UINT32 k;
  198|      0|                            for (k = 0; k < (x_incr & ~3U); k += 4) {
  ------------------
  |  Branch (198:41): [True: 0, False: 0]
  ------------------
  199|      0|                                dest_ptr[k * buf_col_stride] = src_ptr[k];
  200|      0|                                dest_ptr[(k + 1) * buf_col_stride] = src_ptr[k + 1];
  201|      0|                                dest_ptr[(k + 2) * buf_col_stride] = src_ptr[k + 2];
  202|      0|                                dest_ptr[(k + 3) * buf_col_stride] = src_ptr[k + 3];
  203|      0|                            }
  204|      0|                            for (; k < x_incr; k++) {
  ------------------
  |  Branch (204:36): [True: 0, False: 0]
  ------------------
  205|      0|                                dest_ptr[k * buf_col_stride] = src_ptr[k];
  206|      0|                            }
  207|  9.16k|                        } else if (x_incr >= 8 && buf_col_stride == 8) {
  ------------------
  |  Branch (207:36): [True: 8.05k, False: 1.10k]
  |  Branch (207:51): [True: 0, False: 8.05k]
  ------------------
  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|  9.16k|                        } else {
  223|       |                            /* General case */
  224|  18.3k|                            for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (224:41): [True: 9.16k, False: 9.16k]
  ------------------
  225|  9.16k|                                OPJ_UINT32 k;
  226|   463k|                                for (k = 0; k < x_incr; k++) {
  ------------------
  |  Branch (226:45): [True: 454k, False: 9.16k]
  ------------------
  227|   454k|                                    dest_ptr[k * buf_col_stride] = src_ptr[k];
  228|   454k|                                }
  229|  9.16k|                                dest_ptr += buf_line_stride;
  230|  9.16k|                                src_ptr += block_width;
  231|  9.16k|                            }
  232|  9.16k|                        }
  233|  9.21k|                    }
  234|  11.2k|                }
  235|  11.2k|            } else {
  236|  8.93k|                if (src_block == NULL) {
  ------------------
  |  Branch (236:21): [True: 699, False: 8.23k]
  ------------------
  237|    699|                    src_block = (OPJ_INT32*) opj_calloc(1,
  238|    699|                                                        (size_t) sa->block_width * sa->block_height * sizeof(OPJ_INT32));
  239|    699|                    if (src_block == NULL) {
  ------------------
  |  Branch (239:25): [True: 0, False: 699]
  ------------------
  240|      0|                        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
  241|      0|                    }
  242|    699|                    sa->data_blocks[block_y * sa->block_count_hor + block_x] = src_block;
  243|    699|                }
  244|       |
  245|  8.93k|                if (buf_col_stride == 1) {
  ------------------
  |  Branch (245:21): [True: 7.84k, False: 1.08k]
  ------------------
  246|  7.84k|                    OPJ_INT32* OPJ_RESTRICT dest_ptr = src_block + block_y_offset *
  247|  7.84k|                                                       (OPJ_SIZE_T)block_width + block_x_offset;
  248|  7.84k|                    const OPJ_INT32* OPJ_RESTRICT src_ptr = buf + (y - y0) *
  249|  7.84k|                                                            (OPJ_SIZE_T)buf_line_stride + (x - x0) * buf_col_stride;
  250|  7.84k|                    if (x_incr == 4) {
  ------------------
  |  Branch (250:25): [True: 224, False: 7.62k]
  ------------------
  251|       |                        /* Same code as general branch, but the compiler */
  252|       |                        /* can have an efficient memcpy() */
  253|    224|                        (void)(x_incr); /* trick to silent cppcheck duplicateBranch warning */
  254|    931|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (254:37): [True: 707, False: 224]
  ------------------
  255|    707|                            memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
  256|    707|                            dest_ptr += block_width;
  257|    707|                            src_ptr += buf_line_stride;
  258|    707|                        }
  259|  7.62k|                    } else {
  260|   105k|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (260:37): [True: 97.4k, False: 7.62k]
  ------------------
  261|  97.4k|                            memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
  262|  97.4k|                            dest_ptr += block_width;
  263|  97.4k|                            src_ptr += buf_line_stride;
  264|  97.4k|                        }
  265|  7.62k|                    }
  266|  7.84k|                } else {
  267|  1.08k|                    OPJ_INT32* OPJ_RESTRICT dest_ptr = src_block + block_y_offset *
  268|  1.08k|                                                       (OPJ_SIZE_T)block_width + block_x_offset;
  269|  1.08k|                    const OPJ_INT32* OPJ_RESTRICT src_ptr = buf + (y - y0) *
  270|  1.08k|                                                            (OPJ_SIZE_T)buf_line_stride + (x - x0) * buf_col_stride;
  271|  1.08k|                    if (x_incr == 1) {
  ------------------
  |  Branch (271:25): [True: 16, False: 1.06k]
  ------------------
  272|     32|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (272:37): [True: 16, False: 16]
  ------------------
  273|     16|                            *dest_ptr = *src_ptr;
  274|     16|                            src_ptr += buf_line_stride;
  275|     16|                            dest_ptr += block_width;
  276|     16|                        }
  277|  1.06k|                    } else if (x_incr >= 8 && buf_col_stride == 8) {
  ------------------
  |  Branch (277:32): [True: 1.03k, False: 32]
  |  Branch (277:47): [True: 1.03k, False: 0]
  ------------------
  278|  9.09k|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (278:37): [True: 8.05k, False: 1.03k]
  ------------------
  279|  8.05k|                            OPJ_UINT32 k;
  280|   121k|                            for (k = 0; k < (x_incr & ~3U); k += 4) {
  ------------------
  |  Branch (280:41): [True: 113k, False: 8.05k]
  ------------------
  281|   113k|                                dest_ptr[k] = src_ptr[k * buf_col_stride];
  282|   113k|                                dest_ptr[k + 1] = src_ptr[(k + 1) * buf_col_stride];
  283|   113k|                                dest_ptr[k + 2] = src_ptr[(k + 2) * buf_col_stride];
  284|   113k|                                dest_ptr[k + 3] = src_ptr[(k + 3) * buf_col_stride];
  285|   113k|                            }
  286|  10.2k|                            for (; k < x_incr; k++) {
  ------------------
  |  Branch (286:36): [True: 2.14k, False: 8.05k]
  ------------------
  287|  2.14k|                                dest_ptr[k] = src_ptr[k * buf_col_stride];
  288|  2.14k|                            }
  289|  8.05k|                            src_ptr += buf_line_stride;
  290|  8.05k|                            dest_ptr += block_width;
  291|  8.05k|                        }
  292|  1.03k|                    } else {
  293|       |                        /* General case */
  294|     88|                        for (j = 0; j < y_incr; j++) {
  ------------------
  |  Branch (294:37): [True: 56, False: 32]
  ------------------
  295|     56|                            OPJ_UINT32 k;
  296|    272|                            for (k = 0; k < x_incr; k++) {
  ------------------
  |  Branch (296:41): [True: 216, False: 56]
  ------------------
  297|    216|                                dest_ptr[k] = src_ptr[k * buf_col_stride];
  298|    216|                            }
  299|     56|                            src_ptr += buf_line_stride;
  300|     56|                            dest_ptr += block_width;
  301|     56|                        }
  302|     32|                    }
  303|  1.08k|                }
  304|  8.93k|            }
  305|  20.2k|        }
  306|  7.39k|    }
  307|       |
  308|  5.68k|    return OPJ_TRUE;
  ------------------
  |  |  117|  5.68k|#define OPJ_TRUE 1
  ------------------
  309|  5.68k|}

opj_t1_create:
 1551|     12|{
 1552|     12|    opj_t1_t *l_t1 = 00;
 1553|       |
 1554|     12|    l_t1 = (opj_t1_t*) opj_calloc(1, sizeof(opj_t1_t));
 1555|     12|    if (!l_t1) {
  ------------------
  |  Branch (1555:9): [True: 0, False: 12]
  ------------------
 1556|      0|        return 00;
 1557|      0|    }
 1558|       |
 1559|     12|    l_t1->encoder = isEncoder;
 1560|       |
 1561|     12|    return l_t1;
 1562|     12|}
opj_t1_destroy:
 1571|     12|{
 1572|     12|    if (! p_t1) {
  ------------------
  |  Branch (1572:9): [True: 0, False: 12]
  ------------------
 1573|      0|        return;
 1574|      0|    }
 1575|       |
 1576|     12|    if (p_t1->data) {
  ------------------
  |  Branch (1576:9): [True: 12, False: 0]
  ------------------
 1577|     12|        opj_aligned_free(p_t1->data);
 1578|     12|        p_t1->data = 00;
 1579|     12|    }
 1580|       |
 1581|     12|    if (p_t1->flags) {
  ------------------
  |  Branch (1581:9): [True: 12, False: 0]
  ------------------
 1582|     12|        opj_aligned_free(p_t1->flags);
 1583|     12|        p_t1->flags = 00;
 1584|     12|    }
 1585|       |
 1586|     12|    opj_free(p_t1->cblkdatabuffer);
 1587|       |
 1588|     12|    opj_free(p_t1);
 1589|     12|}
opj_t1_decode_cblks:
 1880|     38|{
 1881|     38|    opj_thread_pool_t* tp = tcd->thread_pool;
 1882|     38|    OPJ_UINT32 resno, bandno, precno, cblkno;
 1883|       |
 1884|       |#ifdef DEBUG_VERBOSE
 1885|       |    OPJ_UINT32 codeblocks_decoded = 0;
 1886|       |    printf("Enter opj_t1_decode_cblks()\n");
 1887|       |#endif
 1888|       |
 1889|    546|    for (resno = 0; resno < tilec->minimum_num_resolutions; ++resno) {
  ------------------
  |  Branch (1889:21): [True: 510, False: 36]
  ------------------
 1890|    510|        opj_tcd_resolution_t* res = &tilec->resolutions[resno];
 1891|       |
 1892|  1.96k|        for (bandno = 0; bandno < res->numbands; ++bandno) {
  ------------------
  |  Branch (1892:26): [True: 1.45k, False: 508]
  ------------------
 1893|  1.45k|            opj_tcd_band_t* OPJ_RESTRICT band = &res->bands[bandno];
 1894|       |
 1895|  1.78k|            for (precno = 0; precno < res->pw * res->ph; ++precno) {
  ------------------
  |  Branch (1895:30): [True: 330, False: 1.45k]
  ------------------
 1896|    330|                opj_tcd_precinct_t* precinct = &band->precincts[precno];
 1897|       |
 1898|    330|                if (!opj_tcd_is_subband_area_of_interest(tcd,
  ------------------
  |  Branch (1898:21): [True: 73, False: 257]
  ------------------
 1899|    330|                        tilec->compno,
 1900|    330|                        resno,
 1901|    330|                        band->bandno,
 1902|    330|                        (OPJ_UINT32)precinct->x0,
 1903|    330|                        (OPJ_UINT32)precinct->y0,
 1904|    330|                        (OPJ_UINT32)precinct->x1,
 1905|    330|                        (OPJ_UINT32)precinct->y1)) {
 1906|     73|                    for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) {
  ------------------
  |  Branch (1906:38): [True: 0, False: 73]
  ------------------
 1907|      0|                        opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno];
 1908|      0|                        if (cblk->decoded_data) {
  ------------------
  |  Branch (1908:29): [True: 0, False: 0]
  ------------------
 1909|       |#ifdef DEBUG_VERBOSE
 1910|       |                            printf("Discarding codeblock %d,%d at resno=%d, bandno=%d\n",
 1911|       |                                   cblk->x0, cblk->y0, resno, bandno);
 1912|       |#endif
 1913|      0|                            opj_aligned_free(cblk->decoded_data);
 1914|      0|                            cblk->decoded_data = NULL;
 1915|      0|                        }
 1916|      0|                    }
 1917|     73|                    continue;
 1918|     73|                }
 1919|       |
 1920|  2.14k|                for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) {
  ------------------
  |  Branch (1920:34): [True: 1.89k, False: 255]
  ------------------
 1921|  1.89k|                    opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno];
 1922|  1.89k|                    opj_t1_cblk_decode_processing_job_t* job;
 1923|       |
 1924|  1.89k|                    if (!opj_tcd_is_subband_area_of_interest(tcd,
  ------------------
  |  Branch (1924:25): [True: 99, False: 1.79k]
  ------------------
 1925|  1.89k|                            tilec->compno,
 1926|  1.89k|                            resno,
 1927|  1.89k|                            band->bandno,
 1928|  1.89k|                            (OPJ_UINT32)cblk->x0,
 1929|  1.89k|                            (OPJ_UINT32)cblk->y0,
 1930|  1.89k|                            (OPJ_UINT32)cblk->x1,
 1931|  1.89k|                            (OPJ_UINT32)cblk->y1)) {
 1932|     99|                        if (cblk->decoded_data) {
  ------------------
  |  Branch (1932:29): [True: 0, False: 99]
  ------------------
 1933|       |#ifdef DEBUG_VERBOSE
 1934|       |                            printf("Discarding codeblock %d,%d at resno=%d, bandno=%d\n",
 1935|       |                                   cblk->x0, cblk->y0, resno, bandno);
 1936|       |#endif
 1937|      0|                            opj_aligned_free(cblk->decoded_data);
 1938|      0|                            cblk->decoded_data = NULL;
 1939|      0|                        }
 1940|     99|                        continue;
 1941|     99|                    }
 1942|       |
 1943|  1.79k|                    if (!tcd->whole_tile_decoding) {
  ------------------
  |  Branch (1943:25): [True: 1.14k, False: 651]
  ------------------
 1944|  1.14k|                        OPJ_UINT32 cblk_w = (OPJ_UINT32)(cblk->x1 - cblk->x0);
 1945|  1.14k|                        OPJ_UINT32 cblk_h = (OPJ_UINT32)(cblk->y1 - cblk->y0);
 1946|  1.14k|                        if (cblk->decoded_data != NULL) {
  ------------------
  |  Branch (1946:29): [True: 0, False: 1.14k]
  ------------------
 1947|       |#ifdef DEBUG_VERBOSE
 1948|       |                            printf("Reusing codeblock %d,%d at resno=%d, bandno=%d\n",
 1949|       |                                   cblk->x0, cblk->y0, resno, bandno);
 1950|       |#endif
 1951|      0|                            continue;
 1952|      0|                        }
 1953|  1.14k|                        if (cblk_w == 0 || cblk_h == 0) {
  ------------------
  |  Branch (1953:29): [True: 0, False: 1.14k]
  |  Branch (1953:44): [True: 32, False: 1.11k]
  ------------------
 1954|     32|                            continue;
 1955|     32|                        }
 1956|       |#ifdef DEBUG_VERBOSE
 1957|       |                        printf("Decoding codeblock %d,%d at resno=%d, bandno=%d\n",
 1958|       |                               cblk->x0, cblk->y0, resno, bandno);
 1959|       |#endif
 1960|  1.14k|                    }
 1961|       |
 1962|  1.76k|                    job = (opj_t1_cblk_decode_processing_job_t*) opj_calloc(1,
 1963|  1.76k|                            sizeof(opj_t1_cblk_decode_processing_job_t));
 1964|  1.76k|                    if (!job) {
  ------------------
  |  Branch (1964:25): [True: 0, False: 1.76k]
  ------------------
 1965|      0|                        *pret = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1966|      0|                        return;
 1967|      0|                    }
 1968|  1.76k|                    job->whole_tile_decoding = tcd->whole_tile_decoding;
 1969|  1.76k|                    job->resno = resno;
 1970|  1.76k|                    job->cblk = cblk;
 1971|  1.76k|                    job->band = band;
 1972|  1.76k|                    job->tilec = tilec;
 1973|  1.76k|                    job->tccp = tccp;
 1974|  1.76k|                    job->pret = pret;
 1975|  1.76k|                    job->p_manager_mutex = p_manager_mutex;
 1976|  1.76k|                    job->p_manager = p_manager;
 1977|  1.76k|                    job->check_pterm = check_pterm;
 1978|  1.76k|                    job->mustuse_cblkdatabuffer = opj_thread_pool_get_thread_count(tp) > 1;
 1979|  1.76k|                    opj_thread_pool_submit_job(tp, opj_t1_clbl_decode_processor, job);
 1980|       |#ifdef DEBUG_VERBOSE
 1981|       |                    codeblocks_decoded ++;
 1982|       |#endif
 1983|  1.76k|                    if (!(*pret)) {
  ------------------
  |  Branch (1983:25): [True: 2, False: 1.76k]
  ------------------
 1984|      2|                        return;
 1985|      2|                    }
 1986|  1.76k|                } /* cblkno */
 1987|    257|            } /* precno */
 1988|  1.45k|        } /* bandno */
 1989|    510|    } /* resno */
 1990|       |
 1991|       |#ifdef DEBUG_VERBOSE
 1992|       |    printf("Leave opj_t1_decode_cblks(). Number decoded: %d\n", codeblocks_decoded);
 1993|       |#endif
 1994|     36|    return;
 1995|     38|}
t1.c:opj_t1_clbl_decode_processor:
 1611|  1.76k|{
 1612|  1.76k|    opj_tcd_cblk_dec_t* cblk;
 1613|  1.76k|    opj_tcd_band_t* band;
 1614|  1.76k|    opj_tcd_tilecomp_t* tilec;
 1615|  1.76k|    opj_tccp_t* tccp;
 1616|  1.76k|    OPJ_INT32* OPJ_RESTRICT datap;
 1617|  1.76k|    OPJ_UINT32 cblk_w, cblk_h;
 1618|  1.76k|    OPJ_INT32 x, y;
 1619|  1.76k|    OPJ_UINT32 i, j;
 1620|  1.76k|    opj_t1_cblk_decode_processing_job_t* job;
 1621|  1.76k|    opj_t1_t* t1;
 1622|  1.76k|    OPJ_UINT32 resno;
 1623|  1.76k|    OPJ_UINT32 tile_w;
 1624|       |
 1625|  1.76k|    job = (opj_t1_cblk_decode_processing_job_t*) user_data;
 1626|       |
 1627|  1.76k|    cblk = job->cblk;
 1628|       |
 1629|  1.76k|    if (!job->whole_tile_decoding) {
  ------------------
  |  Branch (1629:9): [True: 1.11k, False: 651]
  ------------------
 1630|  1.11k|        cblk_w = (OPJ_UINT32)(cblk->x1 - cblk->x0);
 1631|  1.11k|        cblk_h = (OPJ_UINT32)(cblk->y1 - cblk->y0);
 1632|       |
 1633|  1.11k|        cblk->decoded_data = (OPJ_INT32*)opj_aligned_malloc(sizeof(OPJ_INT32) *
 1634|  1.11k|                             cblk_w * cblk_h);
 1635|  1.11k|        if (cblk->decoded_data == NULL) {
  ------------------
  |  Branch (1635:13): [True: 0, False: 1.11k]
  ------------------
 1636|      0|            if (job->p_manager_mutex) {
  ------------------
  |  Branch (1636:17): [True: 0, False: 0]
  ------------------
 1637|      0|                opj_mutex_lock(job->p_manager_mutex);
 1638|      0|            }
 1639|      0|            opj_event_msg(job->p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1640|      0|                          "Cannot allocate cblk->decoded_data\n");
 1641|      0|            if (job->p_manager_mutex) {
  ------------------
  |  Branch (1641:17): [True: 0, False: 0]
  ------------------
 1642|      0|                opj_mutex_unlock(job->p_manager_mutex);
 1643|      0|            }
 1644|      0|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1645|      0|            opj_free(job);
 1646|      0|            return;
 1647|      0|        }
 1648|       |        /* Zero-init required */
 1649|  1.11k|        memset(cblk->decoded_data, 0, sizeof(OPJ_INT32) * cblk_w * cblk_h);
 1650|  1.11k|    } else if (cblk->decoded_data) {
  ------------------
  |  Branch (1650:16): [True: 0, False: 651]
  ------------------
 1651|       |        /* Not sure if that code path can happen, but better be */
 1652|       |        /* safe than sorry */
 1653|      0|        opj_aligned_free(cblk->decoded_data);
 1654|      0|        cblk->decoded_data = NULL;
 1655|      0|    }
 1656|       |
 1657|  1.76k|    resno = job->resno;
 1658|  1.76k|    band = job->band;
 1659|  1.76k|    tilec = job->tilec;
 1660|  1.76k|    tccp = job->tccp;
 1661|  1.76k|    tile_w = (OPJ_UINT32)(tilec->resolutions[tilec->minimum_num_resolutions - 1].x1
 1662|  1.76k|                          -
 1663|  1.76k|                          tilec->resolutions[tilec->minimum_num_resolutions - 1].x0);
 1664|       |
 1665|  1.76k|    if (!*(job->pret)) {
  ------------------
  |  Branch (1665:9): [True: 0, False: 1.76k]
  ------------------
 1666|      0|        opj_free(job);
 1667|      0|        return;
 1668|      0|    }
 1669|       |
 1670|  1.76k|    t1 = (opj_t1_t*) opj_tls_get(tls, OPJ_TLS_KEY_T1);
  ------------------
  |  |   35|  1.76k|#define OPJ_TLS_KEY_T1  0
  ------------------
 1671|  1.76k|    if (t1 == NULL) {
  ------------------
  |  Branch (1671:9): [True: 12, False: 1.75k]
  ------------------
 1672|     12|        t1 = opj_t1_create(OPJ_FALSE);
  ------------------
  |  |  118|     12|#define OPJ_FALSE 0
  ------------------
 1673|     12|        if (t1 == NULL) {
  ------------------
  |  Branch (1673:13): [True: 0, False: 12]
  ------------------
 1674|      0|            opj_event_msg(job->p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1675|      0|                          "Cannot allocate Tier 1 handle\n");
 1676|      0|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1677|      0|            opj_free(job);
 1678|      0|            return;
 1679|      0|        }
 1680|     12|        if (!opj_tls_set(tls, OPJ_TLS_KEY_T1, t1, opj_t1_destroy_wrapper)) {
  ------------------
  |  |   35|     12|#define OPJ_TLS_KEY_T1  0
  ------------------
  |  Branch (1680:13): [True: 0, False: 12]
  ------------------
 1681|      0|            opj_event_msg(job->p_manager, EVT_ERROR,
  ------------------
  |  |   66|      0|#define EVT_ERROR   1   /**< Error event type */
  ------------------
 1682|      0|                          "Unable to set t1 handle as TLS\n");
 1683|      0|            opj_t1_destroy(t1);
 1684|      0|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1685|      0|            opj_free(job);
 1686|      0|            return;
 1687|      0|        }
 1688|     12|    }
 1689|  1.76k|    t1->mustuse_cblkdatabuffer = job->mustuse_cblkdatabuffer;
 1690|       |
 1691|  1.76k|    if ((tccp->cblksty & J2K_CCP_CBLKSTY_HT) != 0) {
  ------------------
  |  |   64|  1.76k|#define J2K_CCP_CBLKSTY_HT 0x40       /**< (high throughput) HT codeblocks */
  ------------------
  |  Branch (1691:9): [True: 23, False: 1.73k]
  ------------------
 1692|     23|        if (OPJ_FALSE == opj_t1_ht_decode_cblk(
  ------------------
  |  |  118|     23|#define OPJ_FALSE 0
  ------------------
  |  Branch (1692:13): [True: 2, False: 21]
  ------------------
 1693|     23|                    t1,
 1694|     23|                    cblk,
 1695|     23|                    band->bandno,
 1696|     23|                    (OPJ_UINT32)tccp->roishift,
 1697|     23|                    tccp->cblksty,
 1698|     23|                    job->p_manager,
 1699|     23|                    job->p_manager_mutex,
 1700|     23|                    job->check_pterm)) {
 1701|      2|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|      2|#define OPJ_FALSE 0
  ------------------
 1702|      2|            opj_free(job);
 1703|      2|            return;
 1704|      2|        }
 1705|  1.73k|    } else {
 1706|  1.73k|        if (OPJ_FALSE == opj_t1_decode_cblk(
  ------------------
  |  |  118|  1.73k|#define OPJ_FALSE 0
  ------------------
  |  Branch (1706:13): [True: 0, False: 1.73k]
  ------------------
 1707|  1.73k|                    t1,
 1708|  1.73k|                    cblk,
 1709|  1.73k|                    band->bandno,
 1710|  1.73k|                    (OPJ_UINT32)tccp->roishift,
 1711|  1.73k|                    tccp->cblksty,
 1712|  1.73k|                    job->p_manager,
 1713|  1.73k|                    job->p_manager_mutex,
 1714|  1.73k|                    job->check_pterm)) {
 1715|      0|            *(job->pret) = OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1716|      0|            opj_free(job);
 1717|      0|            return;
 1718|      0|        }
 1719|  1.73k|    }
 1720|       |
 1721|  1.76k|    x = cblk->x0 - band->x0;
 1722|  1.76k|    y = cblk->y0 - band->y0;
 1723|  1.76k|    if (band->bandno & 1) {
  ------------------
  |  Branch (1723:9): [True: 522, False: 1.23k]
  ------------------
 1724|    522|        opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
 1725|    522|        x += pres->x1 - pres->x0;
 1726|    522|    }
 1727|  1.76k|    if (band->bandno & 2) {
  ------------------
  |  Branch (1727:9): [True: 551, False: 1.20k]
  ------------------
 1728|    551|        opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
 1729|    551|        y += pres->y1 - pres->y0;
 1730|    551|    }
 1731|       |
 1732|  1.76k|    datap = cblk->decoded_data ? cblk->decoded_data : t1->data;
  ------------------
  |  Branch (1732:13): [True: 1.10k, False: 651]
  ------------------
 1733|  1.76k|    cblk_w = t1->w;
 1734|  1.76k|    cblk_h = t1->h;
 1735|       |
 1736|  1.76k|    if (tccp->roishift) {
  ------------------
  |  Branch (1736:9): [True: 0, False: 1.76k]
  ------------------
 1737|      0|        if (tccp->roishift >= 31) {
  ------------------
  |  Branch (1737:13): [True: 0, False: 0]
  ------------------
 1738|      0|            for (j = 0; j < cblk_h; ++j) {
  ------------------
  |  Branch (1738:25): [True: 0, False: 0]
  ------------------
 1739|      0|                for (i = 0; i < cblk_w; ++i) {
  ------------------
  |  Branch (1739:29): [True: 0, False: 0]
  ------------------
 1740|      0|                    datap[(j * cblk_w) + i] = 0;
 1741|      0|                }
 1742|      0|            }
 1743|      0|        } else {
 1744|      0|            OPJ_INT32 thresh = 1 << tccp->roishift;
 1745|      0|            for (j = 0; j < cblk_h; ++j) {
  ------------------
  |  Branch (1745:25): [True: 0, False: 0]
  ------------------
 1746|      0|                for (i = 0; i < cblk_w; ++i) {
  ------------------
  |  Branch (1746:29): [True: 0, False: 0]
  ------------------
 1747|      0|                    OPJ_INT32 val = datap[(j * cblk_w) + i];
 1748|      0|                    OPJ_INT32 mag = abs(val);
 1749|      0|                    if (mag >= thresh) {
  ------------------
  |  Branch (1749:25): [True: 0, False: 0]
  ------------------
 1750|      0|                        mag >>= tccp->roishift;
 1751|      0|                        datap[(j * cblk_w) + i] = val < 0 ? -mag : mag;
  ------------------
  |  Branch (1751:51): [True: 0, False: 0]
  ------------------
 1752|      0|                    }
 1753|      0|                }
 1754|      0|            }
 1755|      0|        }
 1756|      0|    }
 1757|       |
 1758|       |    /* Both can be non NULL if for example decoding a full tile and then */
 1759|       |    /* partially a tile. In which case partial decoding should be the */
 1760|       |    /* priority */
 1761|  1.76k|    assert((cblk->decoded_data != NULL) || (tilec->data != NULL));
 1762|       |
 1763|  1.76k|    if (cblk->decoded_data) {
  ------------------
  |  Branch (1763:9): [True: 1.10k, False: 651]
  ------------------
 1764|  1.10k|        OPJ_UINT32 cblk_size = cblk_w * cblk_h;
 1765|  1.10k|        if (tccp->qmfbid == 1) {
  ------------------
  |  Branch (1765:13): [True: 276, False: 833]
  ------------------
 1766|  1.10M|            for (i = 0; i < cblk_size; ++i) {
  ------------------
  |  Branch (1766:25): [True: 1.10M, False: 276]
  ------------------
 1767|  1.10M|                datap[i] /= 2;
 1768|  1.10M|            }
 1769|    833|        } else {        /* if (tccp->qmfbid == 0) */
 1770|    833|            const float stepsize = 0.5f * band->stepsize;
 1771|    833|            i = 0;
 1772|    833|#ifdef __SSE2__
 1773|    833|            {
 1774|    833|                const __m128 xmm_stepsize = _mm_set1_ps(stepsize);
 1775|  84.1k|                for (; i < (cblk_size & ~15U); i += 16) {
  ------------------
  |  Branch (1775:24): [True: 83.3k, False: 833]
  ------------------
 1776|  83.3k|                    __m128 xmm0_data = _mm_cvtepi32_ps(_mm_load_si128((__m128i * const)(
 1777|  83.3k|                                                           datap + 0)));
 1778|  83.3k|                    __m128 xmm1_data = _mm_cvtepi32_ps(_mm_load_si128((__m128i * const)(
 1779|  83.3k|                                                           datap + 4)));
 1780|  83.3k|                    __m128 xmm2_data = _mm_cvtepi32_ps(_mm_load_si128((__m128i * const)(
 1781|  83.3k|                                                           datap + 8)));
 1782|  83.3k|                    __m128 xmm3_data = _mm_cvtepi32_ps(_mm_load_si128((__m128i * const)(
 1783|  83.3k|                                                           datap + 12)));
 1784|  83.3k|                    _mm_store_ps((float*)(datap +  0), _mm_mul_ps(xmm0_data, xmm_stepsize));
 1785|  83.3k|                    _mm_store_ps((float*)(datap +  4), _mm_mul_ps(xmm1_data, xmm_stepsize));
 1786|  83.3k|                    _mm_store_ps((float*)(datap +  8), _mm_mul_ps(xmm2_data, xmm_stepsize));
 1787|  83.3k|                    _mm_store_ps((float*)(datap + 12), _mm_mul_ps(xmm3_data, xmm_stepsize));
 1788|  83.3k|                    datap += 16;
 1789|  83.3k|                }
 1790|    833|            }
 1791|    833|#endif
 1792|  5.48k|            for (; i < cblk_size; ++i) {
  ------------------
  |  Branch (1792:20): [True: 4.64k, False: 833]
  ------------------
 1793|  4.64k|                OPJ_FLOAT32 tmp = ((OPJ_FLOAT32)(*datap)) * stepsize;
 1794|  4.64k|                memcpy(datap, &tmp, sizeof(tmp));
 1795|  4.64k|                datap++;
 1796|  4.64k|            }
 1797|    833|        }
 1798|  1.10k|    } else if (tccp->qmfbid == 1) {
  ------------------
  |  Branch (1798:16): [True: 38, False: 613]
  ------------------
 1799|     38|        OPJ_INT32* OPJ_RESTRICT tiledp = &tilec->data[(OPJ_SIZE_T)y * tile_w +
 1800|     38|                                                       (OPJ_SIZE_T)x];
 1801|    659|        for (j = 0; j < cblk_h; ++j) {
  ------------------
  |  Branch (1801:21): [True: 621, False: 38]
  ------------------
 1802|       |            //positive -> round down aka.  (83)/2 =  41.5 ->  41
 1803|       |            //negative -> round up   aka. (-83)/2 = -41.5 -> -41
 1804|       |#if defined(__AVX512F__)
 1805|       |            OPJ_INT32* ptr_in = datap + (j * cblk_w);
 1806|       |            OPJ_INT32* ptr_out = tiledp + (j * (OPJ_SIZE_T)tile_w);
 1807|       |            for (i = 0; i < cblk_w / 16; ++i) {
 1808|       |                __m512i in_avx = _mm512_loadu_si512((__m512i*)(ptr_in));
 1809|       |                const __m512i add_avx = _mm512_srli_epi32(in_avx, 31);
 1810|       |                in_avx = _mm512_add_epi32(in_avx, add_avx);
 1811|       |                _mm512_storeu_si512((__m512i*)(ptr_out), _mm512_srai_epi32(in_avx, 1));
 1812|       |                ptr_in += 16;
 1813|       |                ptr_out += 16;
 1814|       |            }
 1815|       |
 1816|       |            for (i = 0; i < cblk_w % 16; ++i) {
 1817|       |                ptr_out[i] = ptr_in[i] / 2;
 1818|       |            }
 1819|       |#elif defined(__AVX2__)
 1820|       |            OPJ_INT32* ptr_in = datap + (j * cblk_w);
 1821|       |            OPJ_INT32* ptr_out = tiledp + (j * (OPJ_SIZE_T)tile_w);
 1822|       |            for (i = 0; i < cblk_w / 8; ++i) {
 1823|       |                __m256i in_avx = _mm256_loadu_si256((__m256i*)(ptr_in));
 1824|       |                const __m256i add_avx = _mm256_srli_epi32(in_avx, 31);
 1825|       |                in_avx = _mm256_add_epi32(in_avx, add_avx);
 1826|       |                _mm256_storeu_si256((__m256i*)(ptr_out), _mm256_srai_epi32(in_avx, 1));
 1827|       |                ptr_in += 8;
 1828|       |                ptr_out += 8;
 1829|       |            }
 1830|       |
 1831|       |            for (i = 0; i < cblk_w % 8; ++i) {
 1832|       |                ptr_out[i] = ptr_in[i] / 2;
 1833|       |            }
 1834|       |#else
 1835|    621|            i = 0;
 1836|    621|            for (; i < (cblk_w & ~(OPJ_UINT32)3U); i += 4U) {
  ------------------
  |  Branch (1836:20): [True: 0, False: 621]
  ------------------
 1837|      0|                OPJ_INT32 tmp0 = datap[(j * cblk_w) + i + 0U];
 1838|      0|                OPJ_INT32 tmp1 = datap[(j * cblk_w) + i + 1U];
 1839|      0|                OPJ_INT32 tmp2 = datap[(j * cblk_w) + i + 2U];
 1840|      0|                OPJ_INT32 tmp3 = datap[(j * cblk_w) + i + 3U];
 1841|      0|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i + 0U] = tmp0 / 2;
 1842|      0|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i + 1U] = tmp1 / 2;
 1843|      0|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i + 2U] = tmp2 / 2;
 1844|      0|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i + 3U] = tmp3 / 2;
 1845|      0|            }
 1846|  1.01k|            for (; i < cblk_w; ++i) {
  ------------------
  |  Branch (1846:20): [True: 394, False: 621]
  ------------------
 1847|    394|                OPJ_INT32 tmp = datap[(j * cblk_w) + i];
 1848|    394|                ((OPJ_INT32*)tiledp)[(j * (OPJ_SIZE_T)tile_w) + i] = tmp / 2;
 1849|    394|            }
 1850|    621|#endif
 1851|    621|        }
 1852|    613|    } else {        /* if (tccp->qmfbid == 0) */
 1853|    613|        const float stepsize = 0.5f * band->stepsize;
 1854|    613|        OPJ_FLOAT32* OPJ_RESTRICT tiledp = (OPJ_FLOAT32*) &tilec->data[(OPJ_SIZE_T)y *
 1855|    613|                                                         tile_w + (OPJ_SIZE_T)x];
 1856|  35.3k|        for (j = 0; j < cblk_h; ++j) {
  ------------------
  |  Branch (1856:21): [True: 34.6k, False: 613]
  ------------------
 1857|  34.6k|            OPJ_FLOAT32* OPJ_RESTRICT tiledp2 = tiledp;
 1858|  2.22M|            for (i = 0; i < cblk_w; ++i) {
  ------------------
  |  Branch (1858:25): [True: 2.19M, False: 34.6k]
  ------------------
 1859|  2.19M|                OPJ_FLOAT32 tmp = (OPJ_FLOAT32) * datap * stepsize;
 1860|  2.19M|                *tiledp2 = tmp;
 1861|  2.19M|                datap++;
 1862|  2.19M|                tiledp2++;
 1863|  2.19M|            }
 1864|  34.6k|            tiledp += tile_w;
 1865|  34.6k|        }
 1866|    613|    }
 1867|       |
 1868|  1.76k|    opj_free(job);
 1869|  1.76k|}
t1.c:opj_t1_destroy_wrapper:
 1606|     12|{
 1607|     12|    opj_t1_destroy((opj_t1_t*) t1);
 1608|     12|}
t1.c:opj_t1_decode_cblk:
 2006|  1.73k|{
 2007|  1.73k|    opj_mqc_t *mqc = &(t1->mqc);   /* MQC component */
 2008|       |
 2009|  1.73k|    OPJ_INT32 bpno_plus_one;
 2010|  1.73k|    OPJ_UINT32 passtype;
 2011|  1.73k|    OPJ_UINT32 segno, passno;
 2012|  1.73k|    OPJ_BYTE* cblkdata = NULL;
 2013|  1.73k|    OPJ_UINT32 cblkdataindex = 0;
 2014|  1.73k|    OPJ_BYTE type = T1_TYPE_MQ; /* BYPASS mode */
  ------------------
  |  |   70|  1.73k|#define T1_TYPE_MQ 0    /**< Normal coding using entropy coder */
  ------------------
 2015|  1.73k|    OPJ_INT32* original_t1_data = NULL;
 2016|       |
 2017|  1.73k|    mqc->lut_ctxno_zc_orient = lut_ctxno_zc + (orient << 9);
 2018|       |
 2019|  1.73k|    if (!opj_t1_allocate_buffers(
  ------------------
  |  Branch (2019:9): [True: 0, False: 1.73k]
  ------------------
 2020|  1.73k|                t1,
 2021|  1.73k|                (OPJ_UINT32)(cblk->x1 - cblk->x0),
 2022|  1.73k|                (OPJ_UINT32)(cblk->y1 - cblk->y0))) {
 2023|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2024|      0|    }
 2025|       |
 2026|  1.73k|    bpno_plus_one = (OPJ_INT32)(roishift + cblk->numbps);
 2027|  1.73k|    if (bpno_plus_one >= 31) {
  ------------------
  |  Branch (2027:9): [True: 0, False: 1.73k]
  ------------------
 2028|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (2028:13): [True: 0, False: 0]
  ------------------
 2029|      0|            opj_mutex_lock(p_manager_mutex);
 2030|      0|        }
 2031|      0|        opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|      0|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2032|      0|                      "opj_t1_decode_cblk(): unsupported bpno_plus_one = %d >= 31\n",
 2033|      0|                      bpno_plus_one);
 2034|      0|        if (p_manager_mutex) {
  ------------------
  |  Branch (2034:13): [True: 0, False: 0]
  ------------------
 2035|      0|            opj_mutex_unlock(p_manager_mutex);
 2036|      0|        }
 2037|      0|        return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2038|      0|    }
 2039|  1.73k|    passtype = 2;
 2040|       |
 2041|  1.73k|    opj_mqc_resetstates(mqc);
 2042|  1.73k|    opj_mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46);
  ------------------
  |  |   65|  1.73k|#define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
  |  |  ------------------
  |  |  |  |   64|  1.73k|#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  |  |  ------------------
  |  |  |  |  |  |   63|  1.73k|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|  1.73k|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   61|  1.73k|#define T1_CTXNO_ZC  0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   55|  1.73k|#define T1_NUMCTXS_ZC  9
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|  1.73k|#define T1_NUMCTXS_SC  5
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|  1.73k|#define T1_NUMCTXS_MAG 3
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
  |  |  ------------------
  |  |  |  |   58|  1.73k|#define T1_NUMCTXS_AGG 1
  |  |  ------------------
  ------------------
 2043|  1.73k|    opj_mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3);
  ------------------
  |  |   64|  1.73k|#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  ------------------
  |  |  |  |   63|  1.73k|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  1.73k|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   61|  1.73k|#define T1_CTXNO_ZC  0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.73k|#define T1_NUMCTXS_ZC  9
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|  1.73k|#define T1_NUMCTXS_SC  5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  ------------------
  |  |  |  |   57|  1.73k|#define T1_NUMCTXS_MAG 3
  |  |  ------------------
  ------------------
 2044|  1.73k|    opj_mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4);
  ------------------
  |  |   61|  1.73k|#define T1_CTXNO_ZC  0
  ------------------
 2045|       |
 2046|  1.73k|    if (cblk->corrupted) {
  ------------------
  |  Branch (2046:9): [True: 0, False: 1.73k]
  ------------------
 2047|      0|        assert(cblk->numchunks == 0);
 2048|      0|        return OPJ_TRUE;
  ------------------
  |  |  117|      0|#define OPJ_TRUE 1
  ------------------
 2049|      0|    }
 2050|       |
 2051|       |    /* Even if we have a single chunk, in multi-threaded decoding */
 2052|       |    /* the insertion of our synthetic marker might potentially override */
 2053|       |    /* valid codestream of other codeblocks decoded in parallel. */
 2054|  1.73k|    if (cblk->numchunks > 1 || (t1->mustuse_cblkdatabuffer &&
  ------------------
  |  Branch (2054:9): [True: 208, False: 1.53k]
  |  Branch (2054:33): [True: 0, False: 1.53k]
  ------------------
 2055|  1.53k|                                cblk->numchunks > 0)) {
  ------------------
  |  Branch (2055:33): [True: 0, False: 0]
  ------------------
 2056|    208|        OPJ_UINT32 i;
 2057|    208|        OPJ_UINT32 cblk_len;
 2058|       |
 2059|       |        /* Compute whole codeblock length from chunk lengths */
 2060|    208|        cblk_len = 0;
 2061|    745|        for (i = 0; i < cblk->numchunks; i++) {
  ------------------
  |  Branch (2061:21): [True: 537, False: 208]
  ------------------
 2062|    537|            cblk_len += cblk->chunks[i].len;
 2063|    537|        }
 2064|       |
 2065|       |        /* Allocate temporary memory if needed */
 2066|    208|        if (cblk_len + OPJ_COMMON_CBLK_DATA_EXTRA > t1->cblkdatabuffersize) {
  ------------------
  |  |   39|    208|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
  |  Branch (2066:13): [True: 14, False: 194]
  ------------------
 2067|     14|            cblkdata = (OPJ_BYTE*)opj_realloc(t1->cblkdatabuffer,
 2068|     14|                                              cblk_len + OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|     14|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2069|     14|            if (cblkdata == NULL) {
  ------------------
  |  Branch (2069:17): [True: 0, False: 14]
  ------------------
 2070|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 2071|      0|            }
 2072|     14|            t1->cblkdatabuffer = cblkdata;
 2073|     14|            memset(t1->cblkdatabuffer + cblk_len, 0, OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|     14|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2074|     14|            t1->cblkdatabuffersize = cblk_len + OPJ_COMMON_CBLK_DATA_EXTRA;
  ------------------
  |  |   39|     14|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2075|     14|        }
 2076|       |
 2077|       |        /* Concatenate all chunks */
 2078|    208|        cblkdata = t1->cblkdatabuffer;
 2079|    208|        cblk_len = 0;
 2080|    745|        for (i = 0; i < cblk->numchunks; i++) {
  ------------------
  |  Branch (2080:21): [True: 537, False: 208]
  ------------------
 2081|    537|            memcpy(cblkdata + cblk_len, cblk->chunks[i].data, cblk->chunks[i].len);
 2082|    537|            cblk_len += cblk->chunks[i].len;
 2083|    537|        }
 2084|  1.53k|    } else if (cblk->numchunks == 1) {
  ------------------
  |  Branch (2084:16): [True: 257, False: 1.27k]
  ------------------
 2085|    257|        cblkdata = cblk->chunks[0].data;
 2086|  1.27k|    } else {
 2087|       |        /* Not sure if that can happen in practice, but avoid Coverity to */
 2088|       |        /* think we will dereference a null cblkdta pointer */
 2089|  1.27k|        return OPJ_TRUE;
  ------------------
  |  |  117|  1.27k|#define OPJ_TRUE 1
  ------------------
 2090|  1.27k|    }
 2091|       |
 2092|       |    /* For subtile decoding, directly decode in the decoded_data buffer of */
 2093|       |    /* the code-block. Hack t1->data to point to it, and restore it later */
 2094|    465|    if (cblk->decoded_data) {
  ------------------
  |  Branch (2094:9): [True: 301, False: 164]
  ------------------
 2095|    301|        original_t1_data = t1->data;
 2096|    301|        t1->data = cblk->decoded_data;
 2097|    301|    }
 2098|       |
 2099|    935|    for (segno = 0; segno < cblk->real_num_segs; ++segno) {
  ------------------
  |  Branch (2099:21): [True: 470, False: 465]
  ------------------
 2100|    470|        opj_tcd_seg_t *seg = &cblk->segs[segno];
 2101|       |
 2102|       |        /* BYPASS mode */
 2103|    470|        type = ((bpno_plus_one <= ((OPJ_INT32)(cblk->numbps)) - 4) && (passtype < 2) &&
  ------------------
  |  Branch (2103:17): [True: 3, False: 467]
  |  Branch (2103:71): [True: 3, False: 0]
  ------------------
 2104|    470|                (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
  ------------------
  |  |   58|      3|#define J2K_CCP_CBLKSTY_LAZY 0x01     /**< Selective arithmetic coding bypass */
  ------------------
                              (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
  ------------------
  |  |   71|      0|#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|    940|#define T1_TYPE_MQ 0    /**< Normal coding using entropy coder */
  ------------------
  |  Branch (2104:17): [True: 0, False: 3]
  ------------------
 2105|       |
 2106|    470|        if (type == T1_TYPE_RAW) {
  ------------------
  |  |   71|    470|#define T1_TYPE_RAW 1   /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
  ------------------
  |  Branch (2106:13): [True: 0, False: 470]
  ------------------
 2107|      0|            opj_mqc_raw_init_dec(mqc, cblkdata + cblkdataindex, seg->len,
 2108|      0|                                 OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|      0|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2109|    470|        } else {
 2110|    470|            opj_mqc_init_dec(mqc, cblkdata + cblkdataindex, seg->len,
 2111|    470|                             OPJ_COMMON_CBLK_DATA_EXTRA);
  ------------------
  |  |   39|    470|#define OPJ_COMMON_CBLK_DATA_EXTRA        2    /**< Margin for a fake FFFF marker */
  ------------------
 2112|    470|        }
 2113|    470|        cblkdataindex += seg->len;
 2114|       |
 2115|  7.02k|        for (passno = 0; (passno < seg->real_num_passes) &&
  ------------------
  |  Branch (2115:26): [True: 6.63k, False: 388]
  ------------------
 2116|  7.02k|                (bpno_plus_one >= 1); ++passno) {
  ------------------
  |  Branch (2116:17): [True: 6.55k, False: 82]
  ------------------
 2117|  6.55k|            switch (passtype) {
  ------------------
  |  Branch (2117:21): [True: 0, False: 6.55k]
  ------------------
 2118|  2.16k|            case 0:
  ------------------
  |  Branch (2118:13): [True: 2.16k, False: 4.39k]
  ------------------
 2119|  2.16k|                if (type == T1_TYPE_RAW) {
  ------------------
  |  |   71|  2.16k|#define T1_TYPE_RAW 1   /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
  ------------------
  |  Branch (2119:21): [True: 0, False: 2.16k]
  ------------------
 2120|      0|                    opj_t1_dec_sigpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty);
 2121|  2.16k|                } else {
 2122|  2.16k|                    opj_t1_dec_sigpass_mqc(t1, bpno_plus_one, (OPJ_INT32)cblksty);
 2123|  2.16k|                }
 2124|  2.16k|                break;
 2125|  2.07k|            case 1:
  ------------------
  |  Branch (2125:13): [True: 2.07k, False: 4.48k]
  ------------------
 2126|  2.07k|                if (type == T1_TYPE_RAW) {
  ------------------
  |  |   71|  2.07k|#define T1_TYPE_RAW 1   /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
  ------------------
  |  Branch (2126:21): [True: 0, False: 2.07k]
  ------------------
 2127|      0|                    opj_t1_dec_refpass_raw(t1, bpno_plus_one);
 2128|  2.07k|                } else {
 2129|  2.07k|                    opj_t1_dec_refpass_mqc(t1, bpno_plus_one);
 2130|  2.07k|                }
 2131|  2.07k|                break;
 2132|  2.31k|            case 2:
  ------------------
  |  Branch (2132:13): [True: 2.31k, False: 4.24k]
  ------------------
 2133|  2.31k|                opj_t1_dec_clnpass(t1, bpno_plus_one, (OPJ_INT32)cblksty);
 2134|  2.31k|                break;
 2135|  6.55k|            }
 2136|       |
 2137|  6.55k|            if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) {
  ------------------
  |  |   59|  6.55k|#define J2K_CCP_CBLKSTY_RESET 0x02    /**< Reset context probabilities on coding pass boundaries */
  ------------------
                          if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) {
  ------------------
  |  |   70|  6.18k|#define T1_TYPE_MQ 0    /**< Normal coding using entropy coder */
  ------------------
  |  Branch (2137:17): [True: 6.18k, False: 369]
  |  Branch (2137:54): [True: 6.18k, False: 0]
  ------------------
 2138|  6.18k|                opj_mqc_resetstates(mqc);
 2139|  6.18k|                opj_mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46);
  ------------------
  |  |   65|  6.18k|#define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
  |  |  ------------------
  |  |  |  |   64|  6.18k|#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  |  |  ------------------
  |  |  |  |  |  |   63|  6.18k|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   62|  6.18k|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   61|  6.18k|#define T1_CTXNO_ZC  0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   55|  6.18k|#define T1_NUMCTXS_ZC  9
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   56|  6.18k|#define T1_NUMCTXS_SC  5
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|  6.18k|#define T1_NUMCTXS_MAG 3
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
  |  |  ------------------
  |  |  |  |   58|  6.18k|#define T1_NUMCTXS_AGG 1
  |  |  ------------------
  ------------------
 2140|  6.18k|                opj_mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3);
  ------------------
  |  |   64|  6.18k|#define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  ------------------
  |  |  |  |   63|  6.18k|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  6.18k|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   61|  6.18k|#define T1_CTXNO_ZC  0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  6.18k|#define T1_NUMCTXS_ZC  9
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|  6.18k|#define T1_NUMCTXS_SC  5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
  |  |  ------------------
  |  |  |  |   57|  6.18k|#define T1_NUMCTXS_MAG 3
  |  |  ------------------
  ------------------
 2141|  6.18k|                opj_mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4);
  ------------------
  |  |   61|  6.18k|#define T1_CTXNO_ZC  0
  ------------------
 2142|  6.18k|            }
 2143|  6.55k|            if (++passtype == 3) {
  ------------------
  |  Branch (2143:17): [True: 2.31k, False: 4.24k]
  ------------------
 2144|  2.31k|                passtype = 0;
 2145|  2.31k|                bpno_plus_one--;
 2146|  2.31k|            }
 2147|  6.55k|        }
 2148|       |
 2149|    470|        opq_mqc_finish_dec(mqc);
 2150|    470|    }
 2151|       |
 2152|    465|    if (check_pterm) {
  ------------------
  |  Branch (2152:9): [True: 44, False: 421]
  ------------------
 2153|     44|        if (mqc->bp + 2 < mqc->end) {
  ------------------
  |  Branch (2153:13): [True: 14, False: 30]
  ------------------
 2154|     14|            if (p_manager_mutex) {
  ------------------
  |  Branch (2154:17): [True: 14, False: 0]
  ------------------
 2155|     14|                opj_mutex_lock(p_manager_mutex);
 2156|     14|            }
 2157|     14|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|     14|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2158|     14|                          "PTERM check failure: %d remaining bytes in code block (%d used / %d)\n",
 2159|     14|                          (int)(mqc->end - mqc->bp) - 2,
 2160|     14|                          (int)(mqc->bp - mqc->start),
 2161|     14|                          (int)(mqc->end - mqc->start));
 2162|     14|            if (p_manager_mutex) {
  ------------------
  |  Branch (2162:17): [True: 14, False: 0]
  ------------------
 2163|     14|                opj_mutex_unlock(p_manager_mutex);
 2164|     14|            }
 2165|     30|        } else if (mqc->end_of_byte_stream_counter > 2) {
  ------------------
  |  Branch (2165:20): [True: 15, False: 15]
  ------------------
 2166|     15|            if (p_manager_mutex) {
  ------------------
  |  Branch (2166:17): [True: 15, False: 0]
  ------------------
 2167|     15|                opj_mutex_lock(p_manager_mutex);
 2168|     15|            }
 2169|     15|            opj_event_msg(p_manager, EVT_WARNING,
  ------------------
  |  |   67|     15|#define EVT_WARNING 2   /**< Warning event type */
  ------------------
 2170|     15|                          "PTERM check failure: %d synthesized 0xFF markers read\n",
 2171|     15|                          mqc->end_of_byte_stream_counter);
 2172|     15|            if (p_manager_mutex) {
  ------------------
  |  Branch (2172:17): [True: 15, False: 0]
  ------------------
 2173|     15|                opj_mutex_unlock(p_manager_mutex);
 2174|     15|            }
 2175|     15|        }
 2176|     44|    }
 2177|       |
 2178|       |    /* Restore original t1->data is needed */
 2179|    465|    if (cblk->decoded_data) {
  ------------------
  |  Branch (2179:9): [True: 301, False: 164]
  ------------------
 2180|    301|        t1->data = original_t1_data;
 2181|    301|    }
 2182|       |
 2183|    465|    return OPJ_TRUE;
  ------------------
  |  |  117|    465|#define OPJ_TRUE 1
  ------------------
 2184|    465|}
t1.c:opj_t1_allocate_buffers:
 1455|  1.73k|{
 1456|  1.73k|    OPJ_UINT32 flagssize;
 1457|  1.73k|    OPJ_UINT32 flags_stride;
 1458|       |
 1459|       |    /* No risk of overflow. Prior checks ensure those assert are met */
 1460|       |    /* They are per the specification */
 1461|  1.73k|    assert(w <= 1024);
 1462|  1.73k|    assert(h <= 1024);
 1463|  1.73k|    assert(w * h <= 4096);
 1464|       |
 1465|       |    /* encoder uses tile buffer, so no need to allocate */
 1466|  1.73k|    {
 1467|  1.73k|        OPJ_UINT32 datasize = w * h;
 1468|       |
 1469|  1.73k|        if (datasize > t1->datasize) {
  ------------------
  |  Branch (1469:13): [True: 29, False: 1.71k]
  ------------------
 1470|     29|            opj_aligned_free(t1->data);
 1471|     29|            t1->data = (OPJ_INT32*) opj_aligned_malloc(datasize * sizeof(OPJ_INT32));
 1472|     29|            if (!t1->data) {
  ------------------
  |  Branch (1472:17): [True: 0, False: 29]
  ------------------
 1473|       |                /* FIXME event manager error callback */
 1474|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1475|      0|            }
 1476|     29|            t1->datasize = datasize;
 1477|     29|        }
 1478|       |        /* memset first arg is declared to never be null by gcc */
 1479|  1.73k|        if (t1->data != NULL) {
  ------------------
  |  Branch (1479:13): [True: 1.73k, False: 0]
  ------------------
 1480|  1.73k|            memset(t1->data, 0, datasize * sizeof(OPJ_INT32));
 1481|  1.73k|        }
 1482|  1.73k|    }
 1483|       |
 1484|      0|    flags_stride = w + 2U; /* can't be 0U */
 1485|       |
 1486|  1.73k|    flagssize = (h + 3U) / 4U + 2U;
 1487|       |
 1488|  1.73k|    flagssize *= flags_stride;
 1489|  1.73k|    {
 1490|  1.73k|        opj_flag_t* p;
 1491|  1.73k|        OPJ_UINT32 x;
 1492|  1.73k|        OPJ_UINT32 flags_height = (h + 3U) / 4U;
 1493|       |
 1494|  1.73k|        if (flagssize > t1->flagssize) {
  ------------------
  |  Branch (1494:13): [True: 135, False: 1.60k]
  ------------------
 1495|       |
 1496|    135|            opj_aligned_free(t1->flags);
 1497|    135|            t1->flags = (opj_flag_t*) opj_aligned_malloc(flagssize * sizeof(
 1498|    135|                            opj_flag_t));
 1499|    135|            if (!t1->flags) {
  ------------------
  |  Branch (1499:17): [True: 0, False: 135]
  ------------------
 1500|       |                /* FIXME event manager error callback */
 1501|      0|                return OPJ_FALSE;
  ------------------
  |  |  118|      0|#define OPJ_FALSE 0
  ------------------
 1502|      0|            }
 1503|    135|        }
 1504|  1.73k|        t1->flagssize = flagssize;
 1505|       |
 1506|  1.73k|        memset(t1->flags, 0, flagssize * sizeof(opj_flag_t));
 1507|       |
 1508|  1.73k|        p = &t1->flags[0];
 1509|   402k|        for (x = 0; x < flags_stride; ++x) {
  ------------------
  |  Branch (1509:21): [True: 400k, False: 1.73k]
  ------------------
 1510|       |            /* magic value to hopefully stop any passes being interested in this entry */
 1511|   400k|            *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  115|   400k|#define T1_PI_0     (1U << 21)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  119|   400k|#define T1_PI_1     (1U << 24)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  122|   400k|#define T1_PI_2     (1U << 27)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  125|   400k|#define T1_PI_3     (1U << 30)
  ------------------
 1512|   400k|        }
 1513|       |
 1514|  1.73k|        p = &t1->flags[((flags_height + 1) * flags_stride)];
 1515|   402k|        for (x = 0; x < flags_stride; ++x) {
  ------------------
  |  Branch (1515:21): [True: 400k, False: 1.73k]
  ------------------
 1516|       |            /* magic value to hopefully stop any passes being interested in this entry */
 1517|   400k|            *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  115|   400k|#define T1_PI_0     (1U << 21)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  119|   400k|#define T1_PI_1     (1U << 24)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  122|   400k|#define T1_PI_2     (1U << 27)
  ------------------
                          *p++ = (T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3);
  ------------------
  |  |  125|   400k|#define T1_PI_3     (1U << 30)
  ------------------
 1518|   400k|        }
 1519|       |
 1520|  1.73k|        if (h % 4) {
  ------------------
  |  Branch (1520:13): [True: 412, False: 1.32k]
  ------------------
 1521|    412|            OPJ_UINT32 v = 0;
 1522|    412|            p = &t1->flags[((flags_height) * flags_stride)];
 1523|    412|            if (h % 4 == 1) {
  ------------------
  |  Branch (1523:17): [True: 214, False: 198]
  ------------------
 1524|    214|                v |= T1_PI_1 | T1_PI_2 | T1_PI_3;
  ------------------
  |  |  119|    214|#define T1_PI_1     (1U << 24)
  ------------------
                              v |= T1_PI_1 | T1_PI_2 | T1_PI_3;
  ------------------
  |  |  122|    214|#define T1_PI_2     (1U << 27)
  ------------------
                              v |= T1_PI_1 | T1_PI_2 | T1_PI_3;
  ------------------
  |  |  125|    214|#define T1_PI_3     (1U << 30)
  ------------------
 1525|    214|            } else if (h % 4 == 2) {
  ------------------
  |  Branch (1525:24): [True: 141, False: 57]
  ------------------
 1526|    141|                v |= T1_PI_2 | T1_PI_3;
  ------------------
  |  |  122|    141|#define T1_PI_2     (1U << 27)
  ------------------
                              v |= T1_PI_2 | T1_PI_3;
  ------------------
  |  |  125|    141|#define T1_PI_3     (1U << 30)
  ------------------
 1527|    141|            } else if (h % 4 == 3) {
  ------------------
  |  Branch (1527:24): [True: 57, False: 0]
  ------------------
 1528|     57|                v |= T1_PI_3;
  ------------------
  |  |  125|     57|#define T1_PI_3     (1U << 30)
  ------------------
 1529|     57|            }
 1530|  21.9k|            for (x = 0; x < flags_stride; ++x) {
  ------------------
  |  Branch (1530:25): [True: 21.4k, False: 412]
  ------------------
 1531|  21.4k|                *p++ = v;
 1532|  21.4k|            }
 1533|    412|        }
 1534|  1.73k|    }
 1535|       |
 1536|      0|    t1->w = w;
 1537|  1.73k|    t1->h = h;
 1538|       |
 1539|  1.73k|    return OPJ_TRUE;
  ------------------
  |  |  117|  1.73k|#define OPJ_TRUE 1
  ------------------
 1540|  1.73k|}
t1.c:opj_t1_dec_sigpass_mqc:
  724|  2.16k|{
  725|  2.16k|    if (t1->w == 64 && t1->h == 64) {
  ------------------
  |  Branch (725:9): [True: 2.03k, False: 129]
  |  Branch (725:24): [True: 1.87k, False: 163]
  ------------------
  726|  1.87k|        if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  ------------------
  |  |   61|  1.87k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  |  Branch (726:13): [True: 1.87k, False: 0]
  ------------------
  727|  1.87k|            opj_t1_dec_sigpass_mqc_64x64_vsc(t1, bpno);
  728|  1.87k|        } else {
  729|      0|            opj_t1_dec_sigpass_mqc_64x64_novsc(t1, bpno);
  730|      0|        }
  731|  1.87k|    } else {
  732|    292|        if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  ------------------
  |  |   61|    292|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  |  Branch (732:13): [True: 171, False: 121]
  ------------------
  733|    171|            opj_t1_dec_sigpass_mqc_generic_vsc(t1, bpno);
  734|    171|        } else {
  735|    121|            opj_t1_dec_sigpass_mqc_generic_novsc(t1, bpno);
  736|    121|        }
  737|    292|    }
  738|  2.16k|}
t1.c:opj_t1_dec_sigpass_mqc_64x64_vsc:
  700|  1.87k|{
  701|  1.87k|    opj_t1_dec_sigpass_mqc_internal(t1, bpno, OPJ_TRUE, 64, 64, 66);
  ------------------
  |  |  646|  1.87k|#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  |  647|  1.87k|{ \
  |  |  648|  1.87k|        OPJ_INT32 one, half, oneplushalf; \
  |  |  649|  1.87k|        OPJ_UINT32 i, j, k; \
  |  |  650|  1.87k|        register OPJ_INT32 *data = t1->data; \
  |  |  651|  1.87k|        register opj_flag_t *flagsp = &t1->flags[(flags_stride) + 1]; \
  |  |  652|  1.87k|        const OPJ_UINT32 l_w = w; \
  |  |  653|  1.87k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  654|  1.87k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  1.87k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  1.87k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  1.87k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  1.87k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  655|  1.87k|        register OPJ_UINT32 v; \
  |  |  656|  1.87k|        one = 1 << bpno; \
  |  |  657|  1.87k|        half = one >> 1; \
  |  |  658|  1.87k|        oneplushalf = one | half; \
  |  |  659|  31.8k|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (659:21): [True: 29.9k, False: 1.87k]
  |  |  ------------------
  |  |  660|  1.94M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (660:29): [True: 1.91M, False: 29.9k]
  |  |  ------------------
  |  |  661|  1.91M|                        opj_flag_t flags = *flagsp; \
  |  |  662|  1.91M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (662:29): [True: 1.67M, False: 243k]
  |  |  ------------------
  |  |  663|  1.67M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.67M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.67M|{ \
  |  |  |  |  440|  1.67M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.67M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.67M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.67M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.67M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 283k, False: 1.38M]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.67M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   283k|#define T1_SIGMA_NEIGHBOURS (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|   283k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   283k|#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|   283k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   283k|#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|   283k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   283k|#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|   283k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   283k|#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|   283k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   283k|#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|   283k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   283k|#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|   283k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   283k|#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|   283k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   283k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 277k, False: 6.69k]
  |  |  |  |  ------------------
  |  |  |  |  442|   277k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   277k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   277k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   277k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   277k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   277k|{ \
  |  |  |  |  |  |  140|   277k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   277k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   277k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   277k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   277k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   277k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 66.7k, False: 210k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  66.7k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  66.7k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  66.7k|{ \
  |  |  |  |  |  |  |  |   57|  66.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 14.1k, False: 52.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  14.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  14.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  14.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  52.5k|    } else { \
  |  |  |  |  |  |  |  |   62|  52.5k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  52.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  52.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  52.5k|    } \
  |  |  |  |  |  |  |  |   66|  66.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  66.7k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  66.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  66.7k|{ \
  |  |  |  |  |  |  |  |  128|   106k|    do { \
  |  |  |  |  |  |  |  |  129|   106k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 13.3k, False: 93.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  13.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  13.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  13.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  13.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  13.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  13.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  13.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  13.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 12.9k, False: 446]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  12.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.8k, False: 111]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.8k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.8k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.8k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.8k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    111|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    111|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    111|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    111|            } \
  |  |  |  |  |  |  |  |  |  |  118|  12.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    446|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    446|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    446|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    446|        } \
  |  |  |  |  |  |  |  |  |  |  123|  13.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  13.3k|        } \
  |  |  |  |  |  |  |  |  132|   106k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   106k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   106k|        ct--; \
  |  |  |  |  |  |  |  |  135|   106k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 39.9k, False: 66.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  66.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   210k|    } else {  \
  |  |  |  |  |  |  149|   210k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   210k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 69.3k, False: 141k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  69.3k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  69.3k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  69.3k|{ \
  |  |  |  |  |  |  |  |   45|  69.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 11.4k, False: 57.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  11.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  11.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  57.8k|    } else { \
  |  |  |  |  |  |  |  |   49|  57.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  57.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  57.8k|    } \
  |  |  |  |  |  |  |  |   52|  69.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  69.3k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  69.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  69.3k|{ \
  |  |  |  |  |  |  |  |  128|  74.4k|    do { \
  |  |  |  |  |  |  |  |  129|  74.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 9.32k, False: 65.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  9.32k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  9.32k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  9.32k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  9.32k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  9.32k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  9.32k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  9.32k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  9.32k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.13k, False: 190]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  9.13k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.04k, False: 89]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.04k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.04k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.04k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.04k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     89|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     89|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     89|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     89|            } \
  |  |  |  |  |  |  |  |  |  |  118|  9.13k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    190|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    190|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    190|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    190|        } \
  |  |  |  |  |  |  |  |  |  |  123|  9.32k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  9.32k|        } \
  |  |  |  |  |  |  |  |  132|  74.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  74.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  74.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  74.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.11k, False: 69.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  69.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   141k|        } else { \
  |  |  |  |  |  |  154|   141k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   141k|        } \
  |  |  |  |  |  |  156|   210k|    } \
  |  |  |  |  |  |  157|   277k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   277k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 137k, False: 139k]
  |  |  |  |  ------------------
  |  |  |  |  446|   137k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   137k|                                flags, \
  |  |  |  |  448|   137k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   137k|                                ci); \
  |  |  |  |  450|   137k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   137k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   137k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   137k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   137k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   137k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   137k|{ \
  |  |  |  |  |  |  140|   137k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   137k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   137k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   137k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   137k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   137k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 33.2k, False: 104k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  33.2k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  33.2k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  33.2k|{ \
  |  |  |  |  |  |  |  |   57|  33.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 7.33k, False: 25.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  7.33k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  7.33k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  7.33k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  25.9k|    } else { \
  |  |  |  |  |  |  |  |   62|  25.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  25.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  25.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  25.9k|    } \
  |  |  |  |  |  |  |  |   66|  33.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  33.2k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  33.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  33.2k|{ \
  |  |  |  |  |  |  |  |  128|  52.7k|    do { \
  |  |  |  |  |  |  |  |  129|  52.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 6.85k, False: 45.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  6.85k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  6.85k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  6.85k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  6.85k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  6.85k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  6.85k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  6.85k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  6.85k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.61k, False: 239]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.61k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.56k, False: 51]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.56k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.56k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.56k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.56k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     51|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     51|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     51|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     51|            } \
  |  |  |  |  |  |  |  |  |  |  118|  6.61k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    239|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    239|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    239|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    239|        } \
  |  |  |  |  |  |  |  |  |  |  123|  6.85k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  6.85k|        } \
  |  |  |  |  |  |  |  |  132|  52.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  52.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  52.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  52.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 19.4k, False: 33.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  33.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   104k|    } else {  \
  |  |  |  |  |  |  149|   104k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   104k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 35.9k, False: 68.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  35.9k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  35.9k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  35.9k|{ \
  |  |  |  |  |  |  |  |   45|  35.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 5.97k, False: 29.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  5.97k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  5.97k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  29.9k|    } else { \
  |  |  |  |  |  |  |  |   49|  29.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  29.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  29.9k|    } \
  |  |  |  |  |  |  |  |   52|  35.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  35.9k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  35.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  35.9k|{ \
  |  |  |  |  |  |  |  |  128|  38.4k|    do { \
  |  |  |  |  |  |  |  |  129|  38.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4.98k, False: 33.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  4.98k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  4.98k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  4.98k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  4.98k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  4.98k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  4.98k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  4.98k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  4.98k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.85k, False: 130]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.85k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.82k, False: 28]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.82k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.82k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.82k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.82k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     28|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     28|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     28|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     28|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.85k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    130|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    130|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    130|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    130|        } \
  |  |  |  |  |  |  |  |  |  |  123|  4.98k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  4.98k|        } \
  |  |  |  |  |  |  |  |  132|  38.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  38.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  38.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  38.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.49k, False: 35.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  35.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  68.6k|        } else { \
  |  |  |  |  |  |  154|  68.6k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  68.6k|        } \
  |  |  |  |  |  |  156|   104k|    } \
  |  |  |  |  |  |  157|   137k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   137k|            v = v ^ spb; \
  |  |  |  |  455|   137k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 68.8k, False: 68.9k]
  |  |  |  |  ------------------
  |  |  |  |  456|   137k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   137k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   137k|{ \
  |  |  |  |  |  |  326|   137k|    /* east */ \
  |  |  |  |  |  |  327|   137k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   137k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   137k| \
  |  |  |  |  |  |  329|   137k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   137k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   137k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   137k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   137k| \
  |  |  |  |  |  |  332|   137k|    /* west */ \
  |  |  |  |  |  |  333|   137k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   137k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   137k| \
  |  |  |  |  |  |  335|   137k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   137k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   137k| \
  |  |  |  |  |  |  343|   137k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   137k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   137k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   137k|        } \
  |  |  |  |  458|   277k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   277k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   277k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   277k|    } \
  |  |  |  |  460|  1.67M|}
  |  |  ------------------
  |  |  664|  1.67M|                                flags, flagsp, flags_stride, data, \
  |  |  665|  1.67M|                                l_w, 0, mqc, curctx, v, a, c, ct, oneplushalf, vsc); \
  |  |  666|  1.67M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.67M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.67M|{ \
  |  |  |  |  440|  1.67M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.67M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.67M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.67M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.67M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 285k, False: 1.38M]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.67M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   285k|#define T1_SIGMA_NEIGHBOURS (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|   285k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   285k|#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|   285k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   285k|#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|   285k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   285k|#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|   285k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   285k|#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|   285k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   285k|#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|   285k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   285k|#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|   285k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   285k|#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|   285k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   285k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 279k, False: 6.43k]
  |  |  |  |  ------------------
  |  |  |  |  442|   279k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   279k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   279k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   279k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   279k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   279k|{ \
  |  |  |  |  |  |  140|   279k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   279k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   279k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   279k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   279k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   279k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 68.0k, False: 211k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  68.0k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  68.0k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  68.0k|{ \
  |  |  |  |  |  |  |  |   57|  68.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 14.4k, False: 53.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  14.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  14.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  14.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  53.5k|    } else { \
  |  |  |  |  |  |  |  |   62|  53.5k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  53.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  53.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  53.5k|    } \
  |  |  |  |  |  |  |  |   66|  68.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  68.0k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  68.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  68.0k|{ \
  |  |  |  |  |  |  |  |  128|   109k|    do { \
  |  |  |  |  |  |  |  |  129|   109k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 13.9k, False: 95.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  13.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  13.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  13.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  13.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  13.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  13.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  13.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  13.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 13.5k, False: 454]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  13.5k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13.4k, False: 103]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  13.4k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  13.4k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  13.4k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  13.4k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    103|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    103|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    103|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    103|            } \
  |  |  |  |  |  |  |  |  |  |  118|  13.5k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    454|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    454|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    454|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    454|        } \
  |  |  |  |  |  |  |  |  |  |  123|  13.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  13.9k|        } \
  |  |  |  |  |  |  |  |  132|   109k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   109k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   109k|        ct--; \
  |  |  |  |  |  |  |  |  135|   109k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 41.5k, False: 68.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  68.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   211k|    } else {  \
  |  |  |  |  |  |  149|   211k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   211k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 69.4k, False: 141k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  69.4k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  69.4k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  69.4k|{ \
  |  |  |  |  |  |  |  |   45|  69.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 11.3k, False: 58.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  11.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  11.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  58.1k|    } else { \
  |  |  |  |  |  |  |  |   49|  58.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  58.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  58.1k|    } \
  |  |  |  |  |  |  |  |   52|  69.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  69.4k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  69.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  69.4k|{ \
  |  |  |  |  |  |  |  |  128|  74.5k|    do { \
  |  |  |  |  |  |  |  |  129|  74.5k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 9.40k, False: 65.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  9.40k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  9.40k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  9.40k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  9.40k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  9.40k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  9.40k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  9.40k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  9.40k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9.20k, False: 193]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  9.20k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9.15k, False: 53]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  9.15k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  9.15k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  9.15k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  9.15k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     53|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     53|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     53|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     53|            } \
  |  |  |  |  |  |  |  |  |  |  118|  9.20k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    193|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    193|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    193|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    193|        } \
  |  |  |  |  |  |  |  |  |  |  123|  9.40k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  9.40k|        } \
  |  |  |  |  |  |  |  |  132|  74.5k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  74.5k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  74.5k|        ct--; \
  |  |  |  |  |  |  |  |  135|  74.5k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.05k, False: 69.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  69.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   141k|        } else { \
  |  |  |  |  |  |  154|   141k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   141k|        } \
  |  |  |  |  |  |  156|   211k|    } \
  |  |  |  |  |  |  157|   279k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   279k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 138k, False: 140k]
  |  |  |  |  ------------------
  |  |  |  |  446|   138k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   138k|                                flags, \
  |  |  |  |  448|   138k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   138k|                                ci); \
  |  |  |  |  450|   138k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   138k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   138k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   138k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   138k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   138k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   138k|{ \
  |  |  |  |  |  |  140|   138k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   138k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   138k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   138k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   138k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   138k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 33.4k, False: 105k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  33.4k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  33.4k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  33.4k|{ \
  |  |  |  |  |  |  |  |   57|  33.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 7.53k, False: 25.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  7.53k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  7.53k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  7.53k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  25.9k|    } else { \
  |  |  |  |  |  |  |  |   62|  25.9k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  25.9k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  25.9k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  25.9k|    } \
  |  |  |  |  |  |  |  |   66|  33.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  33.4k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  33.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  33.4k|{ \
  |  |  |  |  |  |  |  |  128|  53.1k|    do { \
  |  |  |  |  |  |  |  |  129|  53.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 6.45k, False: 46.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  6.45k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  6.45k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  6.45k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  6.45k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  6.45k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  6.45k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  6.45k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  6.45k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.23k, False: 216]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.23k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.19k, False: 44]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.19k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.19k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.19k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.19k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     44|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     44|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     44|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     44|            } \
  |  |  |  |  |  |  |  |  |  |  118|  6.23k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    216|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    216|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    216|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    216|        } \
  |  |  |  |  |  |  |  |  |  |  123|  6.45k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  6.45k|        } \
  |  |  |  |  |  |  |  |  132|  53.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  53.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  53.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  53.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 19.6k, False: 33.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  33.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   105k|    } else {  \
  |  |  |  |  |  |  149|   105k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   105k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 35.2k, False: 69.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  35.2k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  35.2k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  35.2k|{ \
  |  |  |  |  |  |  |  |   45|  35.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 5.99k, False: 29.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  5.99k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  5.99k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  29.2k|    } else { \
  |  |  |  |  |  |  |  |   49|  29.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  29.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  29.2k|    } \
  |  |  |  |  |  |  |  |   52|  35.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  35.2k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  35.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  35.2k|{ \
  |  |  |  |  |  |  |  |  128|  37.7k|    do { \
  |  |  |  |  |  |  |  |  129|  37.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4.62k, False: 33.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  4.62k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  4.62k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  4.62k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  4.62k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  4.62k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  4.62k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  4.62k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  4.62k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.51k, False: 112]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.51k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.49k, False: 26]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.49k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.49k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.49k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.49k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     26|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     26|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     26|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     26|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.51k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    112|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    112|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    112|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    112|        } \
  |  |  |  |  |  |  |  |  |  |  123|  4.62k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  4.62k|        } \
  |  |  |  |  |  |  |  |  132|  37.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  37.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  37.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  37.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.53k, False: 35.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  35.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  69.8k|        } else { \
  |  |  |  |  |  |  154|  69.8k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  69.8k|        } \
  |  |  |  |  |  |  156|   105k|    } \
  |  |  |  |  |  |  157|   138k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   138k|            v = v ^ spb; \
  |  |  |  |  455|   138k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 69.0k, False: 69.4k]
  |  |  |  |  ------------------
  |  |  |  |  456|   138k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   138k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   138k|{ \
  |  |  |  |  |  |  326|   138k|    /* east */ \
  |  |  |  |  |  |  327|   138k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   138k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   138k| \
  |  |  |  |  |  |  329|   138k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   138k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   138k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   138k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   138k| \
  |  |  |  |  |  |  332|   138k|    /* west */ \
  |  |  |  |  |  |  333|   138k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   138k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   138k| \
  |  |  |  |  |  |  335|   138k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   138k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   138k| \
  |  |  |  |  |  |  343|   138k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   138k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   138k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   138k|        } \
  |  |  |  |  458|   279k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   279k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   279k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   279k|    } \
  |  |  |  |  460|  1.67M|}
  |  |  ------------------
  |  |  667|  1.67M|                                flags, flagsp, flags_stride, data, \
  |  |  668|  1.67M|                                l_w, 1, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  669|  1.67M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.67M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.67M|{ \
  |  |  |  |  440|  1.67M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.67M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.67M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.67M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.67M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 286k, False: 1.38M]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.67M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   286k|#define T1_SIGMA_NEIGHBOURS (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|   286k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   286k|#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|   286k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   286k|#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|   286k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   286k|#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|   286k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   286k|#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|   286k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   286k|#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|   286k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   286k|#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|   286k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   286k|#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|   286k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   286k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 276k, False: 10.2k]
  |  |  |  |  ------------------
  |  |  |  |  442|   276k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   276k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   276k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   276k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   276k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   276k|{ \
  |  |  |  |  |  |  140|   276k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   276k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   276k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   276k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   276k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   276k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 65.9k, False: 210k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  65.9k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  65.9k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  65.9k|{ \
  |  |  |  |  |  |  |  |   57|  65.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 13.7k, False: 52.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  13.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  13.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  13.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  52.2k|    } else { \
  |  |  |  |  |  |  |  |   62|  52.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  52.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  52.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  52.2k|    } \
  |  |  |  |  |  |  |  |   66|  65.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  65.9k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  65.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  65.9k|{ \
  |  |  |  |  |  |  |  |  128|   107k|    do { \
  |  |  |  |  |  |  |  |  129|   107k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 13.3k, False: 93.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  13.3k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  13.3k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  13.3k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  13.3k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  13.3k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  13.3k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  13.3k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  13.3k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 12.8k, False: 442]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  12.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.7k, False: 90]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     90|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     90|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     90|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     90|            } \
  |  |  |  |  |  |  |  |  |  |  118|  12.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    442|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    442|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    442|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    442|        } \
  |  |  |  |  |  |  |  |  |  |  123|  13.3k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  13.3k|        } \
  |  |  |  |  |  |  |  |  132|   107k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   107k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   107k|        ct--; \
  |  |  |  |  |  |  |  |  135|   107k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 41.2k, False: 65.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  65.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   210k|    } else {  \
  |  |  |  |  |  |  149|   210k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   210k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 68.0k, False: 142k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  68.0k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  68.0k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  68.0k|{ \
  |  |  |  |  |  |  |  |   45|  68.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 11.0k, False: 57.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  11.0k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  11.0k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  57.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  57.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  57.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  57.0k|    } \
  |  |  |  |  |  |  |  |   52|  68.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  68.0k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  68.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  68.0k|{ \
  |  |  |  |  |  |  |  |  128|  73.1k|    do { \
  |  |  |  |  |  |  |  |  129|  73.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 9.15k, False: 63.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  9.15k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  9.15k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  9.15k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  9.15k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  9.15k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  9.15k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  9.15k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  9.15k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 8.93k, False: 212]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  8.93k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 8.87k, False: 67]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  8.87k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  8.87k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  8.87k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  8.87k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     67|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     67|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     67|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     67|            } \
  |  |  |  |  |  |  |  |  |  |  118|  8.93k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    212|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    212|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    212|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    212|        } \
  |  |  |  |  |  |  |  |  |  |  123|  9.15k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  9.15k|        } \
  |  |  |  |  |  |  |  |  132|  73.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  73.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  73.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  73.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.04k, False: 68.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  68.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   142k|        } else { \
  |  |  |  |  |  |  154|   142k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   142k|        } \
  |  |  |  |  |  |  156|   210k|    } \
  |  |  |  |  |  |  157|   276k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   276k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 139k, False: 136k]
  |  |  |  |  ------------------
  |  |  |  |  446|   139k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   139k|                                flags, \
  |  |  |  |  448|   139k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   139k|                                ci); \
  |  |  |  |  450|   139k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   139k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   139k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   139k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   139k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   139k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   139k|{ \
  |  |  |  |  |  |  140|   139k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   139k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   139k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   139k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   139k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   139k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 33.7k, False: 105k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  33.7k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  33.7k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  33.7k|{ \
  |  |  |  |  |  |  |  |   57|  33.7k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 7.46k, False: 26.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  7.46k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  7.46k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  7.46k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  26.2k|    } else { \
  |  |  |  |  |  |  |  |   62|  26.2k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  26.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  26.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  26.2k|    } \
  |  |  |  |  |  |  |  |   66|  33.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  33.7k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  33.7k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  33.7k|{ \
  |  |  |  |  |  |  |  |  128|  54.4k|    do { \
  |  |  |  |  |  |  |  |  129|  54.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 6.61k, False: 47.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  6.61k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  6.61k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  6.61k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  6.61k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  6.61k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  6.61k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  6.61k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  6.61k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.36k, False: 250]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.36k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.31k, False: 47]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.31k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.31k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.31k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.31k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     47|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     47|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     47|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     47|            } \
  |  |  |  |  |  |  |  |  |  |  118|  6.36k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    250|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    250|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    250|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    250|        } \
  |  |  |  |  |  |  |  |  |  |  123|  6.61k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  6.61k|        } \
  |  |  |  |  |  |  |  |  132|  54.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  54.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  54.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  54.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 20.6k, False: 33.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  33.7k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   105k|    } else {  \
  |  |  |  |  |  |  149|   105k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   105k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 35.6k, False: 70.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  35.6k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  35.6k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  35.6k|{ \
  |  |  |  |  |  |  |  |   45|  35.6k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 6.14k, False: 29.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  6.14k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  6.14k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  29.5k|    } else { \
  |  |  |  |  |  |  |  |   49|  29.5k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  29.5k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  29.5k|    } \
  |  |  |  |  |  |  |  |   52|  35.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  35.6k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  35.6k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  35.6k|{ \
  |  |  |  |  |  |  |  |  128|  38.4k|    do { \
  |  |  |  |  |  |  |  |  129|  38.4k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4.78k, False: 33.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  4.78k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  4.78k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  4.78k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  4.78k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  4.78k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  4.78k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  4.78k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  4.78k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.66k, False: 120]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.66k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.63k, False: 29]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.63k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.63k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.63k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.63k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     29|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     29|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     29|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     29|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.66k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    120|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    120|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    120|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    120|        } \
  |  |  |  |  |  |  |  |  |  |  123|  4.78k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  4.78k|        } \
  |  |  |  |  |  |  |  |  132|  38.4k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  38.4k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  38.4k|        ct--; \
  |  |  |  |  |  |  |  |  135|  38.4k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.76k, False: 35.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  35.6k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  70.1k|        } else { \
  |  |  |  |  |  |  154|  70.1k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  70.1k|        } \
  |  |  |  |  |  |  156|   105k|    } \
  |  |  |  |  |  |  157|   139k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   139k|            v = v ^ spb; \
  |  |  |  |  455|   139k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 69.9k, False: 69.6k]
  |  |  |  |  ------------------
  |  |  |  |  456|   139k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   139k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   139k|{ \
  |  |  |  |  |  |  326|   139k|    /* east */ \
  |  |  |  |  |  |  327|   139k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   139k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   139k| \
  |  |  |  |  |  |  329|   139k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   139k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   139k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   139k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   139k| \
  |  |  |  |  |  |  332|   139k|    /* west */ \
  |  |  |  |  |  |  333|   139k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   139k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   139k| \
  |  |  |  |  |  |  335|   139k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   139k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   139k| \
  |  |  |  |  |  |  343|   139k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   139k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|   139k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   139k|        } \
  |  |  |  |  458|   276k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   276k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   276k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   276k|    } \
  |  |  |  |  460|  1.67M|}
  |  |  ------------------
  |  |  670|  1.67M|                                flags, flagsp, flags_stride, data, \
  |  |  671|  1.67M|                                l_w, 2, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  672|  1.67M|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  1.67M|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  1.67M|{ \
  |  |  |  |  440|  1.67M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.67M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.67M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.67M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.67M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 294k, False: 1.37M]
  |  |  |  |  ------------------
  |  |  |  |  441|  1.67M|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   294k|#define T1_SIGMA_NEIGHBOURS (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|   294k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|   294k|#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|   294k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|   294k|#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|   294k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|   294k|#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|   294k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|   294k|#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|   294k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|   294k|#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|   294k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|   294k|#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|   294k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|   294k|#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|   294k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|   294k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 273k, False: 21.0k]
  |  |  |  |  ------------------
  |  |  |  |  442|   273k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|   273k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   273k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|   273k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   273k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   273k|{ \
  |  |  |  |  |  |  140|   273k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   273k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   273k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   273k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   273k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   273k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 64.4k, False: 208k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  64.4k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  64.4k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  64.4k|{ \
  |  |  |  |  |  |  |  |   57|  64.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 13.7k, False: 50.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  13.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  13.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  13.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  50.6k|    } else { \
  |  |  |  |  |  |  |  |   62|  50.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  50.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  50.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  50.6k|    } \
  |  |  |  |  |  |  |  |   66|  64.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  64.4k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  64.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  64.4k|{ \
  |  |  |  |  |  |  |  |  128|   104k|    do { \
  |  |  |  |  |  |  |  |  129|   104k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 12.8k, False: 91.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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: 12.4k, False: 414]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  12.4k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12.3k, False: 93]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  12.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  12.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  12.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  12.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     93|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     93|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     93|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     93|            } \
  |  |  |  |  |  |  |  |  |  |  118|  12.4k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    414|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    414|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    414|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    414|        } \
  |  |  |  |  |  |  |  |  |  |  123|  12.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  12.8k|        } \
  |  |  |  |  |  |  |  |  132|   104k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   104k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   104k|        ct--; \
  |  |  |  |  |  |  |  |  135|   104k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 39.6k, False: 64.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  64.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   208k|    } else {  \
  |  |  |  |  |  |  149|   208k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   208k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 66.9k, False: 141k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  66.9k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  66.9k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  66.9k|{ \
  |  |  |  |  |  |  |  |   45|  66.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 10.6k, False: 56.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  10.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  10.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  56.2k|    } else { \
  |  |  |  |  |  |  |  |   49|  56.2k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  56.2k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  56.2k|    } \
  |  |  |  |  |  |  |  |   52|  66.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  66.9k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  66.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  66.9k|{ \
  |  |  |  |  |  |  |  |  128|  71.7k|    do { \
  |  |  |  |  |  |  |  |  129|  71.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 8.85k, False: 62.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  8.85k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  8.85k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  8.85k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  8.85k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  8.85k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  8.85k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  8.85k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  8.85k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 8.65k, False: 204]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  8.65k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 8.59k, False: 58]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  8.59k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  8.59k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  8.59k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  8.59k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     58|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     58|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     58|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     58|            } \
  |  |  |  |  |  |  |  |  |  |  118|  8.65k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    204|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    204|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    204|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    204|        } \
  |  |  |  |  |  |  |  |  |  |  123|  8.85k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  8.85k|        } \
  |  |  |  |  |  |  |  |  132|  71.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  71.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  71.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  71.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4.79k, False: 66.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  66.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   141k|        } else { \
  |  |  |  |  |  |  154|   141k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   141k|        } \
  |  |  |  |  |  |  156|   208k|    } \
  |  |  |  |  |  |  157|   273k|}
  |  |  |  |  ------------------
  |  |  |  |  445|   273k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 139k, False: 133k]
  |  |  |  |  ------------------
  |  |  |  |  446|   139k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|   139k|                                flags, \
  |  |  |  |  448|   139k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|   139k|                                ci); \
  |  |  |  |  450|   139k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|   139k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|   139k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   139k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|   139k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   139k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   139k|{ \
  |  |  |  |  |  |  140|   139k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   139k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   139k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   139k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   139k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   139k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 33.8k, False: 105k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  33.8k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  33.8k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  33.8k|{ \
  |  |  |  |  |  |  |  |   57|  33.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 7.49k, False: 26.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  7.49k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  7.49k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  7.49k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  26.3k|    } else { \
  |  |  |  |  |  |  |  |   62|  26.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  26.3k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  26.3k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  26.3k|    } \
  |  |  |  |  |  |  |  |   66|  33.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  33.8k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  33.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  33.8k|{ \
  |  |  |  |  |  |  |  |  128|  54.2k|    do { \
  |  |  |  |  |  |  |  |  129|  54.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 6.92k, False: 47.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  6.92k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  6.92k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  6.92k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  6.92k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  6.92k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  6.92k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  6.92k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  6.92k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.66k, False: 262]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.66k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.61k, False: 45]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.61k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.61k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.61k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.61k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     45|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     45|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     45|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     45|            } \
  |  |  |  |  |  |  |  |  |  |  118|  6.66k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    262|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    262|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    262|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    262|        } \
  |  |  |  |  |  |  |  |  |  |  123|  6.92k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  6.92k|        } \
  |  |  |  |  |  |  |  |  132|  54.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  54.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  54.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  54.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 20.4k, False: 33.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  33.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   105k|    } else {  \
  |  |  |  |  |  |  149|   105k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   105k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 35.4k, False: 70.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  35.4k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  35.4k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  35.4k|{ \
  |  |  |  |  |  |  |  |   45|  35.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 6.00k, False: 29.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  6.00k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  6.00k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  29.4k|    } else { \
  |  |  |  |  |  |  |  |   49|  29.4k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  29.4k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  29.4k|    } \
  |  |  |  |  |  |  |  |   52|  35.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  35.4k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  35.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  35.4k|{ \
  |  |  |  |  |  |  |  |  128|  38.0k|    do { \
  |  |  |  |  |  |  |  |  129|  38.0k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4.70k, False: 33.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  4.70k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  4.70k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  4.70k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  4.70k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  4.70k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  4.70k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  4.70k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  4.70k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.59k, False: 111]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.59k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.57k, False: 27]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.57k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.57k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.57k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.57k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     27|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     27|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     27|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     27|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.59k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    111|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    111|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    111|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    111|        } \
  |  |  |  |  |  |  |  |  |  |  123|  4.70k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  4.70k|        } \
  |  |  |  |  |  |  |  |  132|  38.0k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  38.0k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  38.0k|        ct--; \
  |  |  |  |  |  |  |  |  135|  38.0k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.68k, False: 35.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  35.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  70.3k|        } else { \
  |  |  |  |  |  |  154|  70.3k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  70.3k|        } \
  |  |  |  |  |  |  156|   105k|    } \
  |  |  |  |  |  |  157|   139k|}
  |  |  |  |  ------------------
  |  |  |  |  454|   139k|            v = v ^ spb; \
  |  |  |  |  455|   139k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 69.5k, False: 70.0k]
  |  |  |  |  ------------------
  |  |  |  |  456|   139k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|   139k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|   139k|{ \
  |  |  |  |  |  |  326|   139k|    /* east */ \
  |  |  |  |  |  |  327|   139k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|   139k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|   139k| \
  |  |  |  |  |  |  329|   139k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|   139k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|   139k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|   139k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|   139k| \
  |  |  |  |  |  |  332|   139k|    /* west */ \
  |  |  |  |  |  |  333|   139k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|   139k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|   139k| \
  |  |  |  |  |  |  335|   139k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|   139k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|   139k| \
  |  |  |  |  |  |  343|   139k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|   139k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|   139k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|   139k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   139k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|   139k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|   139k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|   139k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|   139k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|   139k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|   139k|    } \
  |  |  |  |  |  |  350|   139k|}
  |  |  |  |  ------------------
  |  |  |  |  457|   139k|        } \
  |  |  |  |  458|   273k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   273k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|   273k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|   273k|    } \
  |  |  |  |  460|  1.67M|}
  |  |  ------------------
  |  |  673|  1.67M|                                flags, flagsp, flags_stride, data, \
  |  |  674|  1.67M|                                l_w, 3, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  675|  1.67M|                            *flagsp = flags; \
  |  |  676|  1.67M|                        } \
  |  |  677|  1.91M|                } \
  |  |  678|  29.9k|        } \
  |  |  679|  1.87k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  1.87k|        mqc->curctx = curctx; \
  |  |  |  |  167|  1.87k|        mqc->c = c; \
  |  |  |  |  168|  1.87k|        mqc->a = a; \
  |  |  |  |  169|  1.87k|        mqc->ct = ct;
  |  |  ------------------
  |  |  680|  1.87k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (680:13): [True: 0, False: 1.87k]
  |  |  ------------------
  |  |  681|      0|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (681:25): [True: 0, False: 0]
  |  |  ------------------
  |  |  682|      0|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (682:29): [True: 0, False: 0]
  |  |  ------------------
  |  |  683|      0|                        opj_t1_dec_sigpass_step_mqc(t1, flagsp, \
  |  |  684|      0|                            data + j * l_w, oneplushalf, j, flags_stride, vsc); \
  |  |  685|      0|                } \
  |  |  686|      0|            } \
  |  |  687|      0|        } \
  |  |  688|  1.87k|}
  ------------------
  702|  1.87k|}
t1.c:opj_t1_getctxno_zc:
  255|  2.09M|{
  256|  2.09M|    return mqc->lut_ctxno_zc_orient[(f & T1_SIGMA_NEIGHBOURS)];
  ------------------
  |  |  158|  2.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|  2.09M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  2.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|  2.09M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  2.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|  2.09M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  2.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|  2.09M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  2.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|  2.09M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  2.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|  2.09M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|  2.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|  2.09M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|  2.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|  2.09M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|  2.09M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  257|  2.09M|}
t1.c:opj_t1_getctxtno_sc_or_spb_index:
  263|   951k|{
  264|       |    /*
  265|       |      0 pfX T1_CHI_THIS           T1_LUT_SGN_W
  266|       |      1 tfX T1_SIGMA_1            T1_LUT_SIG_N
  267|       |      2 nfX T1_CHI_THIS           T1_LUT_SGN_E
  268|       |      3 tfX T1_SIGMA_3            T1_LUT_SIG_W
  269|       |      4  fX T1_CHI_(THIS - 1)     T1_LUT_SGN_N
  270|       |      5 tfX T1_SIGMA_5            T1_LUT_SIG_E
  271|       |      6  fX T1_CHI_(THIS + 1)     T1_LUT_SGN_S
  272|       |      7 tfX T1_SIGMA_7            T1_LUT_SIG_S
  273|       |    */
  274|       |
  275|   951k|    OPJ_UINT32 lu = (fX >> (ci * 3U)) & (T1_SIGMA_1 | T1_SIGMA_3 | T1_SIGMA_5 |
  ------------------
  |  |   92|   951k|#define T1_SIGMA_1  (1U << 1)
  ------------------
                  OPJ_UINT32 lu = (fX >> (ci * 3U)) & (T1_SIGMA_1 | T1_SIGMA_3 | T1_SIGMA_5 |
  ------------------
  |  |   94|   951k|#define T1_SIGMA_3  (1U << 3)
  ------------------
                  OPJ_UINT32 lu = (fX >> (ci * 3U)) & (T1_SIGMA_1 | T1_SIGMA_3 | T1_SIGMA_5 |
  ------------------
  |  |   96|   951k|#define T1_SIGMA_5  (1U << 5)
  ------------------
  276|   951k|                                         T1_SIGMA_7);
  ------------------
  |  |   98|   951k|#define T1_SIGMA_7  (1U << 7)
  ------------------
  277|       |
  278|   951k|    lu |= (pfX >> (T1_CHI_THIS_I      + (ci * 3U))) & (1U << 0);
  ------------------
  |  |  161|   951k|#define T1_CHI_THIS_I T1_CHI_1_I
  |  |  ------------------
  |  |  |  |  113|   951k|#define T1_CHI_1_I  19
  |  |  ------------------
  ------------------
  279|   951k|    lu |= (nfX >> (T1_CHI_THIS_I - 2U + (ci * 3U))) & (1U << 2);
  ------------------
  |  |  161|   951k|#define T1_CHI_THIS_I T1_CHI_1_I
  |  |  ------------------
  |  |  |  |  113|   951k|#define T1_CHI_1_I  19
  |  |  ------------------
  ------------------
  280|   951k|    if (ci == 0U) {
  ------------------
  |  Branch (280:9): [True: 239k, False: 711k]
  ------------------
  281|   239k|        lu |= (fX >> (T1_CHI_0_I - 4U)) & (1U << 4);
  ------------------
  |  |  111|   239k|#define T1_CHI_0_I  18
  ------------------
  282|   711k|    } else {
  283|   711k|        lu |= (fX >> (T1_CHI_1_I - 4U + ((ci - 1U) * 3U))) & (1U << 4);
  ------------------
  |  |  113|   711k|#define T1_CHI_1_I  19
  ------------------
  284|   711k|    }
  285|   951k|    lu |= (fX >> (T1_CHI_2_I - 6U + (ci * 3U))) & (1U << 6);
  ------------------
  |  |  117|   951k|#define T1_CHI_2_I  22
  ------------------
  286|   951k|    return lu;
  287|   951k|}
t1.c:opj_t1_getctxno_sc:
  290|   951k|{
  291|   951k|    return lut_ctxno_sc[lu];
  292|   951k|}
t1.c:opj_t1_getspb:
  302|   951k|{
  303|   951k|    return lut_spb[lu];
  304|   951k|}
t1.c:opj_t1_dec_sigpass_step_mqc:
  470|  26.0k|{
  471|  26.0k|    OPJ_UINT32 v;
  472|       |
  473|  26.0k|    opj_mqc_t *mqc = &(t1->mqc);       /* MQC component */
  474|  26.0k|    opj_t1_dec_sigpass_step_mqc_macro(*flagsp, flagsp, flags_stride, datap,
  ------------------
  |  |  438|  26.0k|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  439|  26.0k|{ \
  |  |  440|  26.0k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  ------------------
  |  |  |  |  153|  26.0k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  26.0k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  ------------------
  |  |  |  |  163|  26.0k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  26.0k|#define T1_PI_0     (1U << 21)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (440:9): [True: 19.3k, False: 6.73k]
  |  |  ------------------
  |  |  441|  26.0k|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  ------------------
  |  |  |  |  158|  19.3k|#define T1_SIGMA_NEIGHBOURS (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|  19.3k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  19.3k|#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|  19.3k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  19.3k|#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|  19.3k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  19.3k|#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|  19.3k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  19.3k|#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|  19.3k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  19.3k|#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|  19.3k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   97|  19.3k|#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|  19.3k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   98|  19.3k|#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|  19.3k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   99|  19.3k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (441:9): [True: 808, False: 18.5k]
  |  |  ------------------
  |  |  442|    808|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  443|    808|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  ------------------
  |  |  |  |   65|    808|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  |  444|    808|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|    808|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|    808|{ \
  |  |  |  |  140|    808|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|    808|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|    808|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|    808|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|    808|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|    808|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 239, False: 569]
  |  |  |  |  ------------------
  |  |  |  |  146|    239|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    239|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|    239|{ \
  |  |  |  |  |  |   57|    239|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 59, False: 180]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|     59|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|     59|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|     59|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|    180|    } else { \
  |  |  |  |  |  |   62|    180|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|    180|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|    180|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|    180|    } \
  |  |  |  |  |  |   66|    239|}
  |  |  |  |  ------------------
  |  |  |  |  147|    239|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    239|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    239|{ \
  |  |  |  |  |  |  128|    344|    do { \
  |  |  |  |  |  |  129|    344|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 41, False: 303]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     41|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     41|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     41|{ \
  |  |  |  |  |  |  |  |  104|     41|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     41|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     41|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     41|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     41|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 32, False: 9]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     32|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 23, False: 9]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     23|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     23|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     23|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     23|            } else { \
  |  |  |  |  |  |  |  |  114|      9|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      9|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      9|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      9|            } \
  |  |  |  |  |  |  |  |  118|     32|        } else { \
  |  |  |  |  |  |  |  |  119|      9|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      9|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      9|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      9|        } \
  |  |  |  |  |  |  |  |  123|     41|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     41|        } \
  |  |  |  |  |  |  132|    344|        a <<= 1; \
  |  |  |  |  |  |  133|    344|        c <<= 1; \
  |  |  |  |  |  |  134|    344|        ct--; \
  |  |  |  |  |  |  135|    344|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 105, False: 239]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    239|}
  |  |  |  |  ------------------
  |  |  |  |  148|    569|    } else {  \
  |  |  |  |  149|    569|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|    569|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 198, False: 371]
  |  |  |  |  ------------------
  |  |  |  |  151|    198|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    198|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|    198|{ \
  |  |  |  |  |  |   45|    198|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 26, False: 172]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|     26|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|     26|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|    172|    } else { \
  |  |  |  |  |  |   49|    172|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|    172|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|    172|    } \
  |  |  |  |  |  |   52|    198|}
  |  |  |  |  ------------------
  |  |  |  |  152|    198|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    198|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    198|{ \
  |  |  |  |  |  |  128|    201|    do { \
  |  |  |  |  |  |  129|    201|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 28, False: 173]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     28|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     28|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     28|{ \
  |  |  |  |  |  |  |  |  104|     28|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     28|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     28|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     28|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     28|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 20, False: 8]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     20|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 16, False: 4]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     16|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     16|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     16|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     16|            } else { \
  |  |  |  |  |  |  |  |  114|      4|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      4|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      4|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      4|            } \
  |  |  |  |  |  |  |  |  118|     20|        } else { \
  |  |  |  |  |  |  |  |  119|      8|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      8|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      8|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      8|        } \
  |  |  |  |  |  |  |  |  123|     28|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     28|        } \
  |  |  |  |  |  |  132|    201|        a <<= 1; \
  |  |  |  |  |  |  133|    201|        c <<= 1; \
  |  |  |  |  |  |  134|    201|        ct--; \
  |  |  |  |  |  |  135|    201|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 3, False: 198]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    198|}
  |  |  |  |  ------------------
  |  |  |  |  153|    371|        } else { \
  |  |  |  |  154|    371|            d = (*curctx)->mps; \
  |  |  |  |  155|    371|        } \
  |  |  |  |  156|    569|    } \
  |  |  |  |  157|    808|}
  |  |  ------------------
  |  |  445|    808|        if (v) { \
  |  |  ------------------
  |  |  |  Branch (445:13): [True: 359, False: 449]
  |  |  ------------------
  |  |  446|    359|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  447|    359|                                flags, \
  |  |  448|    359|                                flagsp[-1], flagsp[1], \
  |  |  449|    359|                                ci); \
  |  |  450|    359|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  451|    359|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  452|    359|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  ------------------
  |  |  |  |   65|    359|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  |  453|    359|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|    359|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|    359|{ \
  |  |  |  |  140|    359|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|    359|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|    359|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|    359|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|    359|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|    359|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 101, False: 258]
  |  |  |  |  ------------------
  |  |  |  |  146|    101|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    101|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|    101|{ \
  |  |  |  |  |  |   57|    101|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 12, False: 89]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|     12|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|     12|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|     12|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|     89|    } else { \
  |  |  |  |  |  |   62|     89|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|     89|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|     89|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|     89|    } \
  |  |  |  |  |  |   66|    101|}
  |  |  |  |  ------------------
  |  |  |  |  147|    101|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    101|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    101|{ \
  |  |  |  |  |  |  128|    168|    do { \
  |  |  |  |  |  |  129|    168|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 14, False: 154]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     14|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     14|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     14|{ \
  |  |  |  |  |  |  |  |  104|     14|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     14|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     14|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     14|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     14|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 12, False: 2]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     12|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 10, False: 2]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     10|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     10|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     10|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     10|            } else { \
  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  118|     12|        } else { \
  |  |  |  |  |  |  |  |  119|      2|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      2|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      2|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      2|        } \
  |  |  |  |  |  |  |  |  123|     14|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     14|        } \
  |  |  |  |  |  |  132|    168|        a <<= 1; \
  |  |  |  |  |  |  133|    168|        c <<= 1; \
  |  |  |  |  |  |  134|    168|        ct--; \
  |  |  |  |  |  |  135|    168|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 67, False: 101]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    101|}
  |  |  |  |  ------------------
  |  |  |  |  148|    258|    } else {  \
  |  |  |  |  149|    258|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|    258|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 109, False: 149]
  |  |  |  |  ------------------
  |  |  |  |  151|    109|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    109|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|    109|{ \
  |  |  |  |  |  |   45|    109|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 18, False: 91]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|     18|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|     18|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|     91|    } else { \
  |  |  |  |  |  |   49|     91|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|     91|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|     91|    } \
  |  |  |  |  |  |   52|    109|}
  |  |  |  |  ------------------
  |  |  |  |  152|    109|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    109|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    109|{ \
  |  |  |  |  |  |  128|    116|    do { \
  |  |  |  |  |  |  129|    116|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 19, False: 97]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     19|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     19|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     19|{ \
  |  |  |  |  |  |  |  |  104|     19|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     19|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     19|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     19|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     19|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 16, False: 3]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     16|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13, False: 3]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     13|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     13|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     13|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     13|            } else { \
  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  118|     16|        } else { \
  |  |  |  |  |  |  |  |  119|      3|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      3|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      3|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      3|        } \
  |  |  |  |  |  |  |  |  123|     19|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     19|        } \
  |  |  |  |  |  |  132|    116|        a <<= 1; \
  |  |  |  |  |  |  133|    116|        c <<= 1; \
  |  |  |  |  |  |  134|    116|        ct--; \
  |  |  |  |  |  |  135|    116|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 7, False: 109]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    109|}
  |  |  |  |  ------------------
  |  |  |  |  153|    149|        } else { \
  |  |  |  |  154|    149|            d = (*curctx)->mps; \
  |  |  |  |  155|    149|        } \
  |  |  |  |  156|    258|    } \
  |  |  |  |  157|    359|}
  |  |  ------------------
  |  |  454|    359|            v = v ^ spb; \
  |  |  455|    359|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  ------------------
  |  |  |  Branch (455:36): [True: 163, False: 196]
  |  |  ------------------
  |  |  456|    359|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  ------------------
  |  |  |  |  324|    359|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  325|    359|{ \
  |  |  |  |  326|    359|    /* east */ \
  |  |  |  |  327|    359|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|    359|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  ------------------
  |  |  |  |  328|    359| \
  |  |  |  |  329|    359|    /* mark target as significant */ \
  |  |  |  |  330|    359|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|    359|#define T1_CHI_1_I  19
  |  |  |  |  ------------------
  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|    359|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  |  |  331|    359| \
  |  |  |  |  332|    359|    /* west */ \
  |  |  |  |  333|    359|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|    359|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  ------------------
  |  |  |  |  334|    359| \
  |  |  |  |  335|    359|    /* north-west, north, north-east */ \
  |  |  |  |  336|    359|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (336:9): [True: 348, False: 11]
  |  |  |  |  |  Branch (336:21): [True: 17, False: 331]
  |  |  |  |  ------------------
  |  |  |  |  337|     17|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  338|     17|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  127|     17|#define T1_CHI_5_I  31
  |  |  |  |  ------------------
  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|     17|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  ------------------
  |  |  |  |  339|     17|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|     17|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  ------------------
  |  |  |  |  340|     17|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|     17|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  ------------------
  |  |  |  |  341|     17|    } \
  |  |  |  |  342|    359| \
  |  |  |  |  343|    359|    /* south-west, south, south-east */ \
  |  |  |  |  344|    359|    if (ci == 3U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:9): [True: 0, False: 359]
  |  |  |  |  ------------------
  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  ------------------
  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  ------------------
  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  ------------------
  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  ------------------
  |  |  |  |  349|      0|    } \
  |  |  |  |  350|    359|}
  |  |  ------------------
  |  |  457|    359|        } \
  |  |  458|    808|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  ------------------
  |  |  |  |  163|    808|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|    808|#define T1_PI_0     (1U << 21)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  459|    808|    } \
  |  |  460|  26.0k|}
  ------------------
  475|  26.0k|                                      0, ci, mqc, mqc->curctx,
  476|  26.0k|                                      v, mqc->a, mqc->c, mqc->ct, oneplushalf, vsc);
  477|  26.0k|}
t1.c:opj_t1_dec_sigpass_mqc_generic_vsc:
  715|    171|{
  716|    171|    opj_t1_dec_sigpass_mqc_internal(t1, bpno, OPJ_TRUE, t1->w, t1->h,
  ------------------
  |  |  646|    171|#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  |  647|    171|{ \
  |  |  648|    171|        OPJ_INT32 one, half, oneplushalf; \
  |  |  649|    171|        OPJ_UINT32 i, j, k; \
  |  |  650|    171|        register OPJ_INT32 *data = t1->data; \
  |  |  651|    171|        register opj_flag_t *flagsp = &t1->flags[(flags_stride) + 1]; \
  |  |  652|    171|        const OPJ_UINT32 l_w = w; \
  |  |  653|    171|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  654|    171|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|    171|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|    171|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|    171|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|    171|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  655|    171|        register OPJ_UINT32 v; \
  |  |  656|    171|        one = 1 << bpno; \
  |  |  657|    171|        half = one >> 1; \
  |  |  658|    171|        oneplushalf = one | half; \
  |  |  659|    548|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (659:21): [True: 377, False: 171]
  |  |  ------------------
  |  |  660|  23.6k|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (660:29): [True: 23.2k, False: 377]
  |  |  ------------------
  |  |  661|  23.2k|                        opj_flag_t flags = *flagsp; \
  |  |  662|  23.2k|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (662:29): [True: 13.4k, False: 9.80k]
  |  |  ------------------
  |  |  663|  13.4k|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  13.4k|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  13.4k|{ \
  |  |  |  |  440|  13.4k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  13.4k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.4k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  13.4k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  13.4k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 1.32k, False: 12.1k]
  |  |  |  |  ------------------
  |  |  |  |  441|  13.4k|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  1.32k|#define T1_SIGMA_NEIGHBOURS (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.32k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  1.32k|#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.32k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  1.32k|#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.32k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  1.32k|#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.32k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  1.32k|#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.32k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  1.32k|#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.32k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  1.32k|#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.32k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  1.32k|#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.32k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  1.32k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 1.24k, False: 73]
  |  |  |  |  ------------------
  |  |  |  |  442|  1.24k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|  1.24k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.24k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|  1.24k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.24k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.24k|{ \
  |  |  |  |  |  |  140|  1.24k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.24k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.24k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.24k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.24k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.24k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 303, False: 945]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    303|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    303|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    303|{ \
  |  |  |  |  |  |  |  |   57|    303|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 65, False: 238]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     65|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     65|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     65|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    238|    } else { \
  |  |  |  |  |  |  |  |   62|    238|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    238|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    238|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    238|    } \
  |  |  |  |  |  |  |  |   66|    303|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    303|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    303|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    303|{ \
  |  |  |  |  |  |  |  |  128|    434|    do { \
  |  |  |  |  |  |  |  |  129|    434|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 58, False: 376]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     58|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     58|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     58|{ \
  |  |  |  |  |  |  |  |  |  |  104|     58|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     58|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     58|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     58|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     58|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 42, False: 16]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     42|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 39, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     39|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     39|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     39|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     39|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  |  |  118|     42|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     16|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     16|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     16|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     16|        } \
  |  |  |  |  |  |  |  |  |  |  123|     58|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     58|        } \
  |  |  |  |  |  |  |  |  132|    434|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    434|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    434|        ct--; \
  |  |  |  |  |  |  |  |  135|    434|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 131, False: 303]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    303|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    945|    } else {  \
  |  |  |  |  |  |  149|    945|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    945|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 319, False: 626]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    319|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    319|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    319|{ \
  |  |  |  |  |  |  |  |   45|    319|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 58, False: 261]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     58|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     58|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    261|    } else { \
  |  |  |  |  |  |  |  |   49|    261|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    261|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    261|    } \
  |  |  |  |  |  |  |  |   52|    319|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    319|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    319|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    319|{ \
  |  |  |  |  |  |  |  |  128|    343|    do { \
  |  |  |  |  |  |  |  |  129|    343|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 39, False: 304]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     39|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     39|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     39|{ \
  |  |  |  |  |  |  |  |  |  |  104|     39|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     39|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     39|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     39|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     39|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 34, False: 5]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     34|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 31, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     31|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     31|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     31|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     31|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  |  |  118|     34|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      5|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      5|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      5|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      5|        } \
  |  |  |  |  |  |  |  |  |  |  123|     39|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     39|        } \
  |  |  |  |  |  |  |  |  132|    343|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    343|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    343|        ct--; \
  |  |  |  |  |  |  |  |  135|    343|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 24, False: 319]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    319|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    626|        } else { \
  |  |  |  |  |  |  154|    626|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    626|        } \
  |  |  |  |  |  |  156|    945|    } \
  |  |  |  |  |  |  157|  1.24k|}
  |  |  |  |  ------------------
  |  |  |  |  445|  1.24k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 602, False: 646]
  |  |  |  |  ------------------
  |  |  |  |  446|    602|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|    602|                                flags, \
  |  |  |  |  448|    602|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|    602|                                ci); \
  |  |  |  |  450|    602|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|    602|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|    602|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    602|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|    602|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    602|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    602|{ \
  |  |  |  |  |  |  140|    602|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    602|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    602|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    602|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    602|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    602|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 129, False: 473]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    129|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    129|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    129|{ \
  |  |  |  |  |  |  |  |   57|    129|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 32, False: 97]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     32|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     32|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     32|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|     97|    } else { \
  |  |  |  |  |  |  |  |   62|     97|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|     97|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|     97|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|     97|    } \
  |  |  |  |  |  |  |  |   66|    129|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    129|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    129|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    129|{ \
  |  |  |  |  |  |  |  |  128|    195|    do { \
  |  |  |  |  |  |  |  |  129|    195|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 24, False: 171]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     24|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     24|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     24|{ \
  |  |  |  |  |  |  |  |  |  |  104|     24|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     24|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     24|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     24|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     24|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 18, False: 6]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     18|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 18, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     18|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     18|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     18|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     18|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|     18|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      6|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      6|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      6|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      6|        } \
  |  |  |  |  |  |  |  |  |  |  123|     24|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     24|        } \
  |  |  |  |  |  |  |  |  132|    195|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    195|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    195|        ct--; \
  |  |  |  |  |  |  |  |  135|    195|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 66, False: 129]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    129|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    473|    } else {  \
  |  |  |  |  |  |  149|    473|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    473|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 174, False: 299]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    174|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    174|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    174|{ \
  |  |  |  |  |  |  |  |   45|    174|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 31, False: 143]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     31|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     31|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    143|    } else { \
  |  |  |  |  |  |  |  |   49|    143|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    143|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    143|    } \
  |  |  |  |  |  |  |  |   52|    174|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    174|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    174|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    174|{ \
  |  |  |  |  |  |  |  |  128|    186|    do { \
  |  |  |  |  |  |  |  |  129|    186|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 25, False: 161]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     25|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     25|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     25|{ \
  |  |  |  |  |  |  |  |  |  |  104|     25|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     25|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     25|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     25|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     25|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 23, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     23|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 18, False: 5]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     18|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     18|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     18|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     18|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      5|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      5|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      5|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      5|            } \
  |  |  |  |  |  |  |  |  |  |  118|     23|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      2|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      2|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      2|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      2|        } \
  |  |  |  |  |  |  |  |  |  |  123|     25|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     25|        } \
  |  |  |  |  |  |  |  |  132|    186|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    186|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    186|        ct--; \
  |  |  |  |  |  |  |  |  135|    186|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 12, False: 174]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    174|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    299|        } else { \
  |  |  |  |  |  |  154|    299|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    299|        } \
  |  |  |  |  |  |  156|    473|    } \
  |  |  |  |  |  |  157|    602|}
  |  |  |  |  ------------------
  |  |  |  |  454|    602|            v = v ^ spb; \
  |  |  |  |  455|    602|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 281, False: 321]
  |  |  |  |  ------------------
  |  |  |  |  456|    602|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|    602|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|    602|{ \
  |  |  |  |  |  |  326|    602|    /* east */ \
  |  |  |  |  |  |  327|    602|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|    602|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|    602| \
  |  |  |  |  |  |  329|    602|    /* mark target as significant */ \
  |  |  |  |  |  |  330|    602|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|    602|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|    602|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|    602| \
  |  |  |  |  |  |  332|    602|    /* west */ \
  |  |  |  |  |  |  333|    602|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|    602|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|    602| \
  |  |  |  |  |  |  335|    602|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|    602|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|    602| \
  |  |  |  |  |  |  343|    602|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|    602|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|    602|}
  |  |  |  |  ------------------
  |  |  |  |  457|    602|        } \
  |  |  |  |  458|  1.24k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.24k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.24k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|  1.24k|    } \
  |  |  |  |  460|  13.4k|}
  |  |  ------------------
  |  |  664|  13.4k|                                flags, flagsp, flags_stride, data, \
  |  |  665|  13.4k|                                l_w, 0, mqc, curctx, v, a, c, ct, oneplushalf, vsc); \
  |  |  666|  13.4k|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  13.4k|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  13.4k|{ \
  |  |  |  |  440|  13.4k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  13.4k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.4k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  13.4k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  13.4k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 1.33k, False: 12.0k]
  |  |  |  |  ------------------
  |  |  |  |  441|  13.4k|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  1.33k|#define T1_SIGMA_NEIGHBOURS (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.33k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  1.33k|#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.33k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  1.33k|#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.33k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  1.33k|#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.33k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  1.33k|#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.33k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  1.33k|#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.33k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  1.33k|#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.33k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  1.33k|#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.33k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  1.33k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 1.30k, False: 31]
  |  |  |  |  ------------------
  |  |  |  |  442|  1.30k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|  1.30k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.30k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|  1.30k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.30k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.30k|{ \
  |  |  |  |  |  |  140|  1.30k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.30k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.30k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.30k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.30k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.30k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 360, False: 941]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    360|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    360|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    360|{ \
  |  |  |  |  |  |  |  |   57|    360|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 103, False: 257]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    103|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    103|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    103|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    257|    } else { \
  |  |  |  |  |  |  |  |   62|    257|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    257|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    257|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    257|    } \
  |  |  |  |  |  |  |  |   66|    360|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    360|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    360|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    360|{ \
  |  |  |  |  |  |  |  |  128|    496|    do { \
  |  |  |  |  |  |  |  |  129|    496|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 62, False: 434]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     62|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     62|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     62|{ \
  |  |  |  |  |  |  |  |  |  |  104|     62|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     62|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     62|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     62|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     62|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 42, False: 20]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     42|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 39, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     39|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     39|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     39|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     39|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  |  |  118|     42|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     20|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     20|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     20|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     20|        } \
  |  |  |  |  |  |  |  |  |  |  123|     62|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     62|        } \
  |  |  |  |  |  |  |  |  132|    496|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    496|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    496|        ct--; \
  |  |  |  |  |  |  |  |  135|    496|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 136, False: 360]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    360|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    941|    } else {  \
  |  |  |  |  |  |  149|    941|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    941|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 346, False: 595]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    346|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    346|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    346|{ \
  |  |  |  |  |  |  |  |   45|    346|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 74, False: 272]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     74|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     74|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    272|    } else { \
  |  |  |  |  |  |  |  |   49|    272|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    272|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    272|    } \
  |  |  |  |  |  |  |  |   52|    346|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    346|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    346|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    346|{ \
  |  |  |  |  |  |  |  |  128|    371|    do { \
  |  |  |  |  |  |  |  |  129|    371|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 42, False: 329]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     42|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     42|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     42|{ \
  |  |  |  |  |  |  |  |  |  |  104|     42|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     42|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     42|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     42|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     42|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 38, False: 4]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     38|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 31, False: 7]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     31|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     31|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     31|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     31|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      7|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      7|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      7|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      7|            } \
  |  |  |  |  |  |  |  |  |  |  118|     38|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      4|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      4|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      4|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      4|        } \
  |  |  |  |  |  |  |  |  |  |  123|     42|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     42|        } \
  |  |  |  |  |  |  |  |  132|    371|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    371|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    371|        ct--; \
  |  |  |  |  |  |  |  |  135|    371|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 25, False: 346]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    346|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    595|        } else { \
  |  |  |  |  |  |  154|    595|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    595|        } \
  |  |  |  |  |  |  156|    941|    } \
  |  |  |  |  |  |  157|  1.30k|}
  |  |  |  |  ------------------
  |  |  |  |  445|  1.30k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 637, False: 664]
  |  |  |  |  ------------------
  |  |  |  |  446|    637|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|    637|                                flags, \
  |  |  |  |  448|    637|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|    637|                                ci); \
  |  |  |  |  450|    637|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|    637|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|    637|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    637|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|    637|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    637|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    637|{ \
  |  |  |  |  |  |  140|    637|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    637|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    637|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    637|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    637|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    637|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 150, False: 487]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    150|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    150|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    150|{ \
  |  |  |  |  |  |  |  |   57|    150|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 40, False: 110]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     40|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     40|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     40|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    110|    } else { \
  |  |  |  |  |  |  |  |   62|    110|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    110|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    110|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    110|    } \
  |  |  |  |  |  |  |  |   66|    150|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    150|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    150|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    150|{ \
  |  |  |  |  |  |  |  |  128|    219|    do { \
  |  |  |  |  |  |  |  |  129|    219|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 23, False: 196]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     23|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     23|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     23|{ \
  |  |  |  |  |  |  |  |  |  |  104|     23|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     23|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     23|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     23|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     23|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 22, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     22|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 19, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     19|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     19|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     19|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     19|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  |  |  118|     22|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      1|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      1|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      1|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      1|        } \
  |  |  |  |  |  |  |  |  |  |  123|     23|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     23|        } \
  |  |  |  |  |  |  |  |  132|    219|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    219|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    219|        ct--; \
  |  |  |  |  |  |  |  |  135|    219|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 69, False: 150]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    150|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    487|    } else {  \
  |  |  |  |  |  |  149|    487|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    487|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 192, False: 295]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    192|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    192|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    192|{ \
  |  |  |  |  |  |  |  |   45|    192|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 44, False: 148]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     44|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     44|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    148|    } else { \
  |  |  |  |  |  |  |  |   49|    148|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    148|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    148|    } \
  |  |  |  |  |  |  |  |   52|    192|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    192|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    192|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    192|{ \
  |  |  |  |  |  |  |  |  128|    213|    do { \
  |  |  |  |  |  |  |  |  129|    213|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 35, False: 178]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     35|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     35|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     35|{ \
  |  |  |  |  |  |  |  |  |  |  104|     35|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     35|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     35|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     35|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     35|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 31, False: 4]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     31|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 21, False: 10]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     21|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     21|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     21|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     21|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     10|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     10|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     10|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     10|            } \
  |  |  |  |  |  |  |  |  |  |  118|     31|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      4|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      4|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      4|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      4|        } \
  |  |  |  |  |  |  |  |  |  |  123|     35|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     35|        } \
  |  |  |  |  |  |  |  |  132|    213|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    213|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    213|        ct--; \
  |  |  |  |  |  |  |  |  135|    213|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 21, False: 192]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    192|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    295|        } else { \
  |  |  |  |  |  |  154|    295|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    295|        } \
  |  |  |  |  |  |  156|    487|    } \
  |  |  |  |  |  |  157|    637|}
  |  |  |  |  ------------------
  |  |  |  |  454|    637|            v = v ^ spb; \
  |  |  |  |  455|    637|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 324, False: 313]
  |  |  |  |  ------------------
  |  |  |  |  456|    637|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|    637|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|    637|{ \
  |  |  |  |  |  |  326|    637|    /* east */ \
  |  |  |  |  |  |  327|    637|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|    637|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|    637| \
  |  |  |  |  |  |  329|    637|    /* mark target as significant */ \
  |  |  |  |  |  |  330|    637|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|    637|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|    637|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|    637| \
  |  |  |  |  |  |  332|    637|    /* west */ \
  |  |  |  |  |  |  333|    637|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|    637|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|    637| \
  |  |  |  |  |  |  335|    637|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|    637|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|    637| \
  |  |  |  |  |  |  343|    637|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|    637|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|    637|}
  |  |  |  |  ------------------
  |  |  |  |  457|    637|        } \
  |  |  |  |  458|  1.30k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.30k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.30k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|  1.30k|    } \
  |  |  |  |  460|  13.4k|}
  |  |  ------------------
  |  |  667|  13.4k|                                flags, flagsp, flags_stride, data, \
  |  |  668|  13.4k|                                l_w, 1, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  669|  13.4k|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  13.4k|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  13.4k|{ \
  |  |  |  |  440|  13.4k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  13.4k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.4k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  13.4k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  13.4k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 1.24k, False: 12.1k]
  |  |  |  |  ------------------
  |  |  |  |  441|  13.4k|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  1.24k|#define T1_SIGMA_NEIGHBOURS (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.24k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  1.24k|#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.24k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  1.24k|#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.24k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  1.24k|#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.24k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  1.24k|#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.24k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  1.24k|#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.24k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  1.24k|#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.24k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  1.24k|#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.24k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  1.24k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 1.21k, False: 27]
  |  |  |  |  ------------------
  |  |  |  |  442|  1.21k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|  1.21k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.21k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|  1.21k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.21k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.21k|{ \
  |  |  |  |  |  |  140|  1.21k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.21k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.21k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.21k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.21k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.21k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 305, False: 912]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    305|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    305|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    305|{ \
  |  |  |  |  |  |  |  |   57|    305|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 83, False: 222]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     83|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     83|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     83|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    222|    } else { \
  |  |  |  |  |  |  |  |   62|    222|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    222|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    222|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    222|    } \
  |  |  |  |  |  |  |  |   66|    305|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    305|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    305|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    305|{ \
  |  |  |  |  |  |  |  |  128|    423|    do { \
  |  |  |  |  |  |  |  |  129|    423|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 52, False: 371]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     52|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     52|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     52|{ \
  |  |  |  |  |  |  |  |  |  |  104|     52|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     52|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     52|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     52|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     52|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 45, False: 7]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     45|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 41, False: 4]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     41|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     41|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     41|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     41|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      4|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      4|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      4|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      4|            } \
  |  |  |  |  |  |  |  |  |  |  118|     45|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      7|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      7|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      7|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      7|        } \
  |  |  |  |  |  |  |  |  |  |  123|     52|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     52|        } \
  |  |  |  |  |  |  |  |  132|    423|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    423|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    423|        ct--; \
  |  |  |  |  |  |  |  |  135|    423|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 118, False: 305]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    305|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    912|    } else {  \
  |  |  |  |  |  |  149|    912|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    912|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 347, False: 565]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    347|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    347|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    347|{ \
  |  |  |  |  |  |  |  |   45|    347|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 71, False: 276]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     71|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     71|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    276|    } else { \
  |  |  |  |  |  |  |  |   49|    276|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    276|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    276|    } \
  |  |  |  |  |  |  |  |   52|    347|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    347|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    347|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    347|{ \
  |  |  |  |  |  |  |  |  128|    380|    do { \
  |  |  |  |  |  |  |  |  129|    380|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 55, False: 325]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     55|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     55|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     55|{ \
  |  |  |  |  |  |  |  |  |  |  104|     55|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     55|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     55|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     55|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     55|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 45, False: 10]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     45|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 37, False: 8]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     37|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     37|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     37|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     37|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      8|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      8|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      8|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      8|            } \
  |  |  |  |  |  |  |  |  |  |  118|     45|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     10|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     10|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     10|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     10|        } \
  |  |  |  |  |  |  |  |  |  |  123|     55|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     55|        } \
  |  |  |  |  |  |  |  |  132|    380|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    380|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    380|        ct--; \
  |  |  |  |  |  |  |  |  135|    380|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 33, False: 347]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    347|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    565|        } else { \
  |  |  |  |  |  |  154|    565|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    565|        } \
  |  |  |  |  |  |  156|    912|    } \
  |  |  |  |  |  |  157|  1.21k|}
  |  |  |  |  ------------------
  |  |  |  |  445|  1.21k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 617, False: 600]
  |  |  |  |  ------------------
  |  |  |  |  446|    617|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|    617|                                flags, \
  |  |  |  |  448|    617|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|    617|                                ci); \
  |  |  |  |  450|    617|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|    617|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|    617|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    617|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|    617|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    617|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    617|{ \
  |  |  |  |  |  |  140|    617|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    617|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    617|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    617|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    617|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    617|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 159, False: 458]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    159|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    159|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    159|{ \
  |  |  |  |  |  |  |  |   57|    159|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 43, False: 116]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     43|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     43|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     43|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    116|    } else { \
  |  |  |  |  |  |  |  |   62|    116|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    116|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    116|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    116|    } \
  |  |  |  |  |  |  |  |   66|    159|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    159|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    159|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    159|{ \
  |  |  |  |  |  |  |  |  128|    249|    do { \
  |  |  |  |  |  |  |  |  129|    249|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 27, False: 222]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     27|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     27|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     27|{ \
  |  |  |  |  |  |  |  |  |  |  104|     27|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     27|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     27|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     27|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     27|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 22, False: 5]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     22|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 20, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     20|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     20|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     20|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     20|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|     22|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      5|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      5|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      5|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      5|        } \
  |  |  |  |  |  |  |  |  |  |  123|     27|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     27|        } \
  |  |  |  |  |  |  |  |  132|    249|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    249|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    249|        ct--; \
  |  |  |  |  |  |  |  |  135|    249|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 90, False: 159]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    159|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    458|    } else {  \
  |  |  |  |  |  |  149|    458|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    458|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 172, False: 286]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    172|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    172|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    172|{ \
  |  |  |  |  |  |  |  |   45|    172|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 36, False: 136]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     36|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     36|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    136|    } else { \
  |  |  |  |  |  |  |  |   49|    136|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    136|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    136|    } \
  |  |  |  |  |  |  |  |   52|    172|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    172|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    172|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    172|{ \
  |  |  |  |  |  |  |  |  128|    191|    do { \
  |  |  |  |  |  |  |  |  129|    191|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16, False: 175]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     16|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     16|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     16|{ \
  |  |  |  |  |  |  |  |  |  |  104|     16|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     16|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     16|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     16|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     16|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 14, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     14|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     13|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     13|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     13|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     13|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|     14|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      2|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      2|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      2|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      2|        } \
  |  |  |  |  |  |  |  |  |  |  123|     16|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     16|        } \
  |  |  |  |  |  |  |  |  132|    191|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    191|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    191|        ct--; \
  |  |  |  |  |  |  |  |  135|    191|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 19, False: 172]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    172|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    286|        } else { \
  |  |  |  |  |  |  154|    286|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    286|        } \
  |  |  |  |  |  |  156|    458|    } \
  |  |  |  |  |  |  157|    617|}
  |  |  |  |  ------------------
  |  |  |  |  454|    617|            v = v ^ spb; \
  |  |  |  |  455|    617|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 305, False: 312]
  |  |  |  |  ------------------
  |  |  |  |  456|    617|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|    617|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|    617|{ \
  |  |  |  |  |  |  326|    617|    /* east */ \
  |  |  |  |  |  |  327|    617|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|    617|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|    617| \
  |  |  |  |  |  |  329|    617|    /* mark target as significant */ \
  |  |  |  |  |  |  330|    617|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|    617|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|    617|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|    617| \
  |  |  |  |  |  |  332|    617|    /* west */ \
  |  |  |  |  |  |  333|    617|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|    617|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|    617| \
  |  |  |  |  |  |  335|    617|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|    617|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|    617| \
  |  |  |  |  |  |  343|    617|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|    617|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|    617|}
  |  |  |  |  ------------------
  |  |  |  |  457|    617|        } \
  |  |  |  |  458|  1.21k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.21k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.21k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|  1.21k|    } \
  |  |  |  |  460|  13.4k|}
  |  |  ------------------
  |  |  670|  13.4k|                                flags, flagsp, flags_stride, data, \
  |  |  671|  13.4k|                                l_w, 2, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  672|  13.4k|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  13.4k|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  13.4k|{ \
  |  |  |  |  440|  13.4k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  13.4k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  13.4k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  13.4k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  13.4k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 1.29k, False: 12.1k]
  |  |  |  |  ------------------
  |  |  |  |  441|  13.4k|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  1.29k|#define T1_SIGMA_NEIGHBOURS (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.29k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  1.29k|#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.29k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  1.29k|#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.29k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  1.29k|#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.29k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  1.29k|#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.29k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  1.29k|#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.29k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  1.29k|#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.29k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  1.29k|#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.29k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  1.29k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 1.22k, False: 64]
  |  |  |  |  ------------------
  |  |  |  |  442|  1.22k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|  1.22k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.22k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|  1.22k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.22k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.22k|{ \
  |  |  |  |  |  |  140|  1.22k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.22k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.22k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.22k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.22k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.22k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 318, False: 908]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    318|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    318|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    318|{ \
  |  |  |  |  |  |  |  |   57|    318|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 80, False: 238]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     80|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     80|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     80|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    238|    } else { \
  |  |  |  |  |  |  |  |   62|    238|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    238|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    238|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    238|    } \
  |  |  |  |  |  |  |  |   66|    318|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    318|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    318|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    318|{ \
  |  |  |  |  |  |  |  |  128|    462|    do { \
  |  |  |  |  |  |  |  |  129|    462|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 59, False: 403]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     59|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     59|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     59|{ \
  |  |  |  |  |  |  |  |  |  |  104|     59|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     59|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     59|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     59|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     59|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 50, False: 9]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     50|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 45, False: 5]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     45|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     45|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     45|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     45|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      5|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      5|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      5|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      5|            } \
  |  |  |  |  |  |  |  |  |  |  118|     50|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      9|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      9|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      9|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      9|        } \
  |  |  |  |  |  |  |  |  |  |  123|     59|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     59|        } \
  |  |  |  |  |  |  |  |  132|    462|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    462|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    462|        ct--; \
  |  |  |  |  |  |  |  |  135|    462|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 144, False: 318]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    318|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    908|    } else {  \
  |  |  |  |  |  |  149|    908|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    908|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 324, False: 584]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    324|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    324|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    324|{ \
  |  |  |  |  |  |  |  |   45|    324|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 40, False: 284]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     40|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     40|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    284|    } else { \
  |  |  |  |  |  |  |  |   49|    284|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    284|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    284|    } \
  |  |  |  |  |  |  |  |   52|    324|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    324|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    324|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    324|{ \
  |  |  |  |  |  |  |  |  128|    340|    do { \
  |  |  |  |  |  |  |  |  129|    340|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 38, False: 302]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     38|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     38|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     38|{ \
  |  |  |  |  |  |  |  |  |  |  104|     38|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     38|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     38|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     38|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     38|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 33, False: 5]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     33|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 28, False: 5]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     28|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     28|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     28|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     28|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      5|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      5|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      5|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      5|            } \
  |  |  |  |  |  |  |  |  |  |  118|     33|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      5|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      5|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      5|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      5|        } \
  |  |  |  |  |  |  |  |  |  |  123|     38|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     38|        } \
  |  |  |  |  |  |  |  |  132|    340|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    340|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    340|        ct--; \
  |  |  |  |  |  |  |  |  135|    340|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 16, False: 324]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    324|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    584|        } else { \
  |  |  |  |  |  |  154|    584|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    584|        } \
  |  |  |  |  |  |  156|    908|    } \
  |  |  |  |  |  |  157|  1.22k|}
  |  |  |  |  ------------------
  |  |  |  |  445|  1.22k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 597, False: 629]
  |  |  |  |  ------------------
  |  |  |  |  446|    597|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|    597|                                flags, \
  |  |  |  |  448|    597|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|    597|                                ci); \
  |  |  |  |  450|    597|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|    597|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|    597|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    597|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|    597|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    597|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    597|{ \
  |  |  |  |  |  |  140|    597|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    597|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    597|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    597|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    597|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    597|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 127, False: 470]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    127|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    127|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    127|{ \
  |  |  |  |  |  |  |  |   57|    127|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 29, False: 98]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     29|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     29|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     29|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|     98|    } else { \
  |  |  |  |  |  |  |  |   62|     98|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|     98|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|     98|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|     98|    } \
  |  |  |  |  |  |  |  |   66|    127|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    127|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    127|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    127|{ \
  |  |  |  |  |  |  |  |  128|    199|    do { \
  |  |  |  |  |  |  |  |  129|    199|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 31, False: 168]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     31|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     31|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     31|{ \
  |  |  |  |  |  |  |  |  |  |  104|     31|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     31|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     31|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     31|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     31|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 24, False: 7]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     24|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 22, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     22|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     22|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     22|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     22|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|     24|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      7|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      7|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      7|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      7|        } \
  |  |  |  |  |  |  |  |  |  |  123|     31|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     31|        } \
  |  |  |  |  |  |  |  |  132|    199|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    199|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    199|        ct--; \
  |  |  |  |  |  |  |  |  135|    199|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 72, False: 127]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    127|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    470|    } else {  \
  |  |  |  |  |  |  149|    470|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    470|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 194, False: 276]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    194|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    194|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    194|{ \
  |  |  |  |  |  |  |  |   45|    194|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 26, False: 168]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     26|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     26|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    168|    } else { \
  |  |  |  |  |  |  |  |   49|    168|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    168|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    168|    } \
  |  |  |  |  |  |  |  |   52|    194|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    194|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    194|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    194|{ \
  |  |  |  |  |  |  |  |  128|    210|    do { \
  |  |  |  |  |  |  |  |  129|    210|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 29, False: 181]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     29|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     29|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     29|{ \
  |  |  |  |  |  |  |  |  |  |  104|     29|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     29|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     29|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     29|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     29|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 23, False: 6]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     23|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 21, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     21|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     21|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     21|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     21|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|     23|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      6|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      6|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      6|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      6|        } \
  |  |  |  |  |  |  |  |  |  |  123|     29|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     29|        } \
  |  |  |  |  |  |  |  |  132|    210|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    210|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    210|        ct--; \
  |  |  |  |  |  |  |  |  135|    210|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 16, False: 194]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    194|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    276|        } else { \
  |  |  |  |  |  |  154|    276|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    276|        } \
  |  |  |  |  |  |  156|    470|    } \
  |  |  |  |  |  |  157|    597|}
  |  |  |  |  ------------------
  |  |  |  |  454|    597|            v = v ^ spb; \
  |  |  |  |  455|    597|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 280, False: 317]
  |  |  |  |  ------------------
  |  |  |  |  456|    597|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|    597|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|    597|{ \
  |  |  |  |  |  |  326|    597|    /* east */ \
  |  |  |  |  |  |  327|    597|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|    597|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|    597| \
  |  |  |  |  |  |  329|    597|    /* mark target as significant */ \
  |  |  |  |  |  |  330|    597|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|    597|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|    597|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|    597| \
  |  |  |  |  |  |  332|    597|    /* west */ \
  |  |  |  |  |  |  333|    597|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|    597|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|    597| \
  |  |  |  |  |  |  335|    597|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|    597|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|    597| \
  |  |  |  |  |  |  343|    597|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|    597|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|    597|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|    597|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|    597|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|    597|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|    597|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|    597|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|    597|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|    597|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|    597|    } \
  |  |  |  |  |  |  350|    597|}
  |  |  |  |  ------------------
  |  |  |  |  457|    597|        } \
  |  |  |  |  458|  1.22k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.22k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.22k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|  1.22k|    } \
  |  |  |  |  460|  13.4k|}
  |  |  ------------------
  |  |  673|  13.4k|                                flags, flagsp, flags_stride, data, \
  |  |  674|  13.4k|                                l_w, 3, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  675|  13.4k|                            *flagsp = flags; \
  |  |  676|  13.4k|                        } \
  |  |  677|  23.2k|                } \
  |  |  678|    377|        } \
  |  |  679|    171|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|    171|        mqc->curctx = curctx; \
  |  |  |  |  167|    171|        mqc->c = c; \
  |  |  |  |  168|    171|        mqc->a = a; \
  |  |  |  |  169|    171|        mqc->ct = ct;
  |  |  ------------------
  |  |  680|    171|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (680:13): [True: 163, False: 8]
  |  |  ------------------
  |  |  681|  10.5k|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (681:25): [True: 10.4k, False: 163]
  |  |  ------------------
  |  |  682|  20.8k|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (682:29): [True: 10.4k, False: 10.4k]
  |  |  ------------------
  |  |  683|  10.4k|                        opj_t1_dec_sigpass_step_mqc(t1, flagsp, \
  |  |  684|  10.4k|                            data + j * l_w, oneplushalf, j, flags_stride, vsc); \
  |  |  685|  10.4k|                } \
  |  |  686|  10.4k|            } \
  |  |  687|    163|        } \
  |  |  688|    171|}
  ------------------
  717|    171|                                    t1->w + 2U);
  718|    171|}
t1.c:opj_t1_dec_sigpass_mqc_generic_novsc:
  707|    121|{
  708|    121|    opj_t1_dec_sigpass_mqc_internal(t1, bpno, OPJ_FALSE, t1->w, t1->h,
  ------------------
  |  |  646|    121|#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  |  647|    121|{ \
  |  |  648|    121|        OPJ_INT32 one, half, oneplushalf; \
  |  |  649|    121|        OPJ_UINT32 i, j, k; \
  |  |  650|    121|        register OPJ_INT32 *data = t1->data; \
  |  |  651|    121|        register opj_flag_t *flagsp = &t1->flags[(flags_stride) + 1]; \
  |  |  652|    121|        const OPJ_UINT32 l_w = w; \
  |  |  653|    121|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  654|    121|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|    121|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|    121|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|    121|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|    121|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  655|    121|        register OPJ_UINT32 v; \
  |  |  656|    121|        one = 1 << bpno; \
  |  |  657|    121|        half = one >> 1; \
  |  |  658|    121|        oneplushalf = one | half; \
  |  |  659|    228|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (659:21): [True: 107, False: 121]
  |  |  ------------------
  |  |  660|  90.3k|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (660:29): [True: 90.2k, False: 107]
  |  |  ------------------
  |  |  661|  90.2k|                        opj_flag_t flags = *flagsp; \
  |  |  662|  90.2k|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (662:29): [True: 58.7k, False: 31.5k]
  |  |  ------------------
  |  |  663|  58.7k|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  58.7k|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  58.7k|{ \
  |  |  |  |  440|  58.7k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  58.7k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  58.7k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  58.7k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  58.7k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 15.3k, False: 43.3k]
  |  |  |  |  ------------------
  |  |  |  |  441|  58.7k|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  15.3k|#define T1_SIGMA_NEIGHBOURS (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|  15.3k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  15.3k|#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|  15.3k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  15.3k|#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|  15.3k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  15.3k|#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|  15.3k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  15.3k|#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|  15.3k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  15.3k|#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|  15.3k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  15.3k|#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|  15.3k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  15.3k|#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|  15.3k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  15.3k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 14.3k, False: 1.01k]
  |  |  |  |  ------------------
  |  |  |  |  442|  14.3k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|  14.3k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  14.3k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|  14.3k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  14.3k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  14.3k|{ \
  |  |  |  |  |  |  140|  14.3k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  14.3k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  14.3k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  14.3k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  14.3k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  14.3k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.63k, False: 12.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.63k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.63k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.63k|{ \
  |  |  |  |  |  |  |  |   57|  1.63k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 331, False: 1.30k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    331|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    331|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    331|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.30k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.30k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.30k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.30k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.30k|    } \
  |  |  |  |  |  |  |  |   66|  1.63k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.63k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.63k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.63k|{ \
  |  |  |  |  |  |  |  |  128|  2.86k|    do { \
  |  |  |  |  |  |  |  |  129|  2.86k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 347, False: 2.51k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    347|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    347|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    347|{ \
  |  |  |  |  |  |  |  |  |  |  104|    347|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    347|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    347|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    347|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    347|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 347, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    347|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 347, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    347|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    347|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    347|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    347|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    347|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    347|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    347|        } \
  |  |  |  |  |  |  |  |  132|  2.86k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.86k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.86k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.86k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.23k, False: 1.63k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.63k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  12.7k|    } else {  \
  |  |  |  |  |  |  149|  12.7k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  12.7k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.85k, False: 10.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.85k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.85k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.85k|{ \
  |  |  |  |  |  |  |  |   45|  1.85k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 222, False: 1.63k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    222|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    222|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.63k|    } else { \
  |  |  |  |  |  |  |  |   49|  1.63k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.63k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.63k|    } \
  |  |  |  |  |  |  |  |   52|  1.85k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.85k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.85k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.85k|{ \
  |  |  |  |  |  |  |  |  128|  1.94k|    do { \
  |  |  |  |  |  |  |  |  129|  1.94k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 242, False: 1.70k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    242|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    242|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    242|{ \
  |  |  |  |  |  |  |  |  |  |  104|    242|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    242|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    242|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    242|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    242|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 242, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    242|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 242, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    242|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    242|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    242|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    242|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    242|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    242|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    242|        } \
  |  |  |  |  |  |  |  |  132|  1.94k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.94k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.94k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.94k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 90, False: 1.85k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.85k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  10.8k|        } else { \
  |  |  |  |  |  |  154|  10.8k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  10.8k|        } \
  |  |  |  |  |  |  156|  12.7k|    } \
  |  |  |  |  |  |  157|  14.3k|}
  |  |  |  |  ------------------
  |  |  |  |  445|  14.3k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 4.26k, False: 10.0k]
  |  |  |  |  ------------------
  |  |  |  |  446|  4.26k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|  4.26k|                                flags, \
  |  |  |  |  448|  4.26k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|  4.26k|                                ci); \
  |  |  |  |  450|  4.26k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|  4.26k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|  4.26k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  4.26k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|  4.26k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.26k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.26k|{ \
  |  |  |  |  |  |  140|  4.26k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.26k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.26k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.26k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.26k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.26k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 883, False: 3.37k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    883|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    883|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    883|{ \
  |  |  |  |  |  |  |  |   57|    883|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 200, False: 683]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    200|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    200|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    200|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    683|    } else { \
  |  |  |  |  |  |  |  |   62|    683|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    683|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    683|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    683|    } \
  |  |  |  |  |  |  |  |   66|    883|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    883|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    883|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    883|{ \
  |  |  |  |  |  |  |  |  128|  1.45k|    do { \
  |  |  |  |  |  |  |  |  129|  1.45k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 166, False: 1.28k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    166|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    166|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    166|{ \
  |  |  |  |  |  |  |  |  |  |  104|    166|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    166|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    166|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    166|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    166|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 166, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    166|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 166, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    166|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    166|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    166|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    166|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    166|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    166|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    166|        } \
  |  |  |  |  |  |  |  |  132|  1.45k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.45k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.45k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.45k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 567, False: 883]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    883|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.37k|    } else {  \
  |  |  |  |  |  |  149|  3.37k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.37k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 915, False: 2.46k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    915|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    915|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    915|{ \
  |  |  |  |  |  |  |  |   45|    915|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 155, False: 760]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    155|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    155|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    760|    } else { \
  |  |  |  |  |  |  |  |   49|    760|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    760|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    760|    } \
  |  |  |  |  |  |  |  |   52|    915|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    915|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    915|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    915|{ \
  |  |  |  |  |  |  |  |  128|    984|    do { \
  |  |  |  |  |  |  |  |  129|    984|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 138, False: 846]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    138|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    138|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    138|{ \
  |  |  |  |  |  |  |  |  |  |  104|    138|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    138|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    138|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    138|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    138|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 138, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    138|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 138, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    138|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    138|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    138|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    138|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    138|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    138|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    138|        } \
  |  |  |  |  |  |  |  |  132|    984|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    984|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    984|        ct--; \
  |  |  |  |  |  |  |  |  135|    984|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 69, False: 915]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    915|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.46k|        } else { \
  |  |  |  |  |  |  154|  2.46k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.46k|        } \
  |  |  |  |  |  |  156|  3.37k|    } \
  |  |  |  |  |  |  157|  4.26k|}
  |  |  |  |  ------------------
  |  |  |  |  454|  4.26k|            v = v ^ spb; \
  |  |  |  |  455|  4.26k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 2.21k, False: 2.04k]
  |  |  |  |  ------------------
  |  |  |  |  456|  4.26k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  4.26k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  4.26k|{ \
  |  |  |  |  |  |  326|  4.26k|    /* east */ \
  |  |  |  |  |  |  327|  4.26k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.26k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.26k| \
  |  |  |  |  |  |  329|  4.26k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  4.26k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.26k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.26k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.26k| \
  |  |  |  |  |  |  332|  4.26k|    /* west */ \
  |  |  |  |  |  |  333|  4.26k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.26k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  4.26k| \
  |  |  |  |  |  |  335|  4.26k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  4.26k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|  4.26k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|  4.26k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|  4.26k|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|  4.26k|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|  4.26k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|  4.26k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|  4.26k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|  4.26k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|  4.26k|    } \
  |  |  |  |  |  |  342|  4.26k| \
  |  |  |  |  |  |  343|  4.26k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  4.26k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  4.26k|}
  |  |  |  |  ------------------
  |  |  |  |  457|  4.26k|        } \
  |  |  |  |  458|  14.3k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  14.3k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  14.3k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|  14.3k|    } \
  |  |  |  |  460|  58.7k|}
  |  |  ------------------
  |  |  664|  58.7k|                                flags, flagsp, flags_stride, data, \
  |  |  665|  58.7k|                                l_w, 0, mqc, curctx, v, a, c, ct, oneplushalf, vsc); \
  |  |  666|  58.7k|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  58.7k|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  58.7k|{ \
  |  |  |  |  440|  58.7k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  58.7k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  58.7k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  58.7k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  58.7k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 15.4k, False: 43.2k]
  |  |  |  |  ------------------
  |  |  |  |  441|  58.7k|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  15.4k|#define T1_SIGMA_NEIGHBOURS (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|  15.4k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  15.4k|#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|  15.4k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  15.4k|#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|  15.4k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  15.4k|#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|  15.4k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  15.4k|#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|  15.4k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  15.4k|#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|  15.4k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  15.4k|#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|  15.4k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  15.4k|#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|  15.4k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  15.4k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 15.2k, False: 272]
  |  |  |  |  ------------------
  |  |  |  |  442|  15.2k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|  15.2k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  15.2k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|  15.2k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  15.2k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  15.2k|{ \
  |  |  |  |  |  |  140|  15.2k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  15.2k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  15.2k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  15.2k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  15.2k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  15.2k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 2.12k, False: 13.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.12k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  2.12k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  2.12k|{ \
  |  |  |  |  |  |  |  |   57|  2.12k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 451, False: 1.67k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    451|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    451|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    451|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.67k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.67k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.67k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.67k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.67k|    } \
  |  |  |  |  |  |  |  |   66|  2.12k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.12k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.12k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.12k|{ \
  |  |  |  |  |  |  |  |  128|  3.53k|    do { \
  |  |  |  |  |  |  |  |  129|  3.53k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 448, False: 3.08k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    448|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    448|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    448|{ \
  |  |  |  |  |  |  |  |  |  |  104|    448|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    448|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    448|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    448|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    448|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 448, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    448|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 448, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    448|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    448|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    448|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    448|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    448|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    448|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    448|        } \
  |  |  |  |  |  |  |  |  132|  3.53k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.53k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.53k|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.53k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.40k, False: 2.12k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.12k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  13.0k|    } else {  \
  |  |  |  |  |  |  149|  13.0k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  13.0k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.25k, False: 10.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.25k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.25k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.25k|{ \
  |  |  |  |  |  |  |  |   45|  2.25k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 365, False: 1.88k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    365|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    365|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.88k|    } else { \
  |  |  |  |  |  |  |  |   49|  1.88k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.88k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.88k|    } \
  |  |  |  |  |  |  |  |   52|  2.25k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.25k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.25k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.25k|{ \
  |  |  |  |  |  |  |  |  128|  2.43k|    do { \
  |  |  |  |  |  |  |  |  129|  2.43k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 306, False: 2.13k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    306|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    306|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    306|{ \
  |  |  |  |  |  |  |  |  |  |  104|    306|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    306|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    306|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    306|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    306|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 306, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    306|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 306, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    306|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    306|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    306|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    306|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    306|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    306|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    306|        } \
  |  |  |  |  |  |  |  |  132|  2.43k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.43k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.43k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.43k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 184, False: 2.25k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.25k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  10.8k|        } else { \
  |  |  |  |  |  |  154|  10.8k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  10.8k|        } \
  |  |  |  |  |  |  156|  13.0k|    } \
  |  |  |  |  |  |  157|  15.2k|}
  |  |  |  |  ------------------
  |  |  |  |  445|  15.2k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 4.31k, False: 10.8k]
  |  |  |  |  ------------------
  |  |  |  |  446|  4.31k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|  4.31k|                                flags, \
  |  |  |  |  448|  4.31k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|  4.31k|                                ci); \
  |  |  |  |  450|  4.31k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|  4.31k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|  4.31k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  4.31k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|  4.31k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.31k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.31k|{ \
  |  |  |  |  |  |  140|  4.31k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.31k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.31k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.31k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.31k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.31k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 910, False: 3.40k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    910|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    910|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    910|{ \
  |  |  |  |  |  |  |  |   57|    910|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 196, False: 714]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    196|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    196|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    196|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    714|    } else { \
  |  |  |  |  |  |  |  |   62|    714|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    714|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    714|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    714|    } \
  |  |  |  |  |  |  |  |   66|    910|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    910|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    910|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    910|{ \
  |  |  |  |  |  |  |  |  128|  1.54k|    do { \
  |  |  |  |  |  |  |  |  129|  1.54k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 201, False: 1.34k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    201|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    201|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    201|{ \
  |  |  |  |  |  |  |  |  |  |  104|    201|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    201|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    201|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    201|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    201|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 201, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    201|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 201, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    201|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    201|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    201|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    201|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    201|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    201|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    201|        } \
  |  |  |  |  |  |  |  |  132|  1.54k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.54k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.54k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.54k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 639, False: 910]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    910|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.40k|    } else {  \
  |  |  |  |  |  |  149|  3.40k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.40k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 991, False: 2.41k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    991|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    991|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    991|{ \
  |  |  |  |  |  |  |  |   45|    991|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 128, False: 863]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    128|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    128|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    863|    } else { \
  |  |  |  |  |  |  |  |   49|    863|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    863|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    863|    } \
  |  |  |  |  |  |  |  |   52|    991|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    991|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    991|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    991|{ \
  |  |  |  |  |  |  |  |  128|  1.04k|    do { \
  |  |  |  |  |  |  |  |  129|  1.04k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 109, False: 936]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    109|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    109|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    109|{ \
  |  |  |  |  |  |  |  |  |  |  104|    109|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    109|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    109|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    109|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    109|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 109, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    109|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 109, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    109|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    109|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    109|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    109|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    109|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    109|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    109|        } \
  |  |  |  |  |  |  |  |  132|  1.04k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.04k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.04k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.04k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 54, False: 991]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    991|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.41k|        } else { \
  |  |  |  |  |  |  154|  2.41k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.41k|        } \
  |  |  |  |  |  |  156|  3.40k|    } \
  |  |  |  |  |  |  157|  4.31k|}
  |  |  |  |  ------------------
  |  |  |  |  454|  4.31k|            v = v ^ spb; \
  |  |  |  |  455|  4.31k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 2.10k, False: 2.21k]
  |  |  |  |  ------------------
  |  |  |  |  456|  4.31k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  4.31k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  4.31k|{ \
  |  |  |  |  |  |  326|  4.31k|    /* east */ \
  |  |  |  |  |  |  327|  4.31k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.31k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.31k| \
  |  |  |  |  |  |  329|  4.31k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  4.31k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.31k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.31k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.31k| \
  |  |  |  |  |  |  332|  4.31k|    /* west */ \
  |  |  |  |  |  |  333|  4.31k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.31k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  4.31k| \
  |  |  |  |  |  |  335|  4.31k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  4.31k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  4.31k| \
  |  |  |  |  |  |  343|  4.31k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  4.31k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  4.31k|}
  |  |  |  |  ------------------
  |  |  |  |  457|  4.31k|        } \
  |  |  |  |  458|  15.2k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  15.2k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  15.2k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|  15.2k|    } \
  |  |  |  |  460|  58.7k|}
  |  |  ------------------
  |  |  667|  58.7k|                                flags, flagsp, flags_stride, data, \
  |  |  668|  58.7k|                                l_w, 1, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  669|  58.7k|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  58.7k|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  58.7k|{ \
  |  |  |  |  440|  58.7k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  58.7k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  58.7k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  58.7k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  58.7k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 14.1k, False: 44.5k]
  |  |  |  |  ------------------
  |  |  |  |  441|  58.7k|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  14.1k|#define T1_SIGMA_NEIGHBOURS (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|  14.1k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  14.1k|#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|  14.1k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  14.1k|#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|  14.1k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  14.1k|#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|  14.1k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  14.1k|#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|  14.1k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  14.1k|#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|  14.1k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  14.1k|#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|  14.1k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  14.1k|#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|  14.1k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  14.1k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 14.0k, False: 107]
  |  |  |  |  ------------------
  |  |  |  |  442|  14.0k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|  14.0k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  14.0k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|  14.0k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  14.0k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  14.0k|{ \
  |  |  |  |  |  |  140|  14.0k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  14.0k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  14.0k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  14.0k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  14.0k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  14.0k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.83k, False: 12.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.83k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.83k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.83k|{ \
  |  |  |  |  |  |  |  |   57|  1.83k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 390, False: 1.44k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    390|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    390|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    390|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.44k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.44k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.44k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.44k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.44k|    } \
  |  |  |  |  |  |  |  |   66|  1.83k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.83k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.83k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.83k|{ \
  |  |  |  |  |  |  |  |  128|  3.08k|    do { \
  |  |  |  |  |  |  |  |  129|  3.08k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 363, False: 2.72k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    363|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    363|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    363|{ \
  |  |  |  |  |  |  |  |  |  |  104|    363|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    363|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    363|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    363|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    363|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 363, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    363|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 363, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    363|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    363|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    363|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    363|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    363|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    363|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    363|        } \
  |  |  |  |  |  |  |  |  132|  3.08k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.08k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.08k|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.08k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.25k, False: 1.83k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.83k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  12.2k|    } else {  \
  |  |  |  |  |  |  149|  12.2k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  12.2k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.96k, False: 10.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.96k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.96k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.96k|{ \
  |  |  |  |  |  |  |  |   45|  1.96k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 294, False: 1.67k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    294|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    294|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.67k|    } else { \
  |  |  |  |  |  |  |  |   49|  1.67k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.67k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.67k|    } \
  |  |  |  |  |  |  |  |   52|  1.96k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.96k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.96k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.96k|{ \
  |  |  |  |  |  |  |  |  128|  2.10k|    do { \
  |  |  |  |  |  |  |  |  129|  2.10k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 255, False: 1.84k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    255|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    255|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    255|{ \
  |  |  |  |  |  |  |  |  |  |  104|    255|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    255|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    255|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    255|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    255|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 255, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    255|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 255, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    255|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    255|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    255|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    255|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    255|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    255|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    255|        } \
  |  |  |  |  |  |  |  |  132|  2.10k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.10k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.10k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.10k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 133, False: 1.96k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.96k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  10.2k|        } else { \
  |  |  |  |  |  |  154|  10.2k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  10.2k|        } \
  |  |  |  |  |  |  156|  12.2k|    } \
  |  |  |  |  |  |  157|  14.0k|}
  |  |  |  |  ------------------
  |  |  |  |  445|  14.0k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 4.26k, False: 9.80k]
  |  |  |  |  ------------------
  |  |  |  |  446|  4.26k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|  4.26k|                                flags, \
  |  |  |  |  448|  4.26k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|  4.26k|                                ci); \
  |  |  |  |  450|  4.26k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|  4.26k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|  4.26k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  4.26k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|  4.26k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.26k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.26k|{ \
  |  |  |  |  |  |  140|  4.26k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.26k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.26k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.26k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.26k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.26k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 963, False: 3.30k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    963|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    963|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    963|{ \
  |  |  |  |  |  |  |  |   57|    963|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 208, False: 755]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    208|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    208|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    208|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    755|    } else { \
  |  |  |  |  |  |  |  |   62|    755|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    755|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    755|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    755|    } \
  |  |  |  |  |  |  |  |   66|    963|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    963|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    963|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    963|{ \
  |  |  |  |  |  |  |  |  128|  1.57k|    do { \
  |  |  |  |  |  |  |  |  129|  1.57k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 196, False: 1.37k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    196|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    196|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    196|{ \
  |  |  |  |  |  |  |  |  |  |  104|    196|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    196|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    196|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    196|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    196|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 196, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    196|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 196, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    196|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    196|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    196|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    196|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    196|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    196|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    196|        } \
  |  |  |  |  |  |  |  |  132|  1.57k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.57k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.57k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.57k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 609, False: 963]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    963|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.30k|    } else {  \
  |  |  |  |  |  |  149|  3.30k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.30k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.00k, False: 2.29k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.00k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.00k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.00k|{ \
  |  |  |  |  |  |  |  |   45|  1.00k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 155, False: 854]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    155|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    155|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    854|    } else { \
  |  |  |  |  |  |  |  |   49|    854|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    854|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    854|    } \
  |  |  |  |  |  |  |  |   52|  1.00k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.00k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.00k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.00k|{ \
  |  |  |  |  |  |  |  |  128|  1.08k|    do { \
  |  |  |  |  |  |  |  |  129|  1.08k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 158, False: 929]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    158|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    158|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    158|{ \
  |  |  |  |  |  |  |  |  |  |  104|    158|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    158|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    158|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    158|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    158|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 158, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    158|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 158, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    158|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    158|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    158|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    158|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    158|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    158|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    158|        } \
  |  |  |  |  |  |  |  |  132|  1.08k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.08k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.08k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.08k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 78, False: 1.00k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.00k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.29k|        } else { \
  |  |  |  |  |  |  154|  2.29k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.29k|        } \
  |  |  |  |  |  |  156|  3.30k|    } \
  |  |  |  |  |  |  157|  4.26k|}
  |  |  |  |  ------------------
  |  |  |  |  454|  4.26k|            v = v ^ spb; \
  |  |  |  |  455|  4.26k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 2.08k, False: 2.18k]
  |  |  |  |  ------------------
  |  |  |  |  456|  4.26k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  4.26k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  4.26k|{ \
  |  |  |  |  |  |  326|  4.26k|    /* east */ \
  |  |  |  |  |  |  327|  4.26k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.26k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.26k| \
  |  |  |  |  |  |  329|  4.26k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  4.26k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.26k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.26k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.26k| \
  |  |  |  |  |  |  332|  4.26k|    /* west */ \
  |  |  |  |  |  |  333|  4.26k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.26k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  4.26k| \
  |  |  |  |  |  |  335|  4.26k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  4.26k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  4.26k| \
  |  |  |  |  |  |  343|  4.26k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  4.26k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  4.26k|}
  |  |  |  |  ------------------
  |  |  |  |  457|  4.26k|        } \
  |  |  |  |  458|  14.0k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  14.0k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  14.0k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|  14.0k|    } \
  |  |  |  |  460|  58.7k|}
  |  |  ------------------
  |  |  670|  58.7k|                                flags, flagsp, flags_stride, data, \
  |  |  671|  58.7k|                                l_w, 2, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  672|  58.7k|                            opj_t1_dec_sigpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  438|  58.7k|                                          v, a, c, ct, oneplushalf, vsc) \
  |  |  |  |  439|  58.7k|{ \
  |  |  |  |  440|  58.7k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  58.7k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  58.7k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  58.7k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  58.7k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (440:9): [True: 13.8k, False: 44.8k]
  |  |  |  |  ------------------
  |  |  |  |  441|  58.7k|        (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  13.8k|#define T1_SIGMA_NEIGHBOURS (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|  13.8k|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   91|  13.8k|#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|  13.8k|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   92|  13.8k|#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|  13.8k|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   93|  13.8k|#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|  13.8k|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   94|  13.8k|#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|  13.8k|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   96|  13.8k|#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|  13.8k|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   97|  13.8k|#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|  13.8k|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   98|  13.8k|#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|  13.8k|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   99|  13.8k|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (441:9): [True: 13.5k, False: 292]
  |  |  |  |  ------------------
  |  |  |  |  442|  13.5k|        OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  |  443|  13.5k|        opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  13.5k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  444|  13.5k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  13.5k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  13.5k|{ \
  |  |  |  |  |  |  140|  13.5k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  13.5k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  13.5k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  13.5k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  13.5k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  13.5k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.56k, False: 11.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.56k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.56k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.56k|{ \
  |  |  |  |  |  |  |  |   57|  1.56k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 309, False: 1.25k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    309|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    309|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    309|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.25k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.25k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.25k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.25k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.25k|    } \
  |  |  |  |  |  |  |  |   66|  1.56k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.56k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.56k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.56k|{ \
  |  |  |  |  |  |  |  |  128|  2.69k|    do { \
  |  |  |  |  |  |  |  |  129|  2.69k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 361, False: 2.33k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    361|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    361|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    361|{ \
  |  |  |  |  |  |  |  |  |  |  104|    361|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    361|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    361|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    361|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    361|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 361, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    361|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 361, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    361|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    361|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    361|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    361|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    361|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    361|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    361|        } \
  |  |  |  |  |  |  |  |  132|  2.69k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.69k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.69k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.69k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.13k, False: 1.56k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.56k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  11.9k|    } else {  \
  |  |  |  |  |  |  149|  11.9k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  11.9k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.66k, False: 10.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.66k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.66k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.66k|{ \
  |  |  |  |  |  |  |  |   45|  1.66k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 278, False: 1.38k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    278|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    278|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.38k|    } else { \
  |  |  |  |  |  |  |  |   49|  1.38k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.38k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.38k|    } \
  |  |  |  |  |  |  |  |   52|  1.66k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.66k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.66k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.66k|{ \
  |  |  |  |  |  |  |  |  128|  1.79k|    do { \
  |  |  |  |  |  |  |  |  129|  1.79k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 227, False: 1.56k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    227|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    227|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    227|{ \
  |  |  |  |  |  |  |  |  |  |  104|    227|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    227|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    227|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    227|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    227|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 227, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    227|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 227, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    227|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    227|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    227|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    227|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    227|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    227|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    227|        } \
  |  |  |  |  |  |  |  |  132|  1.79k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.79k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.79k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.79k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 124, False: 1.66k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.66k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  10.3k|        } else { \
  |  |  |  |  |  |  154|  10.3k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  10.3k|        } \
  |  |  |  |  |  |  156|  11.9k|    } \
  |  |  |  |  |  |  157|  13.5k|}
  |  |  |  |  ------------------
  |  |  |  |  445|  13.5k|        if (v) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:13): [True: 3.89k, False: 9.64k]
  |  |  |  |  ------------------
  |  |  |  |  446|  3.89k|            OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  |  447|  3.89k|                                flags, \
  |  |  |  |  448|  3.89k|                                flagsp[-1], flagsp[1], \
  |  |  |  |  449|  3.89k|                                ci); \
  |  |  |  |  450|  3.89k|            OPJ_UINT32 ctxt2 = opj_t1_getctxno_sc(lu); \
  |  |  |  |  451|  3.89k|            OPJ_UINT32 spb = opj_t1_getspb(lu); \
  |  |  |  |  452|  3.89k|            opj_t1_setcurctx(curctx, ctxt2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  3.89k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  453|  3.89k|            opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  3.89k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  3.89k|{ \
  |  |  |  |  |  |  140|  3.89k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  3.89k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  3.89k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  3.89k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  3.89k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  3.89k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 862, False: 3.02k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    862|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    862|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    862|{ \
  |  |  |  |  |  |  |  |   57|    862|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 186, False: 676]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    186|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    186|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    186|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    676|    } else { \
  |  |  |  |  |  |  |  |   62|    676|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    676|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    676|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    676|    } \
  |  |  |  |  |  |  |  |   66|    862|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    862|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    862|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    862|{ \
  |  |  |  |  |  |  |  |  128|  1.43k|    do { \
  |  |  |  |  |  |  |  |  129|  1.43k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 185, False: 1.25k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    185|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    185|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    185|{ \
  |  |  |  |  |  |  |  |  |  |  104|    185|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    185|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    185|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    185|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    185|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 185, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    185|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 185, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    185|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    185|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    185|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    185|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    185|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    185|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    185|        } \
  |  |  |  |  |  |  |  |  132|  1.43k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.43k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.43k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.43k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 574, False: 862]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    862|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.02k|    } else {  \
  |  |  |  |  |  |  149|  3.02k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.02k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 889, False: 2.14k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    889|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    889|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    889|{ \
  |  |  |  |  |  |  |  |   45|    889|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 125, False: 764]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    125|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    125|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    764|    } else { \
  |  |  |  |  |  |  |  |   49|    764|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    764|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    764|    } \
  |  |  |  |  |  |  |  |   52|    889|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    889|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    889|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    889|{ \
  |  |  |  |  |  |  |  |  128|    939|    do { \
  |  |  |  |  |  |  |  |  129|    939|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 111, False: 828]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    111|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    111|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    111|{ \
  |  |  |  |  |  |  |  |  |  |  104|    111|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    111|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    111|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    111|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    111|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 111, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    111|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 111, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    111|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    111|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    111|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    111|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|    111|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|    111|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    111|        } \
  |  |  |  |  |  |  |  |  132|    939|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    939|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    939|        ct--; \
  |  |  |  |  |  |  |  |  135|    939|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 50, False: 889]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    889|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.14k|        } else { \
  |  |  |  |  |  |  154|  2.14k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.14k|        } \
  |  |  |  |  |  |  156|  3.02k|    } \
  |  |  |  |  |  |  157|  3.89k|}
  |  |  |  |  ------------------
  |  |  |  |  454|  3.89k|            v = v ^ spb; \
  |  |  |  |  455|  3.89k|            data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (455:36): [True: 1.97k, False: 1.91k]
  |  |  |  |  ------------------
  |  |  |  |  456|  3.89k|            opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  3.89k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  3.89k|{ \
  |  |  |  |  |  |  326|  3.89k|    /* east */ \
  |  |  |  |  |  |  327|  3.89k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  3.89k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  3.89k| \
  |  |  |  |  |  |  329|  3.89k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  3.89k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  3.89k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  3.89k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  3.89k| \
  |  |  |  |  |  |  332|  3.89k|    /* west */ \
  |  |  |  |  |  |  333|  3.89k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  3.89k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  3.89k| \
  |  |  |  |  |  |  335|  3.89k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  3.89k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  3.89k| \
  |  |  |  |  |  |  343|  3.89k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  3.89k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  3.89k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|  3.89k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  3.89k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  3.89k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|  3.89k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  3.89k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|  3.89k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  3.89k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|  3.89k|    } \
  |  |  |  |  |  |  350|  3.89k|}
  |  |  |  |  ------------------
  |  |  |  |  457|  3.89k|        } \
  |  |  |  |  458|  13.5k|        flags |= T1_PI_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  13.5k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  13.5k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  459|  13.5k|    } \
  |  |  |  |  460|  58.7k|}
  |  |  ------------------
  |  |  673|  58.7k|                                flags, flagsp, flags_stride, data, \
  |  |  674|  58.7k|                                l_w, 3, mqc, curctx, v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  |  675|  58.7k|                            *flagsp = flags; \
  |  |  676|  58.7k|                        } \
  |  |  677|  90.2k|                } \
  |  |  678|    107|        } \
  |  |  679|    121|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|    121|        mqc->curctx = curctx; \
  |  |  |  |  167|    121|        mqc->c = c; \
  |  |  |  |  168|    121|        mqc->a = a; \
  |  |  |  |  169|    121|        mqc->ct = ct;
  |  |  ------------------
  |  |  680|    121|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (680:13): [True: 14, False: 107]
  |  |  ------------------
  |  |  681|  7.82k|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (681:25): [True: 7.81k, False: 14]
  |  |  ------------------
  |  |  682|  23.4k|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (682:29): [True: 15.6k, False: 7.81k]
  |  |  ------------------
  |  |  683|  15.6k|                        opj_t1_dec_sigpass_step_mqc(t1, flagsp, \
  |  |  684|  15.6k|                            data + j * l_w, oneplushalf, j, flags_stride, vsc); \
  |  |  685|  15.6k|                } \
  |  |  686|  7.81k|            } \
  |  |  687|     14|        } \
  |  |  688|    121|}
  ------------------
  709|    121|                                    t1->w + 2U);
  710|    121|}
t1.c:opj_t1_dec_refpass_mqc:
 1040|  2.07k|{
 1041|  2.07k|    if (t1->w == 64 && t1->h == 64) {
  ------------------
  |  Branch (1041:9): [True: 1.95k, False: 121]
  |  Branch (1041:24): [True: 1.79k, False: 161]
  ------------------
 1042|  1.79k|        opj_t1_dec_refpass_mqc_64x64(t1, bpno);
 1043|  1.79k|    } else {
 1044|    282|        opj_t1_dec_refpass_mqc_generic(t1, bpno);
 1045|    282|    }
 1046|  2.07k|}
t1.c:opj_t1_dec_refpass_mqc_64x64:
 1026|  1.79k|{
 1027|  1.79k|    opj_t1_dec_refpass_mqc_internal(t1, bpno, 64, 64, 66);
  ------------------
  |  |  981|  1.79k|#define opj_t1_dec_refpass_mqc_internal(t1, bpno, w, h, flags_stride) \
  |  |  982|  1.79k|{ \
  |  |  983|  1.79k|        OPJ_INT32 one, poshalf; \
  |  |  984|  1.79k|        OPJ_UINT32 i, j, k; \
  |  |  985|  1.79k|        register OPJ_INT32 *data = t1->data; \
  |  |  986|  1.79k|        register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  |  987|  1.79k|        const OPJ_UINT32 l_w = w; \
  |  |  988|  1.79k|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  989|  1.79k|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  1.79k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  1.79k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  1.79k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  1.79k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  990|  1.79k|        register OPJ_UINT32 v; \
  |  |  991|  1.79k|        one = 1 << bpno; \
  |  |  992|  1.79k|        poshalf = one >> 1; \
  |  |  993|  30.5k|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (993:21): [True: 28.7k, False: 1.79k]
  |  |  ------------------
  |  |  994|  1.86M|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (994:29): [True: 1.83M, False: 28.7k]
  |  |  ------------------
  |  |  995|  1.83M|                        opj_flag_t flags = *flagsp; \
  |  |  996|  1.83M|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (996:29): [True: 1.61M, False: 227k]
  |  |  ------------------
  |  |  997|  1.61M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  1.61M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  1.61M|{ \
  |  |  |  |  789|  1.61M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.61M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.61M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.61M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.61M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 1.34M, False: 266k]
  |  |  |  |  ------------------
  |  |  |  |  790|  1.61M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.61M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.61M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  1.34M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  1.34M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.34M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  1.34M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.34M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.34M|{ \
  |  |  |  |  |  |  140|  1.34M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.34M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.34M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.34M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.34M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.34M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 272k, False: 1.07M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   272k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   272k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   272k|{ \
  |  |  |  |  |  |  |  |   57|   272k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 52.1k, False: 219k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  52.1k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  52.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  52.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   219k|    } else { \
  |  |  |  |  |  |  |  |   62|   219k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   219k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   219k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   219k|    } \
  |  |  |  |  |  |  |  |   66|   272k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   272k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   272k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   272k|{ \
  |  |  |  |  |  |  |  |  128|   453k|    do { \
  |  |  |  |  |  |  |  |  129|   453k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 56.2k, False: 397k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  56.2k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  56.2k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  56.2k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  56.2k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  56.2k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  56.2k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  56.2k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  56.2k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 56.0k, False: 182]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  56.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 56.0k, False: 39]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  56.0k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  56.0k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  56.0k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  56.0k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     39|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     39|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     39|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     39|            } \
  |  |  |  |  |  |  |  |  |  |  118|  56.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    182|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    182|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    182|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    182|        } \
  |  |  |  |  |  |  |  |  |  |  123|  56.2k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  56.2k|        } \
  |  |  |  |  |  |  |  |  132|   453k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   453k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   453k|        ct--; \
  |  |  |  |  |  |  |  |  135|   453k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 181k, False: 272k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   272k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.07M|    } else {  \
  |  |  |  |  |  |  149|  1.07M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.07M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 294k, False: 778k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   294k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   294k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   294k|{ \
  |  |  |  |  |  |  |  |   45|   294k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 43.6k, False: 251k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  43.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  43.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   251k|    } else { \
  |  |  |  |  |  |  |  |   49|   251k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   251k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   251k|    } \
  |  |  |  |  |  |  |  |   52|   294k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   294k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   294k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   294k|{ \
  |  |  |  |  |  |  |  |  128|   311k|    do { \
  |  |  |  |  |  |  |  |  129|   311k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 38.9k, False: 272k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  38.9k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  38.9k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  38.9k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  38.9k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  38.9k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  38.9k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  38.9k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  38.9k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 38.8k, False: 151]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  38.8k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 38.7k, False: 26]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  38.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  38.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  38.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  38.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     26|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     26|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     26|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     26|            } \
  |  |  |  |  |  |  |  |  |  |  118|  38.8k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    151|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    151|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    151|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    151|        } \
  |  |  |  |  |  |  |  |  |  |  123|  38.9k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  38.9k|        } \
  |  |  |  |  |  |  |  |  132|   311k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   311k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   311k|        ct--; \
  |  |  |  |  |  |  |  |  135|   311k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 16.6k, False: 294k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   294k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   778k|        } else { \
  |  |  |  |  |  |  154|   778k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   778k|        } \
  |  |  |  |  |  |  156|  1.07M|    } \
  |  |  |  |  |  |  157|  1.34M|}
  |  |  |  |  ------------------
  |  |  |  |  794|  1.34M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 675k, False: 669k]
  |  |  |  |  ------------------
  |  |  |  |  795|  1.34M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  1.34M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  1.34M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  1.34M|    } \
  |  |  |  |  797|  1.61M|}
  |  |  ------------------
  |  |  998|  1.61M|                                flags, data, l_w, 0, \
  |  |  999|  1.61M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1000|  1.61M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  1.61M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  1.61M|{ \
  |  |  |  |  789|  1.61M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.61M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.61M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.61M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.61M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 1.34M, False: 268k]
  |  |  |  |  ------------------
  |  |  |  |  790|  1.61M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.61M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.61M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  1.34M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  1.34M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.34M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  1.34M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.34M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.34M|{ \
  |  |  |  |  |  |  140|  1.34M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.34M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.34M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.34M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.34M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.34M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 271k, False: 1.07M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   271k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   271k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   271k|{ \
  |  |  |  |  |  |  |  |   57|   271k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 52.3k, False: 219k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  52.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  52.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  52.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   219k|    } else { \
  |  |  |  |  |  |  |  |   62|   219k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   219k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   219k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   219k|    } \
  |  |  |  |  |  |  |  |   66|   271k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   271k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   271k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   271k|{ \
  |  |  |  |  |  |  |  |  128|   451k|    do { \
  |  |  |  |  |  |  |  |  129|   451k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 56.8k, False: 394k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  56.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  56.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  56.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  56.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  56.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  56.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  56.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  56.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 56.7k, False: 149]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  56.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 56.6k, False: 33]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  56.6k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  56.6k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  56.6k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  56.6k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     33|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     33|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     33|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     33|            } \
  |  |  |  |  |  |  |  |  |  |  118|  56.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    149|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    149|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    149|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    149|        } \
  |  |  |  |  |  |  |  |  |  |  123|  56.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  56.8k|        } \
  |  |  |  |  |  |  |  |  132|   451k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   451k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   451k|        ct--; \
  |  |  |  |  |  |  |  |  135|   451k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 180k, False: 271k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   271k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.07M|    } else {  \
  |  |  |  |  |  |  149|  1.07M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.07M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 295k, False: 775k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   295k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   295k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   295k|{ \
  |  |  |  |  |  |  |  |   45|   295k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 44.4k, False: 251k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  44.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  44.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   251k|    } else { \
  |  |  |  |  |  |  |  |   49|   251k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   251k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   251k|    } \
  |  |  |  |  |  |  |  |   52|   295k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   295k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   295k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   295k|{ \
  |  |  |  |  |  |  |  |  128|   312k|    do { \
  |  |  |  |  |  |  |  |  129|   312k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 39.1k, False: 273k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  39.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  39.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  39.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  39.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  39.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  39.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  39.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  39.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 39.0k, False: 117]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  39.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 38.9k, False: 35]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  38.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  38.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  38.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  38.9k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     35|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     35|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     35|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     35|            } \
  |  |  |  |  |  |  |  |  |  |  118|  39.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    117|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    117|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    117|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    117|        } \
  |  |  |  |  |  |  |  |  |  |  123|  39.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  39.1k|        } \
  |  |  |  |  |  |  |  |  132|   312k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   312k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   312k|        ct--; \
  |  |  |  |  |  |  |  |  135|   312k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 17.3k, False: 295k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   295k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   775k|        } else { \
  |  |  |  |  |  |  154|   775k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   775k|        } \
  |  |  |  |  |  |  156|  1.07M|    } \
  |  |  |  |  |  |  157|  1.34M|}
  |  |  |  |  ------------------
  |  |  |  |  794|  1.34M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 673k, False: 669k]
  |  |  |  |  ------------------
  |  |  |  |  795|  1.34M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  1.34M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  1.34M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  1.34M|    } \
  |  |  |  |  797|  1.61M|}
  |  |  ------------------
  |  | 1001|  1.61M|                                flags, data, l_w, 1, \
  |  | 1002|  1.61M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1003|  1.61M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  1.61M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  1.61M|{ \
  |  |  |  |  789|  1.61M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.61M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.61M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.61M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.61M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 1.34M, False: 268k]
  |  |  |  |  ------------------
  |  |  |  |  790|  1.61M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.61M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.61M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  1.34M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  1.34M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.34M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  1.34M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.34M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.34M|{ \
  |  |  |  |  |  |  140|  1.34M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.34M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.34M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.34M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.34M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.34M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 271k, False: 1.07M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   271k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   271k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   271k|{ \
  |  |  |  |  |  |  |  |   57|   271k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 52.5k, False: 218k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  52.5k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  52.5k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  52.5k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   218k|    } else { \
  |  |  |  |  |  |  |  |   62|   218k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   218k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   218k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   218k|    } \
  |  |  |  |  |  |  |  |   66|   271k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   271k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   271k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   271k|{ \
  |  |  |  |  |  |  |  |  128|   452k|    do { \
  |  |  |  |  |  |  |  |  129|   452k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 57.0k, False: 395k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  57.0k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  57.0k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  57.0k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  57.0k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  57.0k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  57.0k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  57.0k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  57.0k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 56.9k, False: 177]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  56.9k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 56.8k, False: 36]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  56.8k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  56.8k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  56.8k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  56.8k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     36|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     36|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     36|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     36|            } \
  |  |  |  |  |  |  |  |  |  |  118|  56.9k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    177|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    177|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    177|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    177|        } \
  |  |  |  |  |  |  |  |  |  |  123|  57.0k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  57.0k|        } \
  |  |  |  |  |  |  |  |  132|   452k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   452k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   452k|        ct--; \
  |  |  |  |  |  |  |  |  135|   452k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 181k, False: 271k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   271k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.07M|    } else {  \
  |  |  |  |  |  |  149|  1.07M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.07M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 294k, False: 776k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   294k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   294k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   294k|{ \
  |  |  |  |  |  |  |  |   45|   294k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 43.5k, False: 251k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  43.5k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  43.5k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   251k|    } else { \
  |  |  |  |  |  |  |  |   49|   251k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   251k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   251k|    } \
  |  |  |  |  |  |  |  |   52|   294k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   294k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   294k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   294k|{ \
  |  |  |  |  |  |  |  |  128|   311k|    do { \
  |  |  |  |  |  |  |  |  129|   311k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 38.4k, False: 273k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  38.4k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  38.4k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  38.4k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  38.4k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  38.4k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  38.4k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  38.4k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  38.4k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 38.3k, False: 120]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  38.3k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 38.3k, False: 27]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  38.3k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  38.3k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  38.3k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  38.3k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     27|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     27|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     27|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     27|            } \
  |  |  |  |  |  |  |  |  |  |  118|  38.3k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    120|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    120|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    120|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    120|        } \
  |  |  |  |  |  |  |  |  |  |  123|  38.4k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  38.4k|        } \
  |  |  |  |  |  |  |  |  132|   311k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   311k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   311k|        ct--; \
  |  |  |  |  |  |  |  |  135|   311k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 17.2k, False: 294k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   294k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   776k|        } else { \
  |  |  |  |  |  |  154|   776k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   776k|        } \
  |  |  |  |  |  |  156|  1.07M|    } \
  |  |  |  |  |  |  157|  1.34M|}
  |  |  |  |  ------------------
  |  |  |  |  794|  1.34M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 670k, False: 671k]
  |  |  |  |  ------------------
  |  |  |  |  795|  1.34M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  1.34M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  1.34M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  1.34M|    } \
  |  |  |  |  797|  1.61M|}
  |  |  ------------------
  |  | 1004|  1.61M|                                flags, data, l_w, 2, \
  |  | 1005|  1.61M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1006|  1.61M|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  1.61M|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  1.61M|{ \
  |  |  |  |  789|  1.61M|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.61M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.61M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.61M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.61M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 1.33M, False: 275k]
  |  |  |  |  ------------------
  |  |  |  |  790|  1.61M|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.61M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.61M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  1.33M|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  1.33M|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  1.33M|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  1.33M|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  1.33M|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  1.33M|{ \
  |  |  |  |  |  |  140|  1.33M|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  1.33M|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  1.33M|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  1.33M|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  1.33M|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  1.33M|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 269k, False: 1.06M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|   269k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|   269k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|   269k|{ \
  |  |  |  |  |  |  |  |   57|   269k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 51.3k, False: 218k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  51.3k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  51.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  51.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|   218k|    } else { \
  |  |  |  |  |  |  |  |   62|   218k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|   218k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|   218k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|   218k|    } \
  |  |  |  |  |  |  |  |   66|   269k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   269k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   269k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   269k|{ \
  |  |  |  |  |  |  |  |  128|   450k|    do { \
  |  |  |  |  |  |  |  |  129|   450k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 56.1k, False: 393k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  56.1k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  56.1k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  56.1k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  56.1k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  56.1k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  56.1k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  56.1k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  56.1k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 56.0k, False: 163]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  56.0k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 55.9k, False: 51]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  55.9k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  55.9k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  55.9k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  55.9k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     51|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     51|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     51|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     51|            } \
  |  |  |  |  |  |  |  |  |  |  118|  56.0k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    163|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    163|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    163|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    163|        } \
  |  |  |  |  |  |  |  |  |  |  123|  56.1k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  56.1k|        } \
  |  |  |  |  |  |  |  |  132|   450k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   450k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   450k|        ct--; \
  |  |  |  |  |  |  |  |  135|   450k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 180k, False: 269k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   269k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.06M|    } else {  \
  |  |  |  |  |  |  149|  1.06M|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.06M|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 293k, False: 772k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   293k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   293k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|   293k|{ \
  |  |  |  |  |  |  |  |   45|   293k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 43.2k, False: 249k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  43.2k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  43.2k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|   249k|    } else { \
  |  |  |  |  |  |  |  |   49|   249k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|   249k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|   249k|    } \
  |  |  |  |  |  |  |  |   52|   293k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   293k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|   293k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|   293k|{ \
  |  |  |  |  |  |  |  |  128|   310k|    do { \
  |  |  |  |  |  |  |  |  129|   310k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 38.8k, False: 271k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  38.8k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  38.8k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  38.8k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  38.8k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  38.8k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  38.8k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  38.8k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  38.8k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 38.7k, False: 120]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  38.7k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 38.7k, False: 32]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  38.7k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  38.7k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  38.7k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  38.7k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     32|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     32|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     32|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     32|            } \
  |  |  |  |  |  |  |  |  |  |  118|  38.7k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    120|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    120|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    120|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    120|        } \
  |  |  |  |  |  |  |  |  |  |  123|  38.8k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  38.8k|        } \
  |  |  |  |  |  |  |  |  132|   310k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|   310k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|   310k|        ct--; \
  |  |  |  |  |  |  |  |  135|   310k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 17.0k, False: 293k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|   293k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   772k|        } else { \
  |  |  |  |  |  |  154|   772k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   772k|        } \
  |  |  |  |  |  |  156|  1.06M|    } \
  |  |  |  |  |  |  157|  1.33M|}
  |  |  |  |  ------------------
  |  |  |  |  794|  1.33M|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 668k, False: 666k]
  |  |  |  |  ------------------
  |  |  |  |  795|  1.33M|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  1.33M|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  1.33M|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  1.33M|    } \
  |  |  |  |  797|  1.61M|}
  |  |  ------------------
  |  | 1007|  1.61M|                                flags, data, l_w, 3, \
  |  | 1008|  1.61M|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1009|  1.61M|                            *flagsp = flags; \
  |  | 1010|  1.61M|                        } \
  |  | 1011|  1.83M|                } \
  |  | 1012|  28.7k|        } \
  |  | 1013|  1.79k|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  1.79k|        mqc->curctx = curctx; \
  |  |  |  |  167|  1.79k|        mqc->c = c; \
  |  |  |  |  168|  1.79k|        mqc->a = a; \
  |  |  |  |  169|  1.79k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1014|  1.79k|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1014:13): [True: 0, False: 1.79k]
  |  |  ------------------
  |  | 1015|      0|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1015:25): [True: 0, False: 0]
  |  |  ------------------
  |  | 1016|      0|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1016:29): [True: 0, False: 0]
  |  |  ------------------
  |  | 1017|      0|                        opj_t1_dec_refpass_step_mqc(t1, flagsp, data + j * l_w, poshalf, j); \
  |  | 1018|      0|                } \
  |  | 1019|      0|            } \
  |  | 1020|      0|        } \
  |  | 1021|  1.79k|}
  ------------------
 1028|  1.79k|}
t1.c:opj_t1_getctxno_mag:
  295|  5.58M|{
  296|  5.58M|    OPJ_UINT32 tmp = (f & T1_SIGMA_NEIGHBOURS) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG;
  ------------------
  |  |  158|  5.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|  5.58M|#define T1_SIGMA_NW   T1_SIGMA_0
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  5.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|  5.58M|#define T1_SIGMA_N    T1_SIGMA_1
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  5.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|  5.58M|#define T1_SIGMA_NE   T1_SIGMA_2
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  5.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|  5.58M|#define T1_SIGMA_W    T1_SIGMA_3
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  5.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|  5.58M|#define T1_SIGMA_E    T1_SIGMA_5
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  5.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|  5.58M|#define T1_SIGMA_SW   T1_SIGMA_6
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|  5.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|  5.58M|#define T1_SIGMA_S    T1_SIGMA_7
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|  5.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|  5.58M|#define T1_SIGMA_SE   T1_SIGMA_8
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|  5.58M|#define T1_SIGMA_8  (1U << 8)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  OPJ_UINT32 tmp = (f & T1_SIGMA_NEIGHBOURS) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG;
  ------------------
  |  |   63|  5.58M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   62|  5.58M|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|  5.58M|#define T1_CTXNO_ZC  0
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  5.58M|#define T1_NUMCTXS_ZC  9
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   56|  5.58M|#define T1_NUMCTXS_SC  5
  |  |  ------------------
  ------------------
                  OPJ_UINT32 tmp = (f & T1_SIGMA_NEIGHBOURS) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG;
  ------------------
  |  |   63|  5.58M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   62|    505|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|    505|#define T1_CTXNO_ZC  0
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    505|#define T1_NUMCTXS_ZC  9
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   56|    505|#define T1_NUMCTXS_SC  5
  |  |  ------------------
  ------------------
  |  Branch (296:22): [True: 5.58M, False: 505]
  ------------------
  297|  5.58M|    OPJ_UINT32 tmp2 = (f & T1_MU_0) ? T1_CTXNO_MAG + 2 : tmp;
  ------------------
  |  |  114|  5.58M|#define T1_MU_0     (1U << 20)
  ------------------
                  OPJ_UINT32 tmp2 = (f & T1_MU_0) ? T1_CTXNO_MAG + 2 : tmp;
  ------------------
  |  |   63|  4.80M|#define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   62|  4.80M|#define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|  4.80M|#define T1_CTXNO_ZC  0
  |  |  |  |  ------------------
  |  |  |  |               #define T1_CTXNO_SC  (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  4.80M|#define T1_NUMCTXS_ZC  9
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
  |  |  ------------------
  |  |  |  |   56|  4.80M|#define T1_NUMCTXS_SC  5
  |  |  ------------------
  ------------------
  |  Branch (297:23): [True: 4.80M, False: 779k]
  ------------------
  298|  5.58M|    return tmp2;
  299|  5.58M|}
t1.c:opj_t1_dec_refpass_step_mqc:
  805|  23.9k|{
  806|  23.9k|    OPJ_UINT32 v;
  807|       |
  808|  23.9k|    opj_mqc_t *mqc = &(t1->mqc);       /* MQC component */
  809|  23.9k|    opj_t1_dec_refpass_step_mqc_macro(*flagsp, datap, 0, ci,
  ------------------
  |  |  787|  23.9k|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  788|  23.9k|{ \
  |  |  789|  23.9k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  ------------------
  |  |  |  |  153|  23.9k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  23.9k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  ------------------
  |  |  |  |  163|  23.9k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  23.9k|#define T1_PI_0     (1U << 21)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (789:9): [True: 6.70k, False: 17.2k]
  |  |  ------------------
  |  |  790|  23.9k|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  ------------------
  |  |  |  |  153|  23.9k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  23.9k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  791|  6.70k|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  792|  6.70k|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  ------------------
  |  |  |  |   65|  6.70k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  |  793|  6.70k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  6.70k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  6.70k|{ \
  |  |  |  |  140|  6.70k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  6.70k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  6.70k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  6.70k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  6.70k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  6.70k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 1.81k, False: 4.89k]
  |  |  |  |  ------------------
  |  |  |  |  146|  1.81k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  1.81k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  1.81k|{ \
  |  |  |  |  |  |   57|  1.81k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 450, False: 1.36k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|    450|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|    450|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|    450|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  1.36k|    } else { \
  |  |  |  |  |  |   62|  1.36k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  1.36k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  1.36k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  1.36k|    } \
  |  |  |  |  |  |   66|  1.81k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  1.81k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  1.81k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  1.81k|{ \
  |  |  |  |  |  |  128|  2.73k|    do { \
  |  |  |  |  |  |  129|  2.73k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 347, False: 2.38k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    347|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|    347|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|    347|{ \
  |  |  |  |  |  |  |  |  104|    347|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|    347|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|    347|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|    347|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|    347|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 343, False: 4]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    343|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 340, False: 3]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    340|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    340|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    340|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    340|            } else { \
  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  118|    343|        } else { \
  |  |  |  |  |  |  |  |  119|      4|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      4|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      4|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      4|        } \
  |  |  |  |  |  |  |  |  123|    347|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|    347|        } \
  |  |  |  |  |  |  132|  2.73k|        a <<= 1; \
  |  |  |  |  |  |  133|  2.73k|        c <<= 1; \
  |  |  |  |  |  |  134|  2.73k|        ct--; \
  |  |  |  |  |  |  135|  2.73k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 922, False: 1.81k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  1.81k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  4.89k|    } else {  \
  |  |  |  |  149|  4.89k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  4.89k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 1.81k, False: 3.08k]
  |  |  |  |  ------------------
  |  |  |  |  151|  1.81k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.81k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  1.81k|{ \
  |  |  |  |  |  |   45|  1.81k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 416, False: 1.39k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|    416|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|    416|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  1.39k|    } else { \
  |  |  |  |  |  |   49|  1.39k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  1.39k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  1.39k|    } \
  |  |  |  |  |  |   52|  1.81k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  1.81k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  1.81k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  1.81k|{ \
  |  |  |  |  |  |  128|  1.96k|    do { \
  |  |  |  |  |  |  129|  1.96k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 257, False: 1.70k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    257|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|    257|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|    257|{ \
  |  |  |  |  |  |  |  |  104|    257|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|    257|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|    257|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|    257|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|    257|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 254, False: 3]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    254|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 250, False: 4]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    250|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    250|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    250|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    250|            } else { \
  |  |  |  |  |  |  |  |  114|      4|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      4|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      4|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      4|            } \
  |  |  |  |  |  |  |  |  118|    254|        } else { \
  |  |  |  |  |  |  |  |  119|      3|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      3|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      3|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      3|        } \
  |  |  |  |  |  |  |  |  123|    257|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|    257|        } \
  |  |  |  |  |  |  132|  1.96k|        a <<= 1; \
  |  |  |  |  |  |  133|  1.96k|        c <<= 1; \
  |  |  |  |  |  |  134|  1.96k|        ct--; \
  |  |  |  |  |  |  135|  1.96k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 151, False: 1.81k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  1.81k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  3.08k|        } else { \
  |  |  |  |  154|  3.08k|            d = (*curctx)->mps; \
  |  |  |  |  155|  3.08k|        } \
  |  |  |  |  156|  4.89k|    } \
  |  |  |  |  157|  6.70k|}
  |  |  ------------------
  |  |  794|  6.70k|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  ------------------
  |  |  |  Branch (794:33): [True: 3.36k, False: 3.34k]
  |  |  ------------------
  |  |  795|  6.70k|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  ------------------
  |  |  |  |  162|  6.70k|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  6.70k|#define T1_MU_0     (1U << 20)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  796|  6.70k|    } \
  |  |  797|  23.9k|}
  ------------------
  810|  23.9k|                                      mqc, mqc->curctx, v, mqc->a, mqc->c,
  811|  23.9k|                                      mqc->ct, poshalf);
  812|  23.9k|}
t1.c:opj_t1_dec_refpass_mqc_generic:
 1033|    282|{
 1034|    282|    opj_t1_dec_refpass_mqc_internal(t1, bpno, t1->w, t1->h, t1->w + 2U);
  ------------------
  |  |  981|    282|#define opj_t1_dec_refpass_mqc_internal(t1, bpno, w, h, flags_stride) \
  |  |  982|    282|{ \
  |  |  983|    282|        OPJ_INT32 one, poshalf; \
  |  |  984|    282|        OPJ_UINT32 i, j, k; \
  |  |  985|    282|        register OPJ_INT32 *data = t1->data; \
  |  |  986|    282|        register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  |  987|    282|        const OPJ_UINT32 l_w = w; \
  |  |  988|    282|        opj_mqc_t* mqc = &(t1->mqc); \
  |  |  989|    282|        DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|    282|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|    282|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|    282|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|    282|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  |  990|    282|        register OPJ_UINT32 v; \
  |  |  991|    282|        one = 1 << bpno; \
  |  |  992|    282|        poshalf = one >> 1; \
  |  |  993|    754|        for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (993:21): [True: 472, False: 282]
  |  |  ------------------
  |  |  994|   108k|                for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (994:29): [True: 108k, False: 472]
  |  |  ------------------
  |  |  995|   108k|                        opj_flag_t flags = *flagsp; \
  |  |  996|   108k|                        if( flags != 0 ) { \
  |  |  ------------------
  |  |  |  Branch (996:29): [True: 69.4k, False: 38.6k]
  |  |  ------------------
  |  |  997|  69.4k|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  69.4k|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  69.4k|{ \
  |  |  |  |  789|  69.4k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  69.4k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  69.4k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  69.4k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  69.4k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 53.4k, False: 15.9k]
  |  |  |  |  ------------------
  |  |  |  |  790|  69.4k|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  69.4k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  69.4k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  53.4k|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  53.4k|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  53.4k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  53.4k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  53.4k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  53.4k|{ \
  |  |  |  |  |  |  140|  53.4k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  53.4k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  53.4k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  53.4k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  53.4k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  53.4k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.11k, False: 45.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.11k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.11k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.11k|{ \
  |  |  |  |  |  |  |  |   57|  8.11k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.50k, False: 6.61k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.50k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.50k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.50k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  6.61k|    } else { \
  |  |  |  |  |  |  |  |   62|  6.61k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  6.61k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  6.61k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  6.61k|    } \
  |  |  |  |  |  |  |  |   66|  8.11k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.11k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.11k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.11k|{ \
  |  |  |  |  |  |  |  |  128|  13.6k|    do { \
  |  |  |  |  |  |  |  |  129|  13.6k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.72k, False: 11.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.72k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.72k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.72k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.72k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.72k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.72k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.72k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.72k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.72k, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.72k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.72k, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.72k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.72k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.72k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.72k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.72k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      1|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      1|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      1|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      1|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.72k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.72k|        } \
  |  |  |  |  |  |  |  |  132|  13.6k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  13.6k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  13.6k|        ct--; \
  |  |  |  |  |  |  |  |  135|  13.6k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.49k, False: 8.11k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.11k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  45.3k|    } else {  \
  |  |  |  |  |  |  149|  45.3k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  45.3k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 8.71k, False: 36.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  8.71k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  8.71k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  8.71k|{ \
  |  |  |  |  |  |  |  |   45|  8.71k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.32k, False: 7.38k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.32k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.32k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  7.38k|    } else { \
  |  |  |  |  |  |  |  |   49|  7.38k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  7.38k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  7.38k|    } \
  |  |  |  |  |  |  |  |   52|  8.71k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.71k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.71k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.71k|{ \
  |  |  |  |  |  |  |  |  128|  9.24k|    do { \
  |  |  |  |  |  |  |  |  129|  9.24k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.11k, False: 8.12k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.11k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.11k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.11k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.11k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.11k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.11k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.11k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.11k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.10k, False: 5]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.10k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.10k, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.10k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.10k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.10k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.10k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.10k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      5|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      5|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      5|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      5|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.11k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.11k|        } \
  |  |  |  |  |  |  |  |  132|  9.24k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  9.24k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  9.24k|        ct--; \
  |  |  |  |  |  |  |  |  135|  9.24k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 526, False: 8.71k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.71k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  36.6k|        } else { \
  |  |  |  |  |  |  154|  36.6k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  36.6k|        } \
  |  |  |  |  |  |  156|  45.3k|    } \
  |  |  |  |  |  |  157|  53.4k|}
  |  |  |  |  ------------------
  |  |  |  |  794|  53.4k|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 25.5k, False: 27.9k]
  |  |  |  |  ------------------
  |  |  |  |  795|  53.4k|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  53.4k|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  53.4k|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  53.4k|    } \
  |  |  |  |  797|  69.4k|}
  |  |  ------------------
  |  |  998|  69.4k|                                flags, data, l_w, 0, \
  |  |  999|  69.4k|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1000|  69.4k|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  69.4k|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  69.4k|{ \
  |  |  |  |  789|  69.4k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  69.4k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  69.4k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  69.4k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  69.4k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 53.2k, False: 16.1k]
  |  |  |  |  ------------------
  |  |  |  |  790|  69.4k|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  69.4k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  69.4k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  53.2k|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  53.2k|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  53.2k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  53.2k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  53.2k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  53.2k|{ \
  |  |  |  |  |  |  140|  53.2k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  53.2k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  53.2k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  53.2k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  53.2k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  53.2k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 7.99k, False: 45.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  7.99k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  7.99k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  7.99k|{ \
  |  |  |  |  |  |  |  |   57|  7.99k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.58k, False: 6.41k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.58k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.58k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.58k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  6.41k|    } else { \
  |  |  |  |  |  |  |  |   62|  6.41k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  6.41k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  6.41k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  6.41k|    } \
  |  |  |  |  |  |  |  |   66|  7.99k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  7.99k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  7.99k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  7.99k|{ \
  |  |  |  |  |  |  |  |  128|  13.2k|    do { \
  |  |  |  |  |  |  |  |  129|  13.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.67k, False: 11.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.67k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.67k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.67k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.67k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.67k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.67k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.67k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.67k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.67k, False: 4]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.67k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.66k, False: 4]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.66k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.66k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.66k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.66k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      4|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      4|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      4|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      4|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.67k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      4|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      4|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      4|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      4|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.67k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.67k|        } \
  |  |  |  |  |  |  |  |  132|  13.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  13.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  13.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  13.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.25k, False: 7.99k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  7.99k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  45.2k|    } else {  \
  |  |  |  |  |  |  149|  45.2k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  45.2k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 8.55k, False: 36.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  8.55k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  8.55k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  8.55k|{ \
  |  |  |  |  |  |  |  |   45|  8.55k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.30k, False: 7.24k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.30k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.30k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  7.24k|    } else { \
  |  |  |  |  |  |  |  |   49|  7.24k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  7.24k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  7.24k|    } \
  |  |  |  |  |  |  |  |   52|  8.55k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.55k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.55k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.55k|{ \
  |  |  |  |  |  |  |  |  128|  9.08k|    do { \
  |  |  |  |  |  |  |  |  129|  9.08k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.14k, False: 7.93k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.14k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.14k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.14k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.14k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.14k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.14k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.14k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.14k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.13k, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.13k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.13k, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.13k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.13k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.13k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.13k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.13k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      2|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      2|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      2|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      2|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.14k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.14k|        } \
  |  |  |  |  |  |  |  |  132|  9.08k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  9.08k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  9.08k|        ct--; \
  |  |  |  |  |  |  |  |  135|  9.08k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 523, False: 8.55k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.55k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  36.7k|        } else { \
  |  |  |  |  |  |  154|  36.7k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  36.7k|        } \
  |  |  |  |  |  |  156|  45.2k|    } \
  |  |  |  |  |  |  157|  53.2k|}
  |  |  |  |  ------------------
  |  |  |  |  794|  53.2k|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 25.5k, False: 27.7k]
  |  |  |  |  ------------------
  |  |  |  |  795|  53.2k|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  53.2k|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  53.2k|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  53.2k|    } \
  |  |  |  |  797|  69.4k|}
  |  |  ------------------
  |  | 1001|  69.4k|                                flags, data, l_w, 1, \
  |  | 1002|  69.4k|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1003|  69.4k|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  69.4k|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  69.4k|{ \
  |  |  |  |  789|  69.4k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  69.4k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  69.4k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  69.4k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  69.4k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 54.5k, False: 14.8k]
  |  |  |  |  ------------------
  |  |  |  |  790|  69.4k|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  69.4k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  69.4k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  54.5k|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  54.5k|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  54.5k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  54.5k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  54.5k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  54.5k|{ \
  |  |  |  |  |  |  140|  54.5k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  54.5k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  54.5k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  54.5k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  54.5k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  54.5k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.26k, False: 46.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.26k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.26k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.26k|{ \
  |  |  |  |  |  |  |  |   57|  8.26k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.60k, False: 6.66k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.60k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.60k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.60k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  6.66k|    } else { \
  |  |  |  |  |  |  |  |   62|  6.66k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  6.66k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  6.66k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  6.66k|    } \
  |  |  |  |  |  |  |  |   66|  8.26k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.26k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.26k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.26k|{ \
  |  |  |  |  |  |  |  |  128|  13.7k|    do { \
  |  |  |  |  |  |  |  |  129|  13.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.75k, False: 12.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.75k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.75k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.75k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.75k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.75k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.75k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.75k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.75k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.75k, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.75k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.75k, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.75k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.75k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.75k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.75k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.75k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      3|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      3|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      3|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      3|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.75k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.75k|        } \
  |  |  |  |  |  |  |  |  132|  13.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  13.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  13.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  13.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.49k, False: 8.26k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.26k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  46.3k|    } else {  \
  |  |  |  |  |  |  149|  46.3k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  46.3k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 8.85k, False: 37.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  8.85k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  8.85k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  8.85k|{ \
  |  |  |  |  |  |  |  |   45|  8.85k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.31k, False: 7.54k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.31k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.31k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  7.54k|    } else { \
  |  |  |  |  |  |  |  |   49|  7.54k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  7.54k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  7.54k|    } \
  |  |  |  |  |  |  |  |   52|  8.85k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.85k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.85k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.85k|{ \
  |  |  |  |  |  |  |  |  128|  9.37k|    do { \
  |  |  |  |  |  |  |  |  129|  9.37k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.20k, False: 8.17k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.20k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.20k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.20k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.20k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.20k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.20k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.20k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.20k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.20k, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.20k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.19k, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.19k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.19k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.19k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.19k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.20k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.20k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.20k|        } \
  |  |  |  |  |  |  |  |  132|  9.37k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  9.37k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  9.37k|        ct--; \
  |  |  |  |  |  |  |  |  135|  9.37k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 525, False: 8.85k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.85k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  37.4k|        } else { \
  |  |  |  |  |  |  154|  37.4k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  37.4k|        } \
  |  |  |  |  |  |  156|  46.3k|    } \
  |  |  |  |  |  |  157|  54.5k|}
  |  |  |  |  ------------------
  |  |  |  |  794|  54.5k|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 26.6k, False: 27.9k]
  |  |  |  |  ------------------
  |  |  |  |  795|  54.5k|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  54.5k|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  54.5k|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  54.5k|    } \
  |  |  |  |  797|  69.4k|}
  |  |  ------------------
  |  | 1004|  69.4k|                                flags, data, l_w, 2, \
  |  | 1005|  69.4k|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1006|  69.4k|                            opj_t1_dec_refpass_step_mqc_macro( \
  |  |  ------------------
  |  |  |  |  787|  69.4k|                                          mqc, curctx, v, a, c, ct, poshalf) \
  |  |  |  |  788|  69.4k|{ \
  |  |  |  |  789|  69.4k|    if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  69.4k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  69.4k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == \
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  69.4k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  69.4k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (789:9): [True: 54.8k, False: 14.5k]
  |  |  |  |  ------------------
  |  |  |  |  790|  69.4k|            (T1_SIGMA_THIS << (ci * 3U))) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  69.4k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  69.4k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  791|  54.8k|        OPJ_UINT32 ctxt = opj_t1_getctxno_mag(flags >> (ci * 3U)); \
  |  |  |  |  792|  54.8k|        opj_t1_setcurctx(curctx, ctxt); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  54.8k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  |  793|  54.8k|        opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  54.8k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  54.8k|{ \
  |  |  |  |  |  |  140|  54.8k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  54.8k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  54.8k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  54.8k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  54.8k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  54.8k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 8.30k, False: 46.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  8.30k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  8.30k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  8.30k|{ \
  |  |  |  |  |  |  |  |   57|  8.30k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 1.67k, False: 6.63k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  1.67k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  1.67k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  1.67k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  6.63k|    } else { \
  |  |  |  |  |  |  |  |   62|  6.63k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  6.63k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  6.63k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  6.63k|    } \
  |  |  |  |  |  |  |  |   66|  8.30k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  8.30k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.30k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.30k|{ \
  |  |  |  |  |  |  |  |  128|  13.7k|    do { \
  |  |  |  |  |  |  |  |  129|  13.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.68k, False: 12.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.68k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.68k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.68k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.68k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.68k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.68k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.68k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.68k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.68k, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.68k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.67k, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.67k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.67k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.67k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.67k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.68k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.68k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.68k|        } \
  |  |  |  |  |  |  |  |  132|  13.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  13.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  13.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  13.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 5.40k, False: 8.30k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.30k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  46.5k|    } else {  \
  |  |  |  |  |  |  149|  46.5k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  46.5k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 8.87k, False: 37.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  8.87k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  8.87k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  8.87k|{ \
  |  |  |  |  |  |  |  |   45|  8.87k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1.32k, False: 7.55k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  1.32k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  1.32k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  7.55k|    } else { \
  |  |  |  |  |  |  |  |   49|  7.55k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  7.55k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  7.55k|    } \
  |  |  |  |  |  |  |  |   52|  8.87k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.87k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  8.87k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  8.87k|{ \
  |  |  |  |  |  |  |  |  128|  9.37k|    do { \
  |  |  |  |  |  |  |  |  129|  9.37k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1.13k, False: 8.24k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  1.13k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  1.13k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  1.13k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  1.13k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  1.13k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  1.13k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  1.13k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  1.13k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.12k, False: 5]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  1.12k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.12k, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  1.12k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  1.12k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  1.12k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  1.12k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  |  |  118|  1.12k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      5|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      5|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      5|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      5|        } \
  |  |  |  |  |  |  |  |  |  |  123|  1.13k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  1.13k|        } \
  |  |  |  |  |  |  |  |  132|  9.37k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  9.37k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  9.37k|        ct--; \
  |  |  |  |  |  |  |  |  135|  9.37k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 500, False: 8.87k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  8.87k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  37.6k|        } else { \
  |  |  |  |  |  |  154|  37.6k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  37.6k|        } \
  |  |  |  |  |  |  156|  46.5k|    } \
  |  |  |  |  |  |  157|  54.8k|}
  |  |  |  |  ------------------
  |  |  |  |  794|  54.8k|        data[ci*data_stride] += (v ^ (data[ci*data_stride] < 0)) ? poshalf : -poshalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (794:33): [True: 26.5k, False: 28.3k]
  |  |  |  |  ------------------
  |  |  |  |  795|  54.8k|        flags |= T1_MU_THIS << (ci * 3U); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|  54.8k|#define T1_MU_THIS    T1_MU_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  54.8k|#define T1_MU_0     (1U << 20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  796|  54.8k|    } \
  |  |  |  |  797|  69.4k|}
  |  |  ------------------
  |  | 1007|  69.4k|                                flags, data, l_w, 3, \
  |  | 1008|  69.4k|                                mqc, curctx, v, a, c, ct, poshalf); \
  |  | 1009|  69.4k|                            *flagsp = flags; \
  |  | 1010|  69.4k|                        } \
  |  | 1011|   108k|                } \
  |  | 1012|    472|        } \
  |  | 1013|    282|        UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|    282|        mqc->curctx = curctx; \
  |  |  |  |  167|    282|        mqc->c = c; \
  |  |  |  |  168|    282|        mqc->a = a; \
  |  |  |  |  169|    282|        mqc->ct = ct;
  |  |  ------------------
  |  | 1014|    282|        if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1014:13): [True: 173, False: 109]
  |  |  ------------------
  |  | 1015|  17.3k|            for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1015:25): [True: 17.1k, False: 173]
  |  |  ------------------
  |  | 1016|  41.1k|                for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1016:29): [True: 23.9k, False: 17.1k]
  |  |  ------------------
  |  | 1017|  23.9k|                        opj_t1_dec_refpass_step_mqc(t1, flagsp, data + j * l_w, poshalf, j); \
  |  | 1018|  23.9k|                } \
  |  | 1019|  17.1k|            } \
  |  | 1020|    173|        } \
  |  | 1021|    282|}
  ------------------
 1035|    282|}
t1.c:opj_t1_dec_clnpass:
 1398|  2.31k|{
 1399|  2.31k|    if (t1->w == 64 && t1->h == 64) {
  ------------------
  |  Branch (1399:9): [True: 2.17k, False: 147]
  |  Branch (1399:24): [True: 2.00k, False: 167]
  ------------------
 1400|  2.00k|        if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  ------------------
  |  |   61|  2.00k|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  |  Branch (1400:13): [True: 2.00k, False: 0]
  ------------------
 1401|  2.00k|            opj_t1_dec_clnpass_64x64_vsc(t1, bpno);
 1402|  2.00k|        } else {
 1403|      0|            opj_t1_dec_clnpass_64x64_novsc(t1, bpno);
 1404|      0|        }
 1405|  2.00k|    } else {
 1406|    314|        if (cblksty & J2K_CCP_CBLKSTY_VSC) {
  ------------------
  |  |   61|    314|#define J2K_CCP_CBLKSTY_VSC 0x08      /**< Vertically stripe causal context */
  ------------------
  |  Branch (1406:13): [True: 179, False: 135]
  ------------------
 1407|    179|            opj_t1_dec_clnpass_generic_vsc(t1, bpno);
 1408|    179|        } else {
 1409|    135|            opj_t1_dec_clnpass_generic_novsc(t1, bpno);
 1410|    135|        }
 1411|    314|    }
 1412|  2.31k|    opj_t1_dec_clnpass_check_segsym(t1, cblksty);
 1413|  2.31k|}
t1.c:opj_t1_dec_clnpass_64x64_vsc:
 1374|  2.00k|{
 1375|  2.00k|    opj_t1_dec_clnpass_internal(t1, bpno, OPJ_TRUE, 64, 64, 66);
  ------------------
  |  | 1254|  2.00k|#define opj_t1_dec_clnpass_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  | 1255|  2.00k|{ \
  |  | 1256|  2.00k|    OPJ_INT32 one, half, oneplushalf; \
  |  | 1257|  2.00k|    OPJ_UINT32 runlen; \
  |  | 1258|  2.00k|    OPJ_UINT32 i, j, k; \
  |  | 1259|  2.00k|    const OPJ_UINT32 l_w = w; \
  |  | 1260|  2.00k|    opj_mqc_t* mqc = &(t1->mqc); \
  |  | 1261|  2.00k|    register OPJ_INT32 *data = t1->data; \
  |  | 1262|  2.00k|    register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  | 1263|  2.00k|    DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|  2.00k|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|  2.00k|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|  2.00k|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|  2.00k|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  | 1264|  2.00k|    register OPJ_UINT32 v; \
  |  | 1265|  2.00k|    one = 1 << bpno; \
  |  | 1266|  2.00k|    half = one >> 1; \
  |  | 1267|  2.00k|    oneplushalf = one | half; \
  |  | 1268|  34.0k|    for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (1268:17): [True: 32.0k, False: 2.00k]
  |  |  ------------------
  |  | 1269|  2.08M|        for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1269:21): [True: 2.05M, False: 32.0k]
  |  |  ------------------
  |  | 1270|  2.05M|            opj_flag_t flags = *flagsp; \
  |  | 1271|  2.05M|            if (flags == 0) { \
  |  |  ------------------
  |  |  |  Branch (1271:17): [True: 347k, False: 1.70M]
  |  |  ------------------
  |  | 1272|   347k|                OPJ_UINT32 partial = OPJ_TRUE; \
  |  |  ------------------
  |  |  |  |  117|   347k|#define OPJ_TRUE 1
  |  |  ------------------
  |  | 1273|   347k|                opj_t1_setcurctx(curctx, T1_CTXNO_AGG); \
  |  |  ------------------
  |  |  |  |   65|   347k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1274|   347k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|   347k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|   347k|{ \
  |  |  |  |  140|   347k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|   347k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|   347k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|   347k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|   347k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|   347k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 17.0k, False: 330k]
  |  |  |  |  ------------------
  |  |  |  |  146|  17.0k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  17.0k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  17.0k|{ \
  |  |  |  |  |  |   57|  17.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 2.32k, False: 14.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  2.32k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  2.32k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  2.32k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  14.6k|    } else { \
  |  |  |  |  |  |   62|  14.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  14.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  14.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  14.6k|    } \
  |  |  |  |  |  |   66|  17.0k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  17.0k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  17.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  17.0k|{ \
  |  |  |  |  |  |  128|  34.7k|    do { \
  |  |  |  |  |  |  129|  34.7k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 4.29k, False: 30.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  4.29k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  4.29k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  4.29k|{ \
  |  |  |  |  |  |  |  |  104|  4.29k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  4.29k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  4.29k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  4.29k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  4.29k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.87k, False: 1.41k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  2.87k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.44k, False: 430]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  2.44k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  2.44k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  2.44k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  2.44k|            } else { \
  |  |  |  |  |  |  |  |  114|    430|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    430|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    430|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    430|            } \
  |  |  |  |  |  |  |  |  118|  2.87k|        } else { \
  |  |  |  |  |  |  |  |  119|  1.41k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|  1.41k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|  1.41k|            ct = 8; \
  |  |  |  |  |  |  |  |  122|  1.41k|        } \
  |  |  |  |  |  |  |  |  123|  4.29k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  4.29k|        } \
  |  |  |  |  |  |  132|  34.7k|        a <<= 1; \
  |  |  |  |  |  |  133|  34.7k|        c <<= 1; \
  |  |  |  |  |  |  134|  34.7k|        ct--; \
  |  |  |  |  |  |  135|  34.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 17.7k, False: 17.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  17.0k|}
  |  |  |  |  ------------------
  |  |  |  |  148|   330k|    } else {  \
  |  |  |  |  149|   330k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|   330k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 20.0k, False: 310k]
  |  |  |  |  ------------------
  |  |  |  |  151|  20.0k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  20.0k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  20.0k|{ \
  |  |  |  |  |  |   45|  20.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 1.76k, False: 18.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  1.76k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  1.76k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  18.3k|    } else { \
  |  |  |  |  |  |   49|  18.3k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  18.3k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  18.3k|    } \
  |  |  |  |  |  |   52|  20.0k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  20.0k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  20.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  20.0k|{ \
  |  |  |  |  |  |  128|  20.7k|    do { \
  |  |  |  |  |  |  129|  20.7k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 2.77k, False: 18.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  2.77k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  2.77k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  2.77k|{ \
  |  |  |  |  |  |  |  |  104|  2.77k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  2.77k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  2.77k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  2.77k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  2.77k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1.84k, False: 929]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  1.84k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1.59k, False: 250]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|  1.59k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|  1.59k|                ct = 8; \
  |  |  |  |  |  |  |  |  112|  1.59k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|  1.59k|            } else { \
  |  |  |  |  |  |  |  |  114|    250|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    250|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    250|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    250|            } \
  |  |  |  |  |  |  |  |  118|  1.84k|        } else { \
  |  |  |  |  |  |  |  |  119|    929|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    929|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    929|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    929|        } \
  |  |  |  |  |  |  |  |  123|  2.77k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  2.77k|        } \
  |  |  |  |  |  |  132|  20.7k|        a <<= 1; \
  |  |  |  |  |  |  133|  20.7k|        c <<= 1; \
  |  |  |  |  |  |  134|  20.7k|        ct--; \
  |  |  |  |  |  |  135|  20.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 723, False: 20.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  20.0k|}
  |  |  |  |  ------------------
  |  |  |  |  153|   310k|        } else { \
  |  |  |  |  154|   310k|            d = (*curctx)->mps; \
  |  |  |  |  155|   310k|        } \
  |  |  |  |  156|   330k|    } \
  |  |  |  |  157|   347k|}
  |  |  ------------------
  |  | 1275|   347k|                if (!v) { \
  |  |  ------------------
  |  |  |  Branch (1275:21): [True: 328k, False: 18.5k]
  |  |  ------------------
  |  | 1276|   328k|                    continue; \
  |  | 1277|   328k|                } \
  |  | 1278|   347k|                opj_t1_setcurctx(curctx, T1_CTXNO_UNI); \
  |  |  ------------------
  |  |  |  |   65|  18.5k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1279|  18.5k|                opj_mqc_decode_macro(runlen, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  18.5k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  18.5k|{ \
  |  |  |  |  140|  18.5k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  18.5k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  18.5k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  18.5k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  18.5k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  18.5k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 9.60k, False: 8.95k]
  |  |  |  |  ------------------
  |  |  |  |  146|  9.60k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  9.60k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  9.60k|{ \
  |  |  |  |  |  |   57|  9.60k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 5.76k, False: 3.83k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  5.76k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  5.76k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  5.76k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  5.76k|    } else { \
  |  |  |  |  |  |   62|  3.83k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  3.83k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  3.83k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  3.83k|    } \
  |  |  |  |  |  |   66|  9.60k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  9.60k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  9.60k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  9.60k|{ \
  |  |  |  |  |  |  128|  9.60k|    do { \
  |  |  |  |  |  |  129|  9.60k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 1.30k, False: 8.29k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  1.30k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  1.30k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  1.30k|{ \
  |  |  |  |  |  |  |  |  104|  1.30k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  1.30k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  1.30k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  1.30k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  1.30k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 904, False: 403]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    904|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 756, False: 148]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    756|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    756|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    756|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    756|            } else { \
  |  |  |  |  |  |  |  |  114|    148|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    148|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    148|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    148|            } \
  |  |  |  |  |  |  |  |  118|    904|        } else { \
  |  |  |  |  |  |  |  |  119|    403|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    403|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    403|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    403|        } \
  |  |  |  |  |  |  |  |  123|  1.30k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  1.30k|        } \
  |  |  |  |  |  |  132|  9.60k|        a <<= 1; \
  |  |  |  |  |  |  133|  9.60k|        c <<= 1; \
  |  |  |  |  |  |  134|  9.60k|        ct--; \
  |  |  |  |  |  |  135|  9.60k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 9.60k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  9.60k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  9.60k|    } else {  \
  |  |  |  |  149|  8.95k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  8.95k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 7.10k, False: 1.84k]
  |  |  |  |  ------------------
  |  |  |  |  151|  7.10k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  7.10k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  7.10k|{ \
  |  |  |  |  |  |   45|  7.10k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 3.88k, False: 3.22k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  3.88k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  3.88k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  3.88k|    } else { \
  |  |  |  |  |  |   49|  3.22k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  3.22k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  3.22k|    } \
  |  |  |  |  |  |   52|  7.10k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  7.10k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  7.10k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  7.10k|{ \
  |  |  |  |  |  |  128|  8.71k|    do { \
  |  |  |  |  |  |  129|  8.71k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 1.03k, False: 7.68k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  1.03k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  1.03k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  1.03k|{ \
  |  |  |  |  |  |  |  |  104|  1.03k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  1.03k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  1.03k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  1.03k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  1.03k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 833, False: 198]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    833|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 721, False: 112]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    721|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    721|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    721|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    721|            } else { \
  |  |  |  |  |  |  |  |  114|    112|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    112|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    112|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    112|            } \
  |  |  |  |  |  |  |  |  118|    833|        } else { \
  |  |  |  |  |  |  |  |  119|    198|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    198|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    198|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    198|        } \
  |  |  |  |  |  |  |  |  123|  1.03k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  1.03k|        } \
  |  |  |  |  |  |  132|  8.71k|        a <<= 1; \
  |  |  |  |  |  |  133|  8.71k|        c <<= 1; \
  |  |  |  |  |  |  134|  8.71k|        ct--; \
  |  |  |  |  |  |  135|  8.71k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 1.61k, False: 7.10k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  7.10k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  7.10k|        } else { \
  |  |  |  |  154|  1.84k|            d = (*curctx)->mps; \
  |  |  |  |  155|  1.84k|        } \
  |  |  |  |  156|  8.95k|    } \
  |  |  |  |  157|  18.5k|}
  |  |  ------------------
  |  | 1280|  18.5k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  18.5k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  18.5k|{ \
  |  |  |  |  140|  18.5k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  18.5k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  18.5k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  18.5k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  18.5k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  18.5k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 9.11k, False: 9.44k]
  |  |  |  |  ------------------
  |  |  |  |  146|  9.11k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  9.11k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  9.11k|{ \
  |  |  |  |  |  |   57|  9.11k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 2.43k, False: 6.67k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|  2.43k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|  2.43k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|  2.43k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|  6.67k|    } else { \
  |  |  |  |  |  |   62|  6.67k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|  6.67k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|  6.67k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|  6.67k|    } \
  |  |  |  |  |  |   66|  9.11k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  9.11k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  9.11k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  9.11k|{ \
  |  |  |  |  |  |  128|  9.11k|    do { \
  |  |  |  |  |  |  129|  9.11k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 1.26k, False: 7.84k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  1.26k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  1.26k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  1.26k|{ \
  |  |  |  |  |  |  |  |  104|  1.26k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  1.26k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  1.26k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  1.26k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  1.26k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 821, False: 442]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    821|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 720, False: 101]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    720|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    720|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    720|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    720|            } else { \
  |  |  |  |  |  |  |  |  114|    101|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    101|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    101|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    101|            } \
  |  |  |  |  |  |  |  |  118|    821|        } else { \
  |  |  |  |  |  |  |  |  119|    442|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    442|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    442|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    442|        } \
  |  |  |  |  |  |  |  |  123|  1.26k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  1.26k|        } \
  |  |  |  |  |  |  132|  9.11k|        a <<= 1; \
  |  |  |  |  |  |  133|  9.11k|        c <<= 1; \
  |  |  |  |  |  |  134|  9.11k|        ct--; \
  |  |  |  |  |  |  135|  9.11k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 9.11k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  9.11k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  9.44k|    } else {  \
  |  |  |  |  149|  9.44k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  9.44k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 7.96k, False: 1.48k]
  |  |  |  |  ------------------
  |  |  |  |  151|  7.96k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  7.96k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  7.96k|{ \
  |  |  |  |  |  |   45|  7.96k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 1.69k, False: 6.26k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  1.69k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|  1.69k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|  6.26k|    } else { \
  |  |  |  |  |  |   49|  6.26k|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|  6.26k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|  6.26k|    } \
  |  |  |  |  |  |   52|  7.96k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  7.96k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  7.96k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  7.96k|{ \
  |  |  |  |  |  |  128|  8.90k|    do { \
  |  |  |  |  |  |  129|  8.90k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 1.03k, False: 7.87k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  1.03k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|  1.03k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|  1.03k|{ \
  |  |  |  |  |  |  |  |  104|  1.03k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|  1.03k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|  1.03k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|  1.03k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|  1.03k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 793, False: 240]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    793|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 678, False: 115]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    678|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    678|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    678|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    678|            } else { \
  |  |  |  |  |  |  |  |  114|    115|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|    115|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|    115|                ct = 7; \
  |  |  |  |  |  |  |  |  117|    115|            } \
  |  |  |  |  |  |  |  |  118|    793|        } else { \
  |  |  |  |  |  |  |  |  119|    240|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|    240|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|    240|            ct = 8; \
  |  |  |  |  |  |  |  |  122|    240|        } \
  |  |  |  |  |  |  |  |  123|  1.03k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  1.03k|        } \
  |  |  |  |  |  |  132|  8.90k|        a <<= 1; \
  |  |  |  |  |  |  133|  8.90k|        c <<= 1; \
  |  |  |  |  |  |  134|  8.90k|        ct--; \
  |  |  |  |  |  |  135|  8.90k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 941, False: 7.96k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  7.96k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  7.96k|        } else { \
  |  |  |  |  154|  1.48k|            d = (*curctx)->mps; \
  |  |  |  |  155|  1.48k|        } \
  |  |  |  |  156|  9.44k|    } \
  |  |  |  |  157|  18.5k|}
  |  |  ------------------
  |  | 1281|  18.5k|                runlen = (runlen << 1) | v; \
  |  | 1282|  18.5k|                switch(runlen) { \
  |  |  ------------------
  |  |  |  Branch (1282:24): [True: 0, False: 18.5k]
  |  |  ------------------
  |  | 1283|  6.23k|                    case 0: \
  |  |  ------------------
  |  |  |  Branch (1283:21): [True: 6.23k, False: 12.3k]
  |  |  ------------------
  |  | 1284|  6.23k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, OPJ_TRUE,\
  |  |  ------------------
  |  |  |  | 1121|  6.23k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  6.23k|{ \
  |  |  |  | 1123|  6.23k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  6.23k|        do { \
  |  |  |  | 1125|  6.23k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|      0|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|      0|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      0|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|      0|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      0|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|      0|{ \
  |  |  |  |  |  |  140|      0|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|      0|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|      0|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|      0|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|      0|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|      0|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|      0|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|      0|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|      0|{ \
  |  |  |  |  |  |  |  |   57|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|      0|    } else { \
  |  |  |  |  |  |  |  |   62|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|      0|    } \
  |  |  |  |  |  |  |  |   66|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|      0|    } else {  \
  |  |  |  |  |  |  149|      0|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|      0|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|      0|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|      0|{ \
  |  |  |  |  |  |  |  |   45|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|      0|    } else { \
  |  |  |  |  |  |  |  |   49|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|      0|    } \
  |  |  |  |  |  |  |  |   52|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|        } else { \
  |  |  |  |  |  |  154|      0|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|      0|        } \
  |  |  |  |  |  |  156|      0|    } \
  |  |  |  |  |  |  157|      0|}
  |  |  |  |  ------------------
  |  |  |  | 1129|      0|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1130|      0|                    break; \
  |  |  |  | 1131|      0|            } \
  |  |  |  | 1132|  6.23k|            { \
  |  |  |  | 1133|  6.23k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  6.23k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  6.23k|                                    ci); \
  |  |  |  | 1136|  6.23k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  6.23k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  6.23k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  6.23k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  6.23k|{ \
  |  |  |  |  |  |  140|  6.23k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  6.23k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  6.23k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  6.23k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  6.23k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  6.23k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 2.07k, False: 4.15k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.07k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  2.07k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  2.07k|{ \
  |  |  |  |  |  |  |  |   57|  2.07k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 120, False: 1.95k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    120|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    120|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    120|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.95k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.95k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.95k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.95k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.95k|    } \
  |  |  |  |  |  |  |  |   66|  2.07k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.07k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.07k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.07k|{ \
  |  |  |  |  |  |  |  |  128|  3.07k|    do { \
  |  |  |  |  |  |  |  |  129|  3.07k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 347, False: 2.72k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    347|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    347|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    347|{ \
  |  |  |  |  |  |  |  |  |  |  104|    347|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    347|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    347|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    347|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    347|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 286, False: 61]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    286|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 243, False: 43]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    243|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    243|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    243|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    243|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     43|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     43|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     43|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     43|            } \
  |  |  |  |  |  |  |  |  |  |  118|    286|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     61|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     61|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     61|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     61|        } \
  |  |  |  |  |  |  |  |  |  |  123|    347|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    347|        } \
  |  |  |  |  |  |  |  |  132|  3.07k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.07k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.07k|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.07k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 993, False: 2.07k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.07k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  4.15k|    } else {  \
  |  |  |  |  |  |  149|  4.15k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  4.15k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.32k, False: 1.82k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.32k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.32k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.32k|{ \
  |  |  |  |  |  |  |  |   45|  2.32k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 91, False: 2.23k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     91|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     91|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  2.23k|    } else { \
  |  |  |  |  |  |  |  |   49|  2.23k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  2.23k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  2.23k|    } \
  |  |  |  |  |  |  |  |   52|  2.32k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.32k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.32k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.32k|{ \
  |  |  |  |  |  |  |  |  128|  2.32k|    do { \
  |  |  |  |  |  |  |  |  129|  2.32k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 255, False: 2.07k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    255|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    255|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    255|{ \
  |  |  |  |  |  |  |  |  |  |  104|    255|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    255|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    255|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    255|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    255|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 207, False: 48]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    207|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 152, False: 55]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    152|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    152|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    152|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    152|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     55|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     55|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     55|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     55|            } \
  |  |  |  |  |  |  |  |  |  |  118|    207|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     48|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     48|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     48|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     48|        } \
  |  |  |  |  |  |  |  |  |  |  123|    255|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    255|        } \
  |  |  |  |  |  |  |  |  132|  2.32k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.32k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.32k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.32k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1, False: 2.32k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.32k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.32k|        } else { \
  |  |  |  |  |  |  154|  1.82k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.82k|        } \
  |  |  |  |  |  |  156|  4.15k|    } \
  |  |  |  |  |  |  157|  6.23k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  6.23k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  6.23k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 3.57k, False: 2.65k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  6.23k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  6.23k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  6.23k|{ \
  |  |  |  |  |  |  326|  6.23k|    /* east */ \
  |  |  |  |  |  |  327|  6.23k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  6.23k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  6.23k| \
  |  |  |  |  |  |  329|  6.23k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  6.23k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  6.23k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  6.23k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  6.23k| \
  |  |  |  |  |  |  332|  6.23k|    /* west */ \
  |  |  |  |  |  |  333|  6.23k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  6.23k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  6.23k| \
  |  |  |  |  |  |  335|  6.23k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  6.23k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  6.23k| \
  |  |  |  |  |  |  343|  6.23k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  6.23k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  6.23k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  6.23k|            } \
  |  |  |  | 1142|  6.23k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  6.23k|    } \
  |  |  |  | 1144|  6.23k|}
  |  |  ------------------
  |  | 1285|  6.23k|                                            flags, flagsp, flags_stride, data, \
  |  | 1286|  6.23k|                                            l_w, 0, mqc, curctx, \
  |  | 1287|  6.23k|                                            v, a, c, ct, oneplushalf, vsc); \
  |  | 1288|  6.23k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|  6.23k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1289|  6.23k|                        /* FALLTHRU */ \
  |  | 1290|  10.8k|                    case 1: \
  |  |  ------------------
  |  |  |  Branch (1290:21): [True: 4.60k, False: 13.9k]
  |  |  ------------------
  |  | 1291|  10.8k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|  10.8k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  10.8k|{ \
  |  |  |  | 1123|  10.8k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  10.8k|        do { \
  |  |  |  | 1125|  10.8k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 6.23k, False: 4.60k]
  |  |  |  |  ------------------
  |  |  |  | 1126|  6.23k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  6.23k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  6.23k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  6.23k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  6.23k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  6.23k|{ \
  |  |  |  |  |  |  140|  6.23k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  6.23k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  6.23k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  6.23k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  6.23k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  6.23k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 840, False: 5.39k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    840|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    840|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    840|{ \
  |  |  |  |  |  |  |  |   57|    840|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 136, False: 704]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    136|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    136|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    136|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    704|    } else { \
  |  |  |  |  |  |  |  |   62|    704|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    704|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    704|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    704|    } \
  |  |  |  |  |  |  |  |   66|    840|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    840|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    840|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    840|{ \
  |  |  |  |  |  |  |  |  128|  1.54k|    do { \
  |  |  |  |  |  |  |  |  129|  1.54k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 206, False: 1.33k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    206|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    206|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    206|{ \
  |  |  |  |  |  |  |  |  |  |  104|    206|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    206|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    206|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    206|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    206|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 167, False: 39]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    167|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 155, False: 12]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    155|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    155|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    155|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    155|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     12|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     12|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     12|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     12|            } \
  |  |  |  |  |  |  |  |  |  |  118|    167|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     39|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     39|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     39|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     39|        } \
  |  |  |  |  |  |  |  |  |  |  123|    206|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    206|        } \
  |  |  |  |  |  |  |  |  132|  1.54k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.54k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.54k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.54k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 702, False: 840]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    840|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  5.39k|    } else {  \
  |  |  |  |  |  |  149|  5.39k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  5.39k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.13k, False: 4.26k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.13k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.13k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.13k|{ \
  |  |  |  |  |  |  |  |   45|  1.13k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 132, False: 999]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    132|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    132|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    999|    } else { \
  |  |  |  |  |  |  |  |   49|    999|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    999|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    999|    } \
  |  |  |  |  |  |  |  |   52|  1.13k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.13k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.13k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.13k|{ \
  |  |  |  |  |  |  |  |  128|  1.18k|    do { \
  |  |  |  |  |  |  |  |  129|  1.18k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 136, False: 1.04k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    136|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    136|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    136|{ \
  |  |  |  |  |  |  |  |  |  |  104|    136|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    136|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    136|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    136|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    136|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 108, False: 28]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    108|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 94, False: 14]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     94|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     94|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     94|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     94|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     14|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     14|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     14|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     14|            } \
  |  |  |  |  |  |  |  |  |  |  118|    108|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     28|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     28|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     28|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     28|        } \
  |  |  |  |  |  |  |  |  |  |  123|    136|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    136|        } \
  |  |  |  |  |  |  |  |  132|  1.18k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.18k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.18k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.18k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 54, False: 1.13k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.13k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.26k|        } else { \
  |  |  |  |  |  |  154|  4.26k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.26k|        } \
  |  |  |  |  |  |  156|  5.39k|    } \
  |  |  |  |  |  |  157|  6.23k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  6.23k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 5.13k, False: 1.09k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  6.23k|                    break; \
  |  |  |  | 1131|  6.23k|            } \
  |  |  |  | 1132|  10.8k|            { \
  |  |  |  | 1133|  5.70k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  5.70k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  5.70k|                                    ci); \
  |  |  |  | 1136|  5.70k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  5.70k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  5.70k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  5.70k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  5.70k|{ \
  |  |  |  |  |  |  140|  5.70k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  5.70k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  5.70k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  5.70k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  5.70k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  5.70k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.97k, False: 3.73k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.97k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.97k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.97k|{ \
  |  |  |  |  |  |  |  |   57|  1.97k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 171, False: 1.80k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    171|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    171|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    171|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.80k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.80k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.80k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.80k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.80k|    } \
  |  |  |  |  |  |  |  |   66|  1.97k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.97k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.97k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.97k|{ \
  |  |  |  |  |  |  |  |  128|  2.84k|    do { \
  |  |  |  |  |  |  |  |  129|  2.84k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 342, False: 2.50k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    342|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    342|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    342|{ \
  |  |  |  |  |  |  |  |  |  |  104|    342|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    342|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    342|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    342|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    342|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 278, False: 64]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    278|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 231, False: 47]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    231|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    231|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    231|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    231|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     47|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     47|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     47|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     47|            } \
  |  |  |  |  |  |  |  |  |  |  118|    278|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     64|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     64|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     64|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     64|        } \
  |  |  |  |  |  |  |  |  |  |  123|    342|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    342|        } \
  |  |  |  |  |  |  |  |  132|  2.84k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.84k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.84k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.84k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 875, False: 1.97k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.97k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.73k|    } else {  \
  |  |  |  |  |  |  149|  3.73k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.73k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.08k, False: 1.64k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.08k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.08k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.08k|{ \
  |  |  |  |  |  |  |  |   45|  2.08k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 62, False: 2.02k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     62|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     62|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  2.02k|    } else { \
  |  |  |  |  |  |  |  |   49|  2.02k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  2.02k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  2.02k|    } \
  |  |  |  |  |  |  |  |   52|  2.08k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.08k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.08k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.08k|{ \
  |  |  |  |  |  |  |  |  128|  2.12k|    do { \
  |  |  |  |  |  |  |  |  129|  2.12k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 248, False: 1.87k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    248|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    248|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    248|{ \
  |  |  |  |  |  |  |  |  |  |  104|    248|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    248|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    248|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    248|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    248|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 198, False: 50]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    198|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 164, False: 34]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    164|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    164|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    164|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    164|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     34|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     34|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     34|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     34|            } \
  |  |  |  |  |  |  |  |  |  |  118|    198|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     50|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     50|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     50|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     50|        } \
  |  |  |  |  |  |  |  |  |  |  123|    248|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    248|        } \
  |  |  |  |  |  |  |  |  132|  2.12k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.12k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.12k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.12k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 35, False: 2.08k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.08k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.08k|        } else { \
  |  |  |  |  |  |  154|  1.64k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.64k|        } \
  |  |  |  |  |  |  156|  3.73k|    } \
  |  |  |  |  |  |  157|  5.70k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  5.70k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  5.70k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 3.19k, False: 2.50k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  5.70k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  5.70k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  5.70k|{ \
  |  |  |  |  |  |  326|  5.70k|    /* east */ \
  |  |  |  |  |  |  327|  5.70k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  5.70k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  5.70k| \
  |  |  |  |  |  |  329|  5.70k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  5.70k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  5.70k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  5.70k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  5.70k| \
  |  |  |  |  |  |  332|  5.70k|    /* west */ \
  |  |  |  |  |  |  333|  5.70k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  5.70k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  5.70k| \
  |  |  |  |  |  |  335|  5.70k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  5.70k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  5.70k| \
  |  |  |  |  |  |  343|  5.70k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  5.70k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  5.70k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  5.70k|            } \
  |  |  |  | 1142|  5.70k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  10.8k|    } \
  |  |  |  | 1144|  10.8k|}
  |  |  ------------------
  |  | 1292|  10.8k|                                            flags, flagsp, flags_stride, data, \
  |  | 1293|  10.8k|                                            l_w, 1, mqc, curctx, \
  |  | 1294|  10.8k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1295|  10.8k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|  10.8k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1296|  10.8k|                        /* FALLTHRU */ \
  |  | 1297|  14.7k|                    case 2: \
  |  |  ------------------
  |  |  |  Branch (1297:21): [True: 3.95k, False: 14.6k]
  |  |  ------------------
  |  | 1298|  14.7k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|  14.7k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  14.7k|{ \
  |  |  |  | 1123|  14.7k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  14.7k|        do { \
  |  |  |  | 1125|  14.7k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 10.8k, False: 3.95k]
  |  |  |  |  ------------------
  |  |  |  | 1126|  10.8k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  10.8k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  10.8k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  10.8k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  10.8k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  10.8k|{ \
  |  |  |  |  |  |  140|  10.8k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  10.8k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  10.8k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  10.8k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  10.8k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  10.8k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.27k, False: 9.56k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.27k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.27k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.27k|{ \
  |  |  |  |  |  |  |  |   57|  1.27k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 242, False: 1.02k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    242|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    242|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    242|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.02k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.02k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.02k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.02k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.02k|    } \
  |  |  |  |  |  |  |  |   66|  1.27k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.27k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.27k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.27k|{ \
  |  |  |  |  |  |  |  |  128|  2.26k|    do { \
  |  |  |  |  |  |  |  |  129|  2.26k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 233, False: 2.02k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    233|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    233|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    233|{ \
  |  |  |  |  |  |  |  |  |  |  104|    233|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    233|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    233|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    233|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    233|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 190, False: 43]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    190|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 168, False: 22]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    168|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    168|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    168|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    168|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     22|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     22|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     22|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     22|            } \
  |  |  |  |  |  |  |  |  |  |  118|    190|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     43|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     43|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     43|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     43|        } \
  |  |  |  |  |  |  |  |  |  |  123|    233|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    233|        } \
  |  |  |  |  |  |  |  |  132|  2.26k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.26k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.26k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.26k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 991, False: 1.27k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.27k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  9.56k|    } else {  \
  |  |  |  |  |  |  149|  9.56k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  9.56k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.58k, False: 7.98k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.58k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.58k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.58k|{ \
  |  |  |  |  |  |  |  |   45|  1.58k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 153, False: 1.43k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    153|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    153|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.43k|    } else { \
  |  |  |  |  |  |  |  |   49|  1.43k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.43k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.43k|    } \
  |  |  |  |  |  |  |  |   52|  1.58k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.58k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.58k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.58k|{ \
  |  |  |  |  |  |  |  |  128|  1.66k|    do { \
  |  |  |  |  |  |  |  |  129|  1.66k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 198, False: 1.46k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    198|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    198|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    198|{ \
  |  |  |  |  |  |  |  |  |  |  104|    198|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    198|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    198|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    198|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    198|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 166, False: 32]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    166|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 149, False: 17]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    149|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    149|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    149|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    149|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     17|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     17|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     17|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     17|            } \
  |  |  |  |  |  |  |  |  |  |  118|    166|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     32|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     32|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     32|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     32|        } \
  |  |  |  |  |  |  |  |  |  |  123|    198|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    198|        } \
  |  |  |  |  |  |  |  |  132|  1.66k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.66k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.66k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.66k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 82, False: 1.58k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.58k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  7.98k|        } else { \
  |  |  |  |  |  |  154|  7.98k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  7.98k|        } \
  |  |  |  |  |  |  156|  9.56k|    } \
  |  |  |  |  |  |  157|  10.8k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  10.8k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 9.16k, False: 1.67k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  10.8k|                    break; \
  |  |  |  | 1131|  10.8k|            } \
  |  |  |  | 1132|  14.7k|            { \
  |  |  |  | 1133|  5.62k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  5.62k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  5.62k|                                    ci); \
  |  |  |  | 1136|  5.62k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  5.62k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  5.62k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  5.62k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  5.62k|{ \
  |  |  |  |  |  |  140|  5.62k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  5.62k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  5.62k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  5.62k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  5.62k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  5.62k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.80k, False: 3.81k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.80k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.80k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.80k|{ \
  |  |  |  |  |  |  |  |   57|  1.80k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 155, False: 1.65k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    155|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    155|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    155|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.65k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.65k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.65k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.65k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.65k|    } \
  |  |  |  |  |  |  |  |   66|  1.80k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.80k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.80k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.80k|{ \
  |  |  |  |  |  |  |  |  128|  2.82k|    do { \
  |  |  |  |  |  |  |  |  129|  2.82k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 310, False: 2.51k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    310|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    310|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    310|{ \
  |  |  |  |  |  |  |  |  |  |  104|    310|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    310|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    310|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    310|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    310|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 257, False: 53]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    257|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 225, False: 32]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    225|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    225|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    225|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    225|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     32|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     32|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     32|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     32|            } \
  |  |  |  |  |  |  |  |  |  |  118|    257|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     53|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     53|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     53|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     53|        } \
  |  |  |  |  |  |  |  |  |  |  123|    310|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    310|        } \
  |  |  |  |  |  |  |  |  132|  2.82k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.82k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.82k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.82k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.01k, False: 1.80k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.80k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.81k|    } else {  \
  |  |  |  |  |  |  149|  3.81k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.81k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.08k, False: 1.73k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.08k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.08k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.08k|{ \
  |  |  |  |  |  |  |  |   45|  2.08k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 167, False: 1.91k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    167|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    167|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.91k|    } else { \
  |  |  |  |  |  |  |  |   49|  1.91k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.91k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.91k|    } \
  |  |  |  |  |  |  |  |   52|  2.08k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.08k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.08k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.08k|{ \
  |  |  |  |  |  |  |  |  128|  2.16k|    do { \
  |  |  |  |  |  |  |  |  129|  2.16k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 271, False: 1.88k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    271|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    271|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    271|{ \
  |  |  |  |  |  |  |  |  |  |  104|    271|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    271|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    271|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    271|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    271|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 223, False: 48]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    223|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 206, False: 17]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    206|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    206|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    206|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    206|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     17|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     17|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     17|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     17|            } \
  |  |  |  |  |  |  |  |  |  |  118|    223|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     48|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     48|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     48|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     48|        } \
  |  |  |  |  |  |  |  |  |  |  123|    271|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    271|        } \
  |  |  |  |  |  |  |  |  132|  2.16k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.16k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.16k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.16k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 79, False: 2.08k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.08k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.08k|        } else { \
  |  |  |  |  |  |  154|  1.73k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.73k|        } \
  |  |  |  |  |  |  156|  3.81k|    } \
  |  |  |  |  |  |  157|  5.62k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  5.62k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  5.62k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 2.95k, False: 2.66k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  5.62k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  5.62k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  5.62k|{ \
  |  |  |  |  |  |  326|  5.62k|    /* east */ \
  |  |  |  |  |  |  327|  5.62k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  5.62k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  5.62k| \
  |  |  |  |  |  |  329|  5.62k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  5.62k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  5.62k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  5.62k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  5.62k| \
  |  |  |  |  |  |  332|  5.62k|    /* west */ \
  |  |  |  |  |  |  333|  5.62k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  5.62k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  5.62k| \
  |  |  |  |  |  |  335|  5.62k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  5.62k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  5.62k| \
  |  |  |  |  |  |  343|  5.62k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  5.62k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  5.62k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  5.62k|            } \
  |  |  |  | 1142|  5.62k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  14.7k|    } \
  |  |  |  | 1144|  14.7k|}
  |  |  ------------------
  |  | 1299|  14.7k|                                            flags, flagsp, flags_stride, data, \
  |  | 1300|  14.7k|                                            l_w, 2, mqc, curctx, \
  |  | 1301|  14.7k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1302|  14.7k|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|  14.7k|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1303|  14.7k|                        /* FALLTHRU */ \
  |  | 1304|  18.5k|                    case 3: \
  |  |  ------------------
  |  |  |  Branch (1304:21): [True: 3.76k, False: 14.7k]
  |  |  ------------------
  |  | 1305|  18.5k|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|  18.5k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  18.5k|{ \
  |  |  |  | 1123|  18.5k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|  18.5k|        do { \
  |  |  |  | 1125|  18.5k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 14.7k, False: 3.76k]
  |  |  |  |  ------------------
  |  |  |  | 1126|  14.7k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  14.7k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  14.7k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  14.7k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  14.7k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  14.7k|{ \
  |  |  |  |  |  |  140|  14.7k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  14.7k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  14.7k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  14.7k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  14.7k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  14.7k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.38k, False: 13.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.38k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.38k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.38k|{ \
  |  |  |  |  |  |  |  |   57|  1.38k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 310, False: 1.07k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    310|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    310|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    310|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.07k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.07k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.07k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.07k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.07k|    } \
  |  |  |  |  |  |  |  |   66|  1.38k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.38k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.38k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.38k|{ \
  |  |  |  |  |  |  |  |  128|  2.49k|    do { \
  |  |  |  |  |  |  |  |  129|  2.49k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 310, False: 2.18k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    310|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    310|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    310|{ \
  |  |  |  |  |  |  |  |  |  |  104|    310|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    310|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    310|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    310|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    310|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 214, False: 96]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    214|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 181, False: 33]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    181|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    181|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    181|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    181|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     33|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     33|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     33|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     33|            } \
  |  |  |  |  |  |  |  |  |  |  118|    214|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     96|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     96|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     96|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     96|        } \
  |  |  |  |  |  |  |  |  |  |  123|    310|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    310|        } \
  |  |  |  |  |  |  |  |  132|  2.49k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.49k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.49k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.49k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.11k, False: 1.38k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.38k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  13.4k|    } else {  \
  |  |  |  |  |  |  149|  13.4k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  13.4k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.57k, False: 11.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.57k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.57k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.57k|{ \
  |  |  |  |  |  |  |  |   45|  1.57k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 186, False: 1.38k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    186|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    186|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.38k|    } else { \
  |  |  |  |  |  |  |  |   49|  1.38k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.38k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.38k|    } \
  |  |  |  |  |  |  |  |   52|  1.57k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.57k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.57k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.57k|{ \
  |  |  |  |  |  |  |  |  128|  1.69k|    do { \
  |  |  |  |  |  |  |  |  129|  1.69k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 254, False: 1.43k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    254|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    254|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    254|{ \
  |  |  |  |  |  |  |  |  |  |  104|    254|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    254|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    254|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    254|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    254|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 213, False: 41]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    213|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 183, False: 30]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    183|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    183|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    183|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    183|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     30|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     30|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     30|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     30|            } \
  |  |  |  |  |  |  |  |  |  |  118|    213|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     41|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     41|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     41|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     41|        } \
  |  |  |  |  |  |  |  |  |  |  123|    254|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    254|        } \
  |  |  |  |  |  |  |  |  132|  1.69k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.69k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.69k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.69k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 120, False: 1.57k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.57k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  11.8k|        } else { \
  |  |  |  |  |  |  154|  11.8k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  11.8k|        } \
  |  |  |  |  |  |  156|  13.4k|    } \
  |  |  |  |  |  |  157|  14.7k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  14.7k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 12.8k, False: 1.90k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  14.7k|                    break; \
  |  |  |  | 1131|  14.7k|            } \
  |  |  |  | 1132|  18.5k|            { \
  |  |  |  | 1133|  5.66k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  5.66k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  5.66k|                                    ci); \
  |  |  |  | 1136|  5.66k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  5.66k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  5.66k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  5.66k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  5.66k|{ \
  |  |  |  |  |  |  140|  5.66k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  5.66k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  5.66k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  5.66k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  5.66k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  5.66k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.84k, False: 3.81k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.84k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.84k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.84k|{ \
  |  |  |  |  |  |  |  |   57|  1.84k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 208, False: 1.64k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    208|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    208|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    208|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.64k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.64k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.64k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.64k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.64k|    } \
  |  |  |  |  |  |  |  |   66|  1.84k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.84k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.84k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.84k|{ \
  |  |  |  |  |  |  |  |  128|  2.81k|    do { \
  |  |  |  |  |  |  |  |  129|  2.81k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 304, False: 2.50k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    304|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    304|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    304|{ \
  |  |  |  |  |  |  |  |  |  |  104|    304|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    304|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    304|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    304|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    304|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 238, False: 66]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    238|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 212, False: 26]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    212|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    212|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    212|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    212|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     26|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     26|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     26|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     26|            } \
  |  |  |  |  |  |  |  |  |  |  118|    238|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     66|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     66|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     66|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     66|        } \
  |  |  |  |  |  |  |  |  |  |  123|    304|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    304|        } \
  |  |  |  |  |  |  |  |  132|  2.81k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.81k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.81k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.81k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 962, False: 1.84k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.84k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.81k|    } else {  \
  |  |  |  |  |  |  149|  3.81k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.81k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.12k, False: 1.69k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.12k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.12k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.12k|{ \
  |  |  |  |  |  |  |  |   45|  2.12k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 134, False: 1.99k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    134|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    134|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.99k|    } else { \
  |  |  |  |  |  |  |  |   49|  1.99k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.99k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.99k|    } \
  |  |  |  |  |  |  |  |   52|  2.12k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.12k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.12k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.12k|{ \
  |  |  |  |  |  |  |  |  128|  2.19k|    do { \
  |  |  |  |  |  |  |  |  129|  2.19k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 349, False: 1.84k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    349|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    349|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    349|{ \
  |  |  |  |  |  |  |  |  |  |  104|    349|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    349|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    349|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    349|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    349|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 225, False: 124]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    225|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 192, False: 33]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    192|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    192|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    192|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    192|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     33|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     33|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     33|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     33|            } \
  |  |  |  |  |  |  |  |  |  |  118|    225|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    124|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    124|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    124|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    124|        } \
  |  |  |  |  |  |  |  |  |  |  123|    349|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    349|        } \
  |  |  |  |  |  |  |  |  132|  2.19k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.19k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.19k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.19k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 69, False: 2.12k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.12k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.12k|        } else { \
  |  |  |  |  |  |  154|  1.69k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.69k|        } \
  |  |  |  |  |  |  156|  3.81k|    } \
  |  |  |  |  |  |  157|  5.66k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  5.66k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  5.66k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 3.23k, False: 2.42k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  5.66k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  5.66k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  5.66k|{ \
  |  |  |  |  |  |  326|  5.66k|    /* east */ \
  |  |  |  |  |  |  327|  5.66k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  5.66k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  5.66k| \
  |  |  |  |  |  |  329|  5.66k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  5.66k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  5.66k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  5.66k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  5.66k| \
  |  |  |  |  |  |  332|  5.66k|    /* west */ \
  |  |  |  |  |  |  333|  5.66k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  5.66k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  5.66k| \
  |  |  |  |  |  |  335|  5.66k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  5.66k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  5.66k| \
  |  |  |  |  |  |  343|  5.66k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  5.66k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  5.66k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|  5.66k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  5.66k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  5.66k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|  5.66k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  5.66k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|  5.66k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  5.66k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|  5.66k|    } \
  |  |  |  |  |  |  350|  5.66k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  5.66k|            } \
  |  |  |  | 1142|  5.66k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  18.5k|    } \
  |  |  |  | 1144|  18.5k|}
  |  |  ------------------
  |  | 1306|  18.5k|                                            flags, flagsp, flags_stride, data, \
  |  | 1307|  18.5k|                                            l_w, 3, mqc, curctx, \
  |  | 1308|  18.5k|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1309|  18.5k|                        break; \
  |  | 1310|  18.5k|                } \
  |  | 1311|  1.70M|            } else { \
  |  | 1312|  1.70M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  1.70M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  1.70M|{ \
  |  |  |  | 1123|  1.70M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.70M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.70M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.70M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.70M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 200k, False: 1.50M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   200k|        do { \
  |  |  |  | 1125|   200k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   200k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   200k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   200k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   200k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   200k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   200k|{ \
  |  |  |  |  |  |  140|   200k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   200k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   200k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   200k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   200k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   200k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 47.0k, False: 153k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  47.0k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  47.0k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  47.0k|{ \
  |  |  |  |  |  |  |  |   57|  47.0k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 9.95k, False: 37.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  9.95k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  9.95k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  9.95k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  37.0k|    } else { \
  |  |  |  |  |  |  |  |   62|  37.0k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  37.0k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  37.0k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  37.0k|    } \
  |  |  |  |  |  |  |  |   66|  47.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  47.0k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  47.0k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  47.0k|{ \
  |  |  |  |  |  |  |  |  128|  74.3k|    do { \
  |  |  |  |  |  |  |  |  129|  74.3k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 9.80k, False: 64.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  9.80k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  9.80k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  9.80k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  9.80k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  9.80k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  9.80k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  9.80k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  9.80k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 8.28k, False: 1.51k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  8.28k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 7.88k, False: 401]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  7.88k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  7.88k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  7.88k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  7.88k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    401|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    401|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    401|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    401|            } \
  |  |  |  |  |  |  |  |  |  |  118|  8.28k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.51k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.51k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.51k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.51k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  9.80k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  9.80k|        } \
  |  |  |  |  |  |  |  |  132|  74.3k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  74.3k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  74.3k|        ct--; \
  |  |  |  |  |  |  |  |  135|  74.3k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 27.3k, False: 47.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  47.0k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   153k|    } else {  \
  |  |  |  |  |  |  149|   153k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   153k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 45.9k, False: 107k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  45.9k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  45.9k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  45.9k|{ \
  |  |  |  |  |  |  |  |   45|  45.9k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 7.21k, False: 38.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  7.21k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  7.21k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  38.7k|    } else { \
  |  |  |  |  |  |  |  |   49|  38.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  38.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  38.7k|    } \
  |  |  |  |  |  |  |  |   52|  45.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  45.9k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  45.9k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  45.9k|{ \
  |  |  |  |  |  |  |  |  128|  49.2k|    do { \
  |  |  |  |  |  |  |  |  129|  49.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 6.09k, False: 43.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  6.09k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  6.09k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  6.09k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  6.09k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  6.09k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  6.09k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  6.09k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  6.09k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5.42k, False: 669]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  5.42k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5.19k, False: 234]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  5.19k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  5.19k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  5.19k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  5.19k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    234|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    234|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    234|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    234|            } \
  |  |  |  |  |  |  |  |  |  |  118|  5.42k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    669|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    669|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    669|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    669|        } \
  |  |  |  |  |  |  |  |  |  |  123|  6.09k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  6.09k|        } \
  |  |  |  |  |  |  |  |  132|  49.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  49.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  49.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  49.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 3.30k, False: 45.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  45.9k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   107k|        } else { \
  |  |  |  |  |  |  154|   107k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   107k|        } \
  |  |  |  |  |  |  156|   153k|    } \
  |  |  |  |  |  |  157|   200k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   200k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 116k, False: 83.7k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   200k|                    break; \
  |  |  |  | 1131|   200k|            } \
  |  |  |  | 1132|   200k|            { \
  |  |  |  | 1133|  83.7k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  83.7k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  83.7k|                                    ci); \
  |  |  |  | 1136|  83.7k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  83.7k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  83.7k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  83.7k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  83.7k|{ \
  |  |  |  |  |  |  140|  83.7k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  83.7k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  83.7k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  83.7k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  83.7k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  83.7k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 24.8k, False: 58.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  24.8k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  24.8k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  24.8k|{ \
  |  |  |  |  |  |  |  |   57|  24.8k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 5.17k, False: 19.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  5.17k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  5.17k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  5.17k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  19.6k|    } else { \
  |  |  |  |  |  |  |  |   62|  19.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  19.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  19.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  19.6k|    } \
  |  |  |  |  |  |  |  |   66|  24.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  24.8k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  24.8k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  24.8k|{ \
  |  |  |  |  |  |  |  |  128|  37.7k|    do { \
  |  |  |  |  |  |  |  |  129|  37.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4.77k, False: 32.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  4.77k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  4.77k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  4.77k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  4.77k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  4.77k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  4.77k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  4.77k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  4.77k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.12k, False: 653]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.12k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.97k, False: 148]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.97k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.97k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.97k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.97k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    148|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    148|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    148|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    148|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.12k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    653|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    653|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    653|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    653|        } \
  |  |  |  |  |  |  |  |  |  |  123|  4.77k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  4.77k|        } \
  |  |  |  |  |  |  |  |  132|  37.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  37.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  37.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  37.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 12.9k, False: 24.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  24.8k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  58.9k|    } else {  \
  |  |  |  |  |  |  149|  58.9k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  58.9k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 24.1k, False: 34.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  24.1k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  24.1k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  24.1k|{ \
  |  |  |  |  |  |  |  |   45|  24.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 4.12k, False: 19.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  4.12k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  4.12k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  19.9k|    } else { \
  |  |  |  |  |  |  |  |   49|  19.9k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  19.9k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  19.9k|    } \
  |  |  |  |  |  |  |  |   52|  24.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  24.1k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  24.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  24.1k|{ \
  |  |  |  |  |  |  |  |  128|  25.8k|    do { \
  |  |  |  |  |  |  |  |  129|  25.8k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3.00k, False: 22.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  3.00k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  3.00k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  3.00k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  3.00k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  3.00k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  3.00k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  3.00k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  3.00k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.73k, False: 269]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.73k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.61k, False: 125]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.61k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.61k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.61k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.61k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    125|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    125|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    125|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    125|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.73k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    269|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    269|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    269|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    269|        } \
  |  |  |  |  |  |  |  |  |  |  123|  3.00k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  3.00k|        } \
  |  |  |  |  |  |  |  |  132|  25.8k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  25.8k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  25.8k|        ct--; \
  |  |  |  |  |  |  |  |  135|  25.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.78k, False: 24.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  24.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  34.8k|        } else { \
  |  |  |  |  |  |  154|  34.8k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  34.8k|        } \
  |  |  |  |  |  |  156|  58.9k|    } \
  |  |  |  |  |  |  157|  83.7k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  83.7k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  83.7k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 41.3k, False: 42.3k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  83.7k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  83.7k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  83.7k|{ \
  |  |  |  |  |  |  326|  83.7k|    /* east */ \
  |  |  |  |  |  |  327|  83.7k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  83.7k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  83.7k| \
  |  |  |  |  |  |  329|  83.7k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  83.7k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  83.7k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  83.7k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  83.7k| \
  |  |  |  |  |  |  332|  83.7k|    /* west */ \
  |  |  |  |  |  |  333|  83.7k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  83.7k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  83.7k| \
  |  |  |  |  |  |  335|  83.7k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  83.7k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  83.7k| \
  |  |  |  |  |  |  343|  83.7k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  83.7k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  83.7k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  83.7k|            } \
  |  |  |  | 1142|  83.7k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   200k|    } \
  |  |  |  | 1144|  1.70M|}
  |  |  ------------------
  |  | 1313|  1.70M|                                    flags, flagsp, flags_stride, data, \
  |  | 1314|  1.70M|                                    l_w, 0, mqc, curctx, \
  |  | 1315|  1.70M|                                    v, a, c, ct, oneplushalf, vsc); \
  |  | 1316|  1.70M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  1.70M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  1.70M|{ \
  |  |  |  | 1123|  1.70M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.70M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.70M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.70M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.70M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 200k, False: 1.50M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   200k|        do { \
  |  |  |  | 1125|   200k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   200k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   200k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   200k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   200k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   200k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   200k|{ \
  |  |  |  |  |  |  140|   200k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   200k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   200k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   200k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   200k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   200k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 45.4k, False: 154k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  45.4k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  45.4k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  45.4k|{ \
  |  |  |  |  |  |  |  |   57|  45.4k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 8.84k, False: 36.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  8.84k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  8.84k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  8.84k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  36.6k|    } else { \
  |  |  |  |  |  |  |  |   62|  36.6k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  36.6k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  36.6k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  36.6k|    } \
  |  |  |  |  |  |  |  |   66|  45.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  45.4k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  45.4k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  45.4k|{ \
  |  |  |  |  |  |  |  |  128|  73.8k|    do { \
  |  |  |  |  |  |  |  |  129|  73.8k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 9.22k, False: 64.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  9.22k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  9.22k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  9.22k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  9.22k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  9.22k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  9.22k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  9.22k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  9.22k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.77k, False: 1.44k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  7.77k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 7.40k, False: 377]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  7.40k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  7.40k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  7.40k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  7.40k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    377|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    377|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    377|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    377|            } \
  |  |  |  |  |  |  |  |  |  |  118|  7.77k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.44k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.44k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.44k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.44k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  9.22k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  9.22k|        } \
  |  |  |  |  |  |  |  |  132|  73.8k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  73.8k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  73.8k|        ct--; \
  |  |  |  |  |  |  |  |  135|  73.8k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 28.4k, False: 45.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  45.4k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   154k|    } else {  \
  |  |  |  |  |  |  149|   154k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   154k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 44.5k, False: 110k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  44.5k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  44.5k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  44.5k|{ \
  |  |  |  |  |  |  |  |   45|  44.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 6.89k, False: 37.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  6.89k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  6.89k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  37.6k|    } else { \
  |  |  |  |  |  |  |  |   49|  37.6k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  37.6k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  37.6k|    } \
  |  |  |  |  |  |  |  |   52|  44.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  44.5k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  44.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  44.5k|{ \
  |  |  |  |  |  |  |  |  128|  47.5k|    do { \
  |  |  |  |  |  |  |  |  129|  47.5k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 6.27k, False: 41.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  6.27k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  6.27k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  6.27k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  6.27k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  6.27k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  6.27k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  6.27k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  6.27k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5.48k, False: 794]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  5.48k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5.08k, False: 397]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  5.08k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  5.08k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  5.08k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  5.08k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    397|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    397|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    397|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    397|            } \
  |  |  |  |  |  |  |  |  |  |  118|  5.48k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    794|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    794|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    794|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    794|        } \
  |  |  |  |  |  |  |  |  |  |  123|  6.27k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  6.27k|        } \
  |  |  |  |  |  |  |  |  132|  47.5k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  47.5k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  47.5k|        ct--; \
  |  |  |  |  |  |  |  |  135|  47.5k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 3.07k, False: 44.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  44.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   110k|        } else { \
  |  |  |  |  |  |  154|   110k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   110k|        } \
  |  |  |  |  |  |  156|   154k|    } \
  |  |  |  |  |  |  157|   200k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   200k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 116k, False: 83.3k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   200k|                    break; \
  |  |  |  | 1131|   200k|            } \
  |  |  |  | 1132|   200k|            { \
  |  |  |  | 1133|  83.3k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  83.3k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  83.3k|                                    ci); \
  |  |  |  | 1136|  83.3k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  83.3k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  83.3k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  83.3k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  83.3k|{ \
  |  |  |  |  |  |  140|  83.3k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  83.3k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  83.3k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  83.3k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  83.3k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  83.3k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 25.1k, False: 58.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  25.1k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  25.1k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  25.1k|{ \
  |  |  |  |  |  |  |  |   57|  25.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 5.69k, False: 19.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  5.69k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  5.69k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  5.69k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  19.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  19.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  19.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  19.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  19.4k|    } \
  |  |  |  |  |  |  |  |   66|  25.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  25.1k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  25.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  25.1k|{ \
  |  |  |  |  |  |  |  |  128|  38.1k|    do { \
  |  |  |  |  |  |  |  |  129|  38.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4.78k, False: 33.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  4.78k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  4.78k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  4.78k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  4.78k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  4.78k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  4.78k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  4.78k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  4.78k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.12k, False: 657]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.12k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.96k, False: 161]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.96k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.96k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.96k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.96k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    161|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    161|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    161|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    161|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.12k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    657|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    657|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    657|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    657|        } \
  |  |  |  |  |  |  |  |  |  |  123|  4.78k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  4.78k|        } \
  |  |  |  |  |  |  |  |  132|  38.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  38.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  38.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  38.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 13.0k, False: 25.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  25.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  58.2k|    } else {  \
  |  |  |  |  |  |  149|  58.2k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  58.2k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 23.1k, False: 35.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  23.1k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  23.1k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  23.1k|{ \
  |  |  |  |  |  |  |  |   45|  23.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 4.16k, False: 19.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  4.16k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  4.16k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  19.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  19.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  19.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  19.0k|    } \
  |  |  |  |  |  |  |  |   52|  23.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  23.1k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  23.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  23.1k|{ \
  |  |  |  |  |  |  |  |  128|  25.1k|    do { \
  |  |  |  |  |  |  |  |  129|  25.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3.09k, False: 22.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  3.09k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  3.09k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  3.09k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  3.09k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  3.09k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  3.09k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  3.09k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  3.09k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.85k, False: 239]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.85k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.72k, False: 134]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.72k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.72k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.72k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.72k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    134|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    134|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    134|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    134|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.85k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    239|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    239|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    239|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    239|        } \
  |  |  |  |  |  |  |  |  |  |  123|  3.09k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  3.09k|        } \
  |  |  |  |  |  |  |  |  132|  25.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  25.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  25.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  25.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.91k, False: 23.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  23.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  35.0k|        } else { \
  |  |  |  |  |  |  154|  35.0k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  35.0k|        } \
  |  |  |  |  |  |  156|  58.2k|    } \
  |  |  |  |  |  |  157|  83.3k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  83.3k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  83.3k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 42.4k, False: 40.9k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  83.3k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  83.3k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  83.3k|{ \
  |  |  |  |  |  |  326|  83.3k|    /* east */ \
  |  |  |  |  |  |  327|  83.3k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  83.3k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  83.3k| \
  |  |  |  |  |  |  329|  83.3k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  83.3k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  83.3k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  83.3k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  83.3k| \
  |  |  |  |  |  |  332|  83.3k|    /* west */ \
  |  |  |  |  |  |  333|  83.3k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  83.3k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  83.3k| \
  |  |  |  |  |  |  335|  83.3k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  83.3k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  83.3k| \
  |  |  |  |  |  |  343|  83.3k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  83.3k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  83.3k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  83.3k|            } \
  |  |  |  | 1142|  83.3k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   200k|    } \
  |  |  |  | 1144|  1.70M|}
  |  |  ------------------
  |  | 1317|  1.70M|                                    flags, flagsp, flags_stride, data, \
  |  | 1318|  1.70M|                                    l_w, 1, mqc, curctx, \
  |  | 1319|  1.70M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1320|  1.70M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  1.70M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  1.70M|{ \
  |  |  |  | 1123|  1.70M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.70M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.70M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.70M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.70M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 202k, False: 1.50M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   202k|        do { \
  |  |  |  | 1125|   202k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   202k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   202k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   202k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   202k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   202k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   202k|{ \
  |  |  |  |  |  |  140|   202k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   202k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   202k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   202k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   202k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   202k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 44.1k, False: 158k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  44.1k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  44.1k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  44.1k|{ \
  |  |  |  |  |  |  |  |   57|  44.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 8.42k, False: 35.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  8.42k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  8.42k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  8.42k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  35.7k|    } else { \
  |  |  |  |  |  |  |  |   62|  35.7k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  35.7k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  35.7k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  35.7k|    } \
  |  |  |  |  |  |  |  |   66|  44.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  44.1k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  44.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  44.1k|{ \
  |  |  |  |  |  |  |  |  128|  71.9k|    do { \
  |  |  |  |  |  |  |  |  129|  71.9k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 9.10k, False: 62.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  9.10k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  9.10k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  9.10k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  9.10k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  9.10k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  9.10k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  9.10k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  9.10k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7.59k, False: 1.51k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  7.59k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 7.15k, False: 443]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  7.15k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  7.15k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  7.15k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  7.15k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    443|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    443|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    443|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    443|            } \
  |  |  |  |  |  |  |  |  |  |  118|  7.59k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.51k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.51k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.51k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.51k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  9.10k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  9.10k|        } \
  |  |  |  |  |  |  |  |  132|  71.9k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  71.9k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  71.9k|        ct--; \
  |  |  |  |  |  |  |  |  135|  71.9k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 27.7k, False: 44.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  44.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   158k|    } else {  \
  |  |  |  |  |  |  149|   158k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   158k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 43.2k, False: 115k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  43.2k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  43.2k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  43.2k|{ \
  |  |  |  |  |  |  |  |   45|  43.2k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 6.35k, False: 36.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  6.35k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  6.35k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  36.8k|    } else { \
  |  |  |  |  |  |  |  |   49|  36.8k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  36.8k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  36.8k|    } \
  |  |  |  |  |  |  |  |   52|  43.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  43.2k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  43.2k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  43.2k|{ \
  |  |  |  |  |  |  |  |  128|  46.2k|    do { \
  |  |  |  |  |  |  |  |  129|  46.2k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 5.94k, False: 40.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  5.94k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  5.94k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  5.94k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  5.94k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  5.94k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  5.94k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  5.94k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  5.94k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5.43k, False: 509]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  5.43k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5.16k, False: 272]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  5.16k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  5.16k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  5.16k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  5.16k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    272|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    272|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    272|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    272|            } \
  |  |  |  |  |  |  |  |  |  |  118|  5.43k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    509|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    509|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    509|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    509|        } \
  |  |  |  |  |  |  |  |  |  |  123|  5.94k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  5.94k|        } \
  |  |  |  |  |  |  |  |  132|  46.2k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  46.2k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  46.2k|        ct--; \
  |  |  |  |  |  |  |  |  135|  46.2k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 3.00k, False: 43.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  43.2k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   115k|        } else { \
  |  |  |  |  |  |  154|   115k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   115k|        } \
  |  |  |  |  |  |  156|   158k|    } \
  |  |  |  |  |  |  157|   202k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   202k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 120k, False: 82.1k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   202k|                    break; \
  |  |  |  | 1131|   202k|            } \
  |  |  |  | 1132|   202k|            { \
  |  |  |  | 1133|  82.1k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  82.1k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  82.1k|                                    ci); \
  |  |  |  | 1136|  82.1k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  82.1k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  82.1k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  82.1k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  82.1k|{ \
  |  |  |  |  |  |  140|  82.1k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  82.1k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  82.1k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  82.1k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  82.1k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  82.1k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 24.5k, False: 57.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  24.5k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  24.5k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  24.5k|{ \
  |  |  |  |  |  |  |  |   57|  24.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 4.68k, False: 19.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  4.68k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  4.68k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  4.68k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  19.8k|    } else { \
  |  |  |  |  |  |  |  |   62|  19.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  19.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  19.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  19.8k|    } \
  |  |  |  |  |  |  |  |   66|  24.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  24.5k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  24.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  24.5k|{ \
  |  |  |  |  |  |  |  |  128|  37.7k|    do { \
  |  |  |  |  |  |  |  |  129|  37.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4.96k, False: 32.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  4.96k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  4.96k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  4.96k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  4.96k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  4.96k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  4.96k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  4.96k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  4.96k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.11k, False: 854]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.11k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.98k, False: 127]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.98k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.98k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.98k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.98k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    127|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    127|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    127|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    127|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.11k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    854|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    854|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    854|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    854|        } \
  |  |  |  |  |  |  |  |  |  |  123|  4.96k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  4.96k|        } \
  |  |  |  |  |  |  |  |  132|  37.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  37.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  37.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  37.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 13.2k, False: 24.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  24.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  57.5k|    } else {  \
  |  |  |  |  |  |  149|  57.5k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  57.5k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 23.5k, False: 33.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  23.5k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  23.5k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  23.5k|{ \
  |  |  |  |  |  |  |  |   45|  23.5k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 4.57k, False: 19.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  4.57k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  4.57k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  19.0k|    } else { \
  |  |  |  |  |  |  |  |   49|  19.0k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  19.0k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  19.0k|    } \
  |  |  |  |  |  |  |  |   52|  23.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  23.5k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  23.5k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  23.5k|{ \
  |  |  |  |  |  |  |  |  128|  25.7k|    do { \
  |  |  |  |  |  |  |  |  129|  25.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3.23k, False: 22.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  3.23k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  3.23k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  3.23k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  3.23k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  3.23k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  3.23k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  3.23k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  3.23k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.97k, False: 255]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.97k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.87k, False: 107]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.87k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.87k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.87k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.87k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    107|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    107|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    107|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    107|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.97k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    255|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    255|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    255|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    255|        } \
  |  |  |  |  |  |  |  |  |  |  123|  3.23k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  3.23k|        } \
  |  |  |  |  |  |  |  |  132|  25.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  25.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  25.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  25.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.17k, False: 23.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  23.5k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  33.9k|        } else { \
  |  |  |  |  |  |  154|  33.9k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  33.9k|        } \
  |  |  |  |  |  |  156|  57.5k|    } \
  |  |  |  |  |  |  157|  82.1k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  82.1k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  82.1k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 41.5k, False: 40.5k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  82.1k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  82.1k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  82.1k|{ \
  |  |  |  |  |  |  326|  82.1k|    /* east */ \
  |  |  |  |  |  |  327|  82.1k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  82.1k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  82.1k| \
  |  |  |  |  |  |  329|  82.1k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  82.1k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  82.1k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  82.1k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  82.1k| \
  |  |  |  |  |  |  332|  82.1k|    /* west */ \
  |  |  |  |  |  |  333|  82.1k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  82.1k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  82.1k| \
  |  |  |  |  |  |  335|  82.1k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  82.1k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  82.1k| \
  |  |  |  |  |  |  343|  82.1k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  82.1k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  82.1k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  82.1k|            } \
  |  |  |  | 1142|  82.1k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   202k|    } \
  |  |  |  | 1144|  1.70M|}
  |  |  ------------------
  |  | 1321|  1.70M|                                    flags, flagsp, flags_stride, data, \
  |  | 1322|  1.70M|                                    l_w, 2, mqc, curctx, \
  |  | 1323|  1.70M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1324|  1.70M|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  1.70M|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  1.70M|{ \
  |  |  |  | 1123|  1.70M|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.70M|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  1.70M|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  1.70M|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  1.70M|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 211k, False: 1.49M]
  |  |  |  |  ------------------
  |  |  |  | 1124|   211k|        do { \
  |  |  |  | 1125|   211k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|   211k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|   211k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|   211k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|   211k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|   211k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|   211k|{ \
  |  |  |  |  |  |  140|   211k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|   211k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|   211k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|   211k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|   211k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|   211k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 40.3k, False: 170k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  40.3k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  40.3k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  40.3k|{ \
  |  |  |  |  |  |  |  |   57|  40.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 6.90k, False: 33.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  6.90k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  6.90k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  6.90k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  33.4k|    } else { \
  |  |  |  |  |  |  |  |   62|  33.4k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  33.4k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  33.4k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  33.4k|    } \
  |  |  |  |  |  |  |  |   66|  40.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  40.3k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  40.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  40.3k|{ \
  |  |  |  |  |  |  |  |  128|  67.3k|    do { \
  |  |  |  |  |  |  |  |  129|  67.3k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 8.07k, False: 59.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  8.07k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  8.07k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  8.07k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  8.07k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  8.07k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  8.07k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  8.07k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  8.07k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 6.89k, False: 1.17k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  6.89k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 6.60k, False: 288]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  6.60k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  6.60k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  6.60k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  6.60k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    288|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    288|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    288|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    288|            } \
  |  |  |  |  |  |  |  |  |  |  118|  6.89k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|  1.17k|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|  1.17k|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|  1.17k|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|  1.17k|        } \
  |  |  |  |  |  |  |  |  |  |  123|  8.07k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  8.07k|        } \
  |  |  |  |  |  |  |  |  132|  67.3k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  67.3k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  67.3k|        ct--; \
  |  |  |  |  |  |  |  |  135|  67.3k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 27.0k, False: 40.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  40.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   170k|    } else {  \
  |  |  |  |  |  |  149|   170k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|   170k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 40.1k, False: 130k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  40.1k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  40.1k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  40.1k|{ \
  |  |  |  |  |  |  |  |   45|  40.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 5.46k, False: 34.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  5.46k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  5.46k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  34.7k|    } else { \
  |  |  |  |  |  |  |  |   49|  34.7k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  34.7k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  34.7k|    } \
  |  |  |  |  |  |  |  |   52|  40.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  40.1k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  40.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  40.1k|{ \
  |  |  |  |  |  |  |  |  128|  42.7k|    do { \
  |  |  |  |  |  |  |  |  129|  42.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 5.30k, False: 37.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  5.30k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  5.30k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  5.30k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  5.30k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  5.30k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  5.30k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  5.30k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  5.30k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4.81k, False: 488]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  4.81k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4.64k, False: 178]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  4.64k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  4.64k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  4.64k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  4.64k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    178|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    178|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    178|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    178|            } \
  |  |  |  |  |  |  |  |  |  |  118|  4.81k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    488|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    488|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    488|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    488|        } \
  |  |  |  |  |  |  |  |  |  |  123|  5.30k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  5.30k|        } \
  |  |  |  |  |  |  |  |  132|  42.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  42.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  42.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  42.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2.51k, False: 40.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  40.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   130k|        } else { \
  |  |  |  |  |  |  154|   130k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|   130k|        } \
  |  |  |  |  |  |  156|   170k|    } \
  |  |  |  |  |  |  157|   211k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|   211k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 131k, False: 79.1k]
  |  |  |  |  ------------------
  |  |  |  | 1130|   211k|                    break; \
  |  |  |  | 1131|   211k|            } \
  |  |  |  | 1132|   211k|            { \
  |  |  |  | 1133|  79.1k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  79.1k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  79.1k|                                    ci); \
  |  |  |  | 1136|  79.1k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  79.1k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  79.1k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  79.1k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  79.1k|{ \
  |  |  |  |  |  |  140|  79.1k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  79.1k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  79.1k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  79.1k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  79.1k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  79.1k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 23.1k, False: 56.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  23.1k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  23.1k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  23.1k|{ \
  |  |  |  |  |  |  |  |   57|  23.1k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 5.21k, False: 17.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|  5.21k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|  5.21k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|  5.21k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  17.8k|    } else { \
  |  |  |  |  |  |  |  |   62|  17.8k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  17.8k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  17.8k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  17.8k|    } \
  |  |  |  |  |  |  |  |   66|  23.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  23.1k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  23.1k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  23.1k|{ \
  |  |  |  |  |  |  |  |  128|  34.7k|    do { \
  |  |  |  |  |  |  |  |  129|  34.7k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4.42k, False: 30.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  4.42k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  4.42k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  4.42k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  4.42k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  4.42k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  4.42k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  4.42k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  4.42k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 3.86k, False: 568]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  3.86k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3.72k, False: 140]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  3.72k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  3.72k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  3.72k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  3.72k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|    140|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|    140|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|    140|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|    140|            } \
  |  |  |  |  |  |  |  |  |  |  118|  3.86k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    568|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    568|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    568|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    568|        } \
  |  |  |  |  |  |  |  |  |  |  123|  4.42k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  4.42k|        } \
  |  |  |  |  |  |  |  |  132|  34.7k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  34.7k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  34.7k|        ct--; \
  |  |  |  |  |  |  |  |  135|  34.7k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 11.6k, False: 23.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  23.1k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  56.0k|    } else {  \
  |  |  |  |  |  |  149|  56.0k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  56.0k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 22.3k, False: 33.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  22.3k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  22.3k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  22.3k|{ \
  |  |  |  |  |  |  |  |   45|  22.3k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 4.15k, False: 18.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|  4.15k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|  4.15k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  18.1k|    } else { \
  |  |  |  |  |  |  |  |   49|  18.1k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  18.1k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  18.1k|    } \
  |  |  |  |  |  |  |  |   52|  22.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  22.3k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  22.3k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  22.3k|{ \
  |  |  |  |  |  |  |  |  128|  24.1k|    do { \
  |  |  |  |  |  |  |  |  129|  24.1k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 2.89k, False: 21.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|  2.89k|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|  2.89k|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|  2.89k|{ \
  |  |  |  |  |  |  |  |  |  |  104|  2.89k|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|  2.89k|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|  2.89k|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|  2.89k|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|  2.89k|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2.68k, False: 210]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|  2.68k|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2.59k, False: 95]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|  2.59k|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|  2.59k|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|  2.59k|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|  2.59k|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     95|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     95|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     95|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     95|            } \
  |  |  |  |  |  |  |  |  |  |  118|  2.68k|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|    210|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|    210|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|    210|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|    210|        } \
  |  |  |  |  |  |  |  |  |  |  123|  2.89k|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|  2.89k|        } \
  |  |  |  |  |  |  |  |  132|  24.1k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  24.1k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  24.1k|        ct--; \
  |  |  |  |  |  |  |  |  135|  24.1k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.83k, False: 22.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  22.3k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  33.6k|        } else { \
  |  |  |  |  |  |  154|  33.6k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  33.6k|        } \
  |  |  |  |  |  |  156|  56.0k|    } \
  |  |  |  |  |  |  157|  79.1k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  79.1k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  79.1k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 39.2k, False: 39.8k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  79.1k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  79.1k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  79.1k|{ \
  |  |  |  |  |  |  326|  79.1k|    /* east */ \
  |  |  |  |  |  |  327|  79.1k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  79.1k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  79.1k| \
  |  |  |  |  |  |  329|  79.1k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  79.1k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  79.1k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  79.1k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  79.1k| \
  |  |  |  |  |  |  332|  79.1k|    /* west */ \
  |  |  |  |  |  |  333|  79.1k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  79.1k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  79.1k| \
  |  |  |  |  |  |  335|  79.1k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  79.1k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  79.1k| \
  |  |  |  |  |  |  343|  79.1k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  79.1k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  79.1k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|  79.1k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  79.1k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  79.1k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|  79.1k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  79.1k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|  79.1k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  79.1k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|  79.1k|    } \
  |  |  |  |  |  |  350|  79.1k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  79.1k|            } \
  |  |  |  | 1142|  79.1k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|   211k|    } \
  |  |  |  | 1144|  1.70M|}
  |  |  ------------------
  |  | 1325|  1.70M|                                    flags, flagsp, flags_stride, data, \
  |  | 1326|  1.70M|                                    l_w, 3, mqc, curctx, \
  |  | 1327|  1.70M|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1328|  1.70M|            } \
  |  | 1329|  2.05M|            *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  1.72M|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  1.72M|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  1.72M|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  1.72M|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1330|  1.72M|        } \
  |  | 1331|  32.0k|    } \
  |  | 1332|  2.00k|    UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|  2.00k|        mqc->curctx = curctx; \
  |  |  |  |  167|  2.00k|        mqc->c = c; \
  |  |  |  |  168|  2.00k|        mqc->a = a; \
  |  |  |  |  169|  2.00k|        mqc->ct = ct;
  |  |  ------------------
  |  | 1333|  2.00k|    if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1333:9): [True: 0, False: 2.00k]
  |  |  ------------------
  |  | 1334|      0|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) { \
  |  |  ------------------
  |  |  |  Branch (1334:21): [True: 0, False: 0]
  |  |  ------------------
  |  | 1335|      0|            for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1335:25): [True: 0, False: 0]
  |  |  ------------------
  |  | 1336|      0|                opj_t1_dec_clnpass_step(t1, flagsp, data + j * l_w, oneplushalf, j, vsc); \
  |  | 1337|      0|            } \
  |  | 1338|      0|            *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|      0|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|      0|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|      0|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1339|      0|        } \
  |  | 1340|      0|    } \
  |  | 1341|  2.00k|}
  ------------------
 1376|  2.00k|}
t1.c:opj_t1_dec_clnpass_step:
 1153|  34.6k|{
 1154|  34.6k|    OPJ_UINT32 v;
 1155|       |
 1156|  34.6k|    opj_mqc_t *mqc = &(t1->mqc);   /* MQC component */
 1157|  34.6k|    opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE,
  ------------------
  |  | 1121|  34.6k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  | 1122|  34.6k|{ \
  |  | 1123|  34.6k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  ------------------
  |  |  |  |  153|  34.6k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  34.6k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  ------------------
  |  |  |  |  163|  34.6k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  34.6k|#define T1_PI_0     (1U << 21)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  Branch (1123:26): [True: 27.4k, False: 7.16k]
  |  |  ------------------
  |  | 1124|  27.4k|        do { \
  |  | 1125|  27.4k|            if( !partial ) { \
  |  |  ------------------
  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  ------------------
  |  | 1126|  27.4k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  | 1127|  27.4k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  ------------------
  |  |  |  |   65|  27.4k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1128|  27.4k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  27.4k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  27.4k|{ \
  |  |  |  |  140|  27.4k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  27.4k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  27.4k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  27.4k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  27.4k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  27.4k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 1.10k, False: 26.3k]
  |  |  |  |  ------------------
  |  |  |  |  146|  1.10k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  1.10k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|  1.10k|{ \
  |  |  |  |  |  |   57|  1.10k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 230, False: 872]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|    230|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|    230|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|    230|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|    872|    } else { \
  |  |  |  |  |  |   62|    872|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|    872|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|    872|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|    872|    } \
  |  |  |  |  |  |   66|  1.10k|}
  |  |  |  |  ------------------
  |  |  |  |  147|  1.10k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  1.10k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  1.10k|{ \
  |  |  |  |  |  |  128|  1.79k|    do { \
  |  |  |  |  |  |  129|  1.79k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 230, False: 1.56k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    230|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|    230|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|    230|{ \
  |  |  |  |  |  |  |  |  104|    230|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|    230|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|    230|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|    230|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|    230|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 177, False: 53]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    177|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 172, False: 5]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    172|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    172|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    172|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    172|            } else { \
  |  |  |  |  |  |  |  |  114|      5|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      5|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      5|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      5|            } \
  |  |  |  |  |  |  |  |  118|    177|        } else { \
  |  |  |  |  |  |  |  |  119|     53|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     53|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     53|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     53|        } \
  |  |  |  |  |  |  |  |  123|    230|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|    230|        } \
  |  |  |  |  |  |  132|  1.79k|        a <<= 1; \
  |  |  |  |  |  |  133|  1.79k|        c <<= 1; \
  |  |  |  |  |  |  134|  1.79k|        ct--; \
  |  |  |  |  |  |  135|  1.79k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 690, False: 1.10k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  1.10k|}
  |  |  |  |  ------------------
  |  |  |  |  148|  26.3k|    } else {  \
  |  |  |  |  149|  26.3k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  26.3k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 935, False: 25.4k]
  |  |  |  |  ------------------
  |  |  |  |  151|    935|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    935|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|    935|{ \
  |  |  |  |  |  |   45|    935|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 119, False: 816]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|    119|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|    119|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|    816|    } else { \
  |  |  |  |  |  |   49|    816|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|    816|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|    816|    } \
  |  |  |  |  |  |   52|    935|}
  |  |  |  |  ------------------
  |  |  |  |  152|    935|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    935|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    935|{ \
  |  |  |  |  |  |  128|    994|    do { \
  |  |  |  |  |  |  129|    994|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 133, False: 861]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    133|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|    133|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|    133|{ \
  |  |  |  |  |  |  |  |  104|    133|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|    133|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|    133|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|    133|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|    133|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 124, False: 9]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    124|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 117, False: 7]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    117|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    117|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    117|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    117|            } else { \
  |  |  |  |  |  |  |  |  114|      7|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      7|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      7|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      7|            } \
  |  |  |  |  |  |  |  |  118|    124|        } else { \
  |  |  |  |  |  |  |  |  119|      9|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      9|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      9|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      9|        } \
  |  |  |  |  |  |  |  |  123|    133|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|    133|        } \
  |  |  |  |  |  |  132|    994|        a <<= 1; \
  |  |  |  |  |  |  133|    994|        c <<= 1; \
  |  |  |  |  |  |  134|    994|        ct--; \
  |  |  |  |  |  |  135|    994|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 59, False: 935]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    935|}
  |  |  |  |  ------------------
  |  |  |  |  153|  25.4k|        } else { \
  |  |  |  |  154|  25.4k|            d = (*curctx)->mps; \
  |  |  |  |  155|  25.4k|        } \
  |  |  |  |  156|  26.3k|    } \
  |  |  |  |  157|  27.4k|}
  |  |  ------------------
  |  | 1129|  27.4k|                if( !v ) \
  |  |  ------------------
  |  |  |  Branch (1129:21): [True: 26.0k, False: 1.45k]
  |  |  ------------------
  |  | 1130|  27.4k|                    break; \
  |  | 1131|  27.4k|            } \
  |  | 1132|  27.4k|            { \
  |  | 1133|  1.45k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  | 1134|  1.45k|                                    flags, flagsp[-1], flagsp[1], \
  |  | 1135|  1.45k|                                    ci); \
  |  | 1136|  1.45k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  ------------------
  |  |  |  |   65|  1.45k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1137|  1.45k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  1.45k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  1.45k|{ \
  |  |  |  |  140|  1.45k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  1.45k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  1.45k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  1.45k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  1.45k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  1.45k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 552, False: 903]
  |  |  |  |  ------------------
  |  |  |  |  146|    552|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    552|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|    552|{ \
  |  |  |  |  |  |   57|    552|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 135, False: 417]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|    135|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|    135|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|    135|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|    417|    } else { \
  |  |  |  |  |  |   62|    417|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|    417|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|    417|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|    417|    } \
  |  |  |  |  |  |   66|    552|}
  |  |  |  |  ------------------
  |  |  |  |  147|    552|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    552|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    552|{ \
  |  |  |  |  |  |  128|    752|    do { \
  |  |  |  |  |  |  129|    752|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 94, False: 658]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     94|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     94|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     94|{ \
  |  |  |  |  |  |  |  |  104|     94|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     94|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     94|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     94|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     94|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 78, False: 16]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     78|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 75, False: 3]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     75|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     75|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     75|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     75|            } else { \
  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  118|     78|        } else { \
  |  |  |  |  |  |  |  |  119|     16|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     16|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     16|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     16|        } \
  |  |  |  |  |  |  |  |  123|     94|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     94|        } \
  |  |  |  |  |  |  132|    752|        a <<= 1; \
  |  |  |  |  |  |  133|    752|        c <<= 1; \
  |  |  |  |  |  |  134|    752|        ct--; \
  |  |  |  |  |  |  135|    752|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 200, False: 552]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    552|}
  |  |  |  |  ------------------
  |  |  |  |  148|    903|    } else {  \
  |  |  |  |  149|    903|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|    903|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 411, False: 492]
  |  |  |  |  ------------------
  |  |  |  |  151|    411|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    411|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|    411|{ \
  |  |  |  |  |  |   45|    411|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 70, False: 341]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|     70|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|     70|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|    341|    } else { \
  |  |  |  |  |  |   49|    341|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|    341|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|    341|    } \
  |  |  |  |  |  |   52|    411|}
  |  |  |  |  ------------------
  |  |  |  |  152|    411|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    411|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    411|{ \
  |  |  |  |  |  |  128|    444|    do { \
  |  |  |  |  |  |  129|    444|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 46, False: 398]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     46|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     46|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     46|{ \
  |  |  |  |  |  |  |  |  104|     46|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     46|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     46|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     46|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     46|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 45, False: 1]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     45|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 45, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     45|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     45|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     45|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     45|            } else { \
  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  118|     45|        } else { \
  |  |  |  |  |  |  |  |  119|      1|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      1|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      1|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      1|        } \
  |  |  |  |  |  |  |  |  123|     46|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     46|        } \
  |  |  |  |  |  |  132|    444|        a <<= 1; \
  |  |  |  |  |  |  133|    444|        c <<= 1; \
  |  |  |  |  |  |  134|    444|        ct--; \
  |  |  |  |  |  |  135|    444|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 33, False: 411]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    411|}
  |  |  |  |  ------------------
  |  |  |  |  153|    492|        } else { \
  |  |  |  |  154|    492|            d = (*curctx)->mps; \
  |  |  |  |  155|    492|        } \
  |  |  |  |  156|    903|    } \
  |  |  |  |  157|  1.45k|}
  |  |  ------------------
  |  | 1138|  1.45k|                v = v ^ opj_t1_getspb(lu); \
  |  | 1139|  1.45k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  ------------------
  |  |  |  Branch (1139:40): [True: 714, False: 741]
  |  |  ------------------
  |  | 1140|  1.45k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  ------------------
  |  |  |  |  324|  1.45k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  325|  1.45k|{ \
  |  |  |  |  326|  1.45k|    /* east */ \
  |  |  |  |  327|  1.45k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  1.45k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  ------------------
  |  |  |  |  328|  1.45k| \
  |  |  |  |  329|  1.45k|    /* mark target as significant */ \
  |  |  |  |  330|  1.45k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|  1.45k|#define T1_CHI_1_I  19
  |  |  |  |  ------------------
  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  1.45k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  ------------------
  |  |  |  |  331|  1.45k| \
  |  |  |  |  332|  1.45k|    /* west */ \
  |  |  |  |  333|  1.45k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  1.45k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  ------------------
  |  |  |  |  334|  1.45k| \
  |  |  |  |  335|  1.45k|    /* north-west, north, north-east */ \
  |  |  |  |  336|  1.45k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (336:9): [True: 712, False: 743]
  |  |  |  |  |  Branch (336:21): [True: 403, False: 309]
  |  |  |  |  ------------------
  |  |  |  |  337|    403|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  338|    403|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  127|    403|#define T1_CHI_5_I  31
  |  |  |  |  ------------------
  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|    403|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  ------------------
  |  |  |  |  339|    403|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|    403|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  ------------------
  |  |  |  |  340|    403|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|    403|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  ------------------
  |  |  |  |  341|    403|    } \
  |  |  |  |  342|  1.45k| \
  |  |  |  |  343|  1.45k|    /* south-west, south, south-east */ \
  |  |  |  |  344|  1.45k|    if (ci == 3U) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:9): [True: 0, False: 1.45k]
  |  |  |  |  ------------------
  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  ------------------
  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  ------------------
  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  ------------------
  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  ------------------
  |  |  |  |  349|      0|    } \
  |  |  |  |  350|  1.45k|}
  |  |  ------------------
  |  | 1141|  1.45k|            } \
  |  | 1142|  1.45k|        } while(0); \
  |  |  ------------------
  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  ------------------
  |  | 1143|  27.4k|    } \
  |  | 1144|  34.6k|}
  ------------------
 1158|  34.6k|                                  *flagsp, flagsp, t1->w + 2U, datap,
 1159|  34.6k|                                  0, ci, mqc, mqc->curctx,
 1160|  34.6k|                                  v, mqc->a, mqc->c, mqc->ct, oneplushalf, vsc);
 1161|  34.6k|}
t1.c:opj_t1_dec_clnpass_generic_vsc:
 1389|    179|{
 1390|    179|    opj_t1_dec_clnpass_internal(t1, bpno, OPJ_TRUE, t1->w, t1->h,
  ------------------
  |  | 1254|    179|#define opj_t1_dec_clnpass_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  | 1255|    179|{ \
  |  | 1256|    179|    OPJ_INT32 one, half, oneplushalf; \
  |  | 1257|    179|    OPJ_UINT32 runlen; \
  |  | 1258|    179|    OPJ_UINT32 i, j, k; \
  |  | 1259|    179|    const OPJ_UINT32 l_w = w; \
  |  | 1260|    179|    opj_mqc_t* mqc = &(t1->mqc); \
  |  | 1261|    179|    register OPJ_INT32 *data = t1->data; \
  |  | 1262|    179|    register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  | 1263|    179|    DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|    179|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|    179|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|    179|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|    179|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  | 1264|    179|    register OPJ_UINT32 v; \
  |  | 1265|    179|    one = 1 << bpno; \
  |  | 1266|    179|    half = one >> 1; \
  |  | 1267|    179|    oneplushalf = one | half; \
  |  | 1268|    600|    for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (1268:17): [True: 421, False: 179]
  |  |  ------------------
  |  | 1269|  26.3k|        for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1269:21): [True: 25.9k, False: 421]
  |  |  ------------------
  |  | 1270|  25.9k|            opj_flag_t flags = *flagsp; \
  |  | 1271|  25.9k|            if (flags == 0) { \
  |  |  ------------------
  |  |  |  Branch (1271:17): [True: 10.7k, False: 15.2k]
  |  |  ------------------
  |  | 1272|  10.7k|                OPJ_UINT32 partial = OPJ_TRUE; \
  |  |  ------------------
  |  |  |  |  117|  10.7k|#define OPJ_TRUE 1
  |  |  ------------------
  |  | 1273|  10.7k|                opj_t1_setcurctx(curctx, T1_CTXNO_AGG); \
  |  |  ------------------
  |  |  |  |   65|  10.7k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1274|  10.7k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  10.7k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  10.7k|{ \
  |  |  |  |  140|  10.7k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  10.7k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  10.7k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  10.7k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  10.7k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  10.7k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 261, False: 10.4k]
  |  |  |  |  ------------------
  |  |  |  |  146|    261|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    261|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|    261|{ \
  |  |  |  |  |  |   57|    261|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 52, False: 209]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|     52|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|     52|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|     52|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|    209|    } else { \
  |  |  |  |  |  |   62|    209|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|    209|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|    209|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|    209|    } \
  |  |  |  |  |  |   66|    261|}
  |  |  |  |  ------------------
  |  |  |  |  147|    261|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    261|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    261|{ \
  |  |  |  |  |  |  128|    531|    do { \
  |  |  |  |  |  |  129|    531|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 60, False: 471]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     60|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     60|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     60|{ \
  |  |  |  |  |  |  |  |  104|     60|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     60|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     60|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     60|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     60|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 43, False: 17]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     43|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 37, False: 6]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     37|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     37|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     37|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     37|            } else { \
  |  |  |  |  |  |  |  |  114|      6|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      6|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      6|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      6|            } \
  |  |  |  |  |  |  |  |  118|     43|        } else { \
  |  |  |  |  |  |  |  |  119|     17|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     17|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     17|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     17|        } \
  |  |  |  |  |  |  |  |  123|     60|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     60|        } \
  |  |  |  |  |  |  132|    531|        a <<= 1; \
  |  |  |  |  |  |  133|    531|        c <<= 1; \
  |  |  |  |  |  |  134|    531|        ct--; \
  |  |  |  |  |  |  135|    531|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 270, False: 261]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    261|}
  |  |  |  |  ------------------
  |  |  |  |  148|  10.4k|    } else {  \
  |  |  |  |  149|  10.4k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  10.4k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 356, False: 10.1k]
  |  |  |  |  ------------------
  |  |  |  |  151|    356|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    356|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|    356|{ \
  |  |  |  |  |  |   45|    356|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 72, False: 284]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|     72|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|     72|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|    284|    } else { \
  |  |  |  |  |  |   49|    284|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|    284|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|    284|    } \
  |  |  |  |  |  |   52|    356|}
  |  |  |  |  ------------------
  |  |  |  |  152|    356|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    356|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    356|{ \
  |  |  |  |  |  |  128|    388|    do { \
  |  |  |  |  |  |  129|    388|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 58, False: 330]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     58|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     58|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     58|{ \
  |  |  |  |  |  |  |  |  104|     58|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     58|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     58|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     58|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     58|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 46, False: 12]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     46|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 46, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     46|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     46|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     46|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     46|            } else { \
  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  118|     46|        } else { \
  |  |  |  |  |  |  |  |  119|     12|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     12|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     12|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     12|        } \
  |  |  |  |  |  |  |  |  123|     58|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     58|        } \
  |  |  |  |  |  |  132|    388|        a <<= 1; \
  |  |  |  |  |  |  133|    388|        c <<= 1; \
  |  |  |  |  |  |  134|    388|        ct--; \
  |  |  |  |  |  |  135|    388|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 32, False: 356]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    356|}
  |  |  |  |  ------------------
  |  |  |  |  153|  10.1k|        } else { \
  |  |  |  |  154|  10.1k|            d = (*curctx)->mps; \
  |  |  |  |  155|  10.1k|        } \
  |  |  |  |  156|  10.4k|    } \
  |  |  |  |  157|  10.7k|}
  |  |  ------------------
  |  | 1275|  10.7k|                if (!v) { \
  |  |  ------------------
  |  |  |  Branch (1275:21): [True: 10.4k, False: 269]
  |  |  ------------------
  |  | 1276|  10.4k|                    continue; \
  |  | 1277|  10.4k|                } \
  |  | 1278|  10.7k|                opj_t1_setcurctx(curctx, T1_CTXNO_UNI); \
  |  |  ------------------
  |  |  |  |   65|    269|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1279|    269|                opj_mqc_decode_macro(runlen, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|    269|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|    269|{ \
  |  |  |  |  140|    269|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|    269|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|    269|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|    269|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|    269|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|    269|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 126, False: 143]
  |  |  |  |  ------------------
  |  |  |  |  146|    126|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    126|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|    126|{ \
  |  |  |  |  |  |   57|    126|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 74, False: 52]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|     74|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|     74|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|     74|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|     74|    } else { \
  |  |  |  |  |  |   62|     52|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|     52|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|     52|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|     52|    } \
  |  |  |  |  |  |   66|    126|}
  |  |  |  |  ------------------
  |  |  |  |  147|    126|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    126|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    126|{ \
  |  |  |  |  |  |  128|    126|    do { \
  |  |  |  |  |  |  129|    126|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 28, False: 98]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     28|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     28|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     28|{ \
  |  |  |  |  |  |  |  |  104|     28|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     28|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     28|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     28|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     28|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 25, False: 3]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     25|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 24, False: 1]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     24|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     24|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     24|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     24|            } else { \
  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  118|     25|        } else { \
  |  |  |  |  |  |  |  |  119|      3|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      3|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      3|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      3|        } \
  |  |  |  |  |  |  |  |  123|     28|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     28|        } \
  |  |  |  |  |  |  132|    126|        a <<= 1; \
  |  |  |  |  |  |  133|    126|        c <<= 1; \
  |  |  |  |  |  |  134|    126|        ct--; \
  |  |  |  |  |  |  135|    126|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 126]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    126|}
  |  |  |  |  ------------------
  |  |  |  |  148|    143|    } else {  \
  |  |  |  |  149|    143|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|    143|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 127, False: 16]
  |  |  |  |  ------------------
  |  |  |  |  151|    127|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    127|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|    127|{ \
  |  |  |  |  |  |   45|    127|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 78, False: 49]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|     78|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|     78|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|     78|    } else { \
  |  |  |  |  |  |   49|     49|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|     49|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|     49|    } \
  |  |  |  |  |  |   52|    127|}
  |  |  |  |  ------------------
  |  |  |  |  152|    127|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    127|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    127|{ \
  |  |  |  |  |  |  128|    149|    do { \
  |  |  |  |  |  |  129|    149|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 43, False: 106]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     43|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     43|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     43|{ \
  |  |  |  |  |  |  |  |  104|     43|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     43|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     43|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     43|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     43|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 42, False: 1]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     42|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 42, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     42|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     42|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     42|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     42|            } else { \
  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  118|     42|        } else { \
  |  |  |  |  |  |  |  |  119|      1|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      1|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      1|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      1|        } \
  |  |  |  |  |  |  |  |  123|     43|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     43|        } \
  |  |  |  |  |  |  132|    149|        a <<= 1; \
  |  |  |  |  |  |  133|    149|        c <<= 1; \
  |  |  |  |  |  |  134|    149|        ct--; \
  |  |  |  |  |  |  135|    149|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 22, False: 127]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    127|}
  |  |  |  |  ------------------
  |  |  |  |  153|    127|        } else { \
  |  |  |  |  154|     16|            d = (*curctx)->mps; \
  |  |  |  |  155|     16|        } \
  |  |  |  |  156|    143|    } \
  |  |  |  |  157|    269|}
  |  |  ------------------
  |  | 1280|    269|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|    269|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|    269|{ \
  |  |  |  |  140|    269|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|    269|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|    269|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|    269|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|    269|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|    269|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 138, False: 131]
  |  |  |  |  ------------------
  |  |  |  |  146|    138|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    138|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|    138|{ \
  |  |  |  |  |  |   57|    138|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 41, False: 97]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|     41|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|     41|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|     41|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|     97|    } else { \
  |  |  |  |  |  |   62|     97|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|     97|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|     97|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|     97|    } \
  |  |  |  |  |  |   66|    138|}
  |  |  |  |  ------------------
  |  |  |  |  147|    138|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    138|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    138|{ \
  |  |  |  |  |  |  128|    138|    do { \
  |  |  |  |  |  |  129|    138|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 10, False: 128]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     10|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     10|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     10|{ \
  |  |  |  |  |  |  |  |  104|     10|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     10|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     10|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     10|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     10|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4, False: 6]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|      4|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 3, False: 1]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|      3|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|      3|                ct = 8; \
  |  |  |  |  |  |  |  |  112|      3|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|      3|            } else { \
  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  118|      6|        } else { \
  |  |  |  |  |  |  |  |  119|      6|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      6|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      6|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      6|        } \
  |  |  |  |  |  |  |  |  123|     10|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     10|        } \
  |  |  |  |  |  |  132|    138|        a <<= 1; \
  |  |  |  |  |  |  133|    138|        c <<= 1; \
  |  |  |  |  |  |  134|    138|        ct--; \
  |  |  |  |  |  |  135|    138|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 138]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    138|}
  |  |  |  |  ------------------
  |  |  |  |  148|    138|    } else {  \
  |  |  |  |  149|    131|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|    131|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 117, False: 14]
  |  |  |  |  ------------------
  |  |  |  |  151|    117|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    117|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|    117|{ \
  |  |  |  |  |  |   45|    117|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 31, False: 86]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|     31|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|     31|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|     86|    } else { \
  |  |  |  |  |  |   49|     86|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|     86|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|     86|    } \
  |  |  |  |  |  |   52|    117|}
  |  |  |  |  ------------------
  |  |  |  |  152|    117|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    117|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    117|{ \
  |  |  |  |  |  |  128|    129|    do { \
  |  |  |  |  |  |  129|    129|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 18, False: 111]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     18|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     18|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     18|{ \
  |  |  |  |  |  |  |  |  104|     18|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     18|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     18|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     18|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     18|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 18, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     18|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 16, False: 2]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     16|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     16|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     16|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     16|            } else { \
  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  118|     18|        } else { \
  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  123|     18|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     18|        } \
  |  |  |  |  |  |  132|    129|        a <<= 1; \
  |  |  |  |  |  |  133|    129|        c <<= 1; \
  |  |  |  |  |  |  134|    129|        ct--; \
  |  |  |  |  |  |  135|    129|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 12, False: 117]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    117|}
  |  |  |  |  ------------------
  |  |  |  |  153|    117|        } else { \
  |  |  |  |  154|     14|            d = (*curctx)->mps; \
  |  |  |  |  155|     14|        } \
  |  |  |  |  156|    131|    } \
  |  |  |  |  157|    269|}
  |  |  ------------------
  |  | 1281|    269|                runlen = (runlen << 1) | v; \
  |  | 1282|    269|                switch(runlen) { \
  |  |  ------------------
  |  |  |  Branch (1282:24): [True: 0, False: 269]
  |  |  ------------------
  |  | 1283|     82|                    case 0: \
  |  |  ------------------
  |  |  |  Branch (1283:21): [True: 82, False: 187]
  |  |  ------------------
  |  | 1284|     82|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, OPJ_TRUE,\
  |  |  ------------------
  |  |  |  | 1121|     82|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|     82|{ \
  |  |  |  | 1123|     82|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|     82|        do { \
  |  |  |  | 1125|     82|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|      0|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|      0|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      0|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|      0|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      0|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|      0|{ \
  |  |  |  |  |  |  140|      0|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|      0|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|      0|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|      0|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|      0|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|      0|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|      0|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|      0|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|      0|{ \
  |  |  |  |  |  |  |  |   57|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|      0|    } else { \
  |  |  |  |  |  |  |  |   62|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|      0|    } \
  |  |  |  |  |  |  |  |   66|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|      0|    } else {  \
  |  |  |  |  |  |  149|      0|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|      0|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|      0|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|      0|{ \
  |  |  |  |  |  |  |  |   45|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|      0|    } else { \
  |  |  |  |  |  |  |  |   49|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|      0|    } \
  |  |  |  |  |  |  |  |   52|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|        } else { \
  |  |  |  |  |  |  154|      0|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|      0|        } \
  |  |  |  |  |  |  156|      0|    } \
  |  |  |  |  |  |  157|      0|}
  |  |  |  |  ------------------
  |  |  |  | 1129|      0|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1130|      0|                    break; \
  |  |  |  | 1131|      0|            } \
  |  |  |  | 1132|     82|            { \
  |  |  |  | 1133|     82|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|     82|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|     82|                                    ci); \
  |  |  |  | 1136|     82|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|     82|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|     82|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|     82|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|     82|{ \
  |  |  |  |  |  |  140|     82|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|     82|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|     82|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|     82|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|     82|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|     82|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 35, False: 47]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|     35|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|     35|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|     35|{ \
  |  |  |  |  |  |  |  |   57|     35|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 0, False: 35]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|     35|    } else { \
  |  |  |  |  |  |  |  |   62|     35|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|     35|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|     35|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|     35|    } \
  |  |  |  |  |  |  |  |   66|     35|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|     35|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     35|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     35|{ \
  |  |  |  |  |  |  |  |  128|     54|    do { \
  |  |  |  |  |  |  |  |  129|     54|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 54]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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|     54|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     54|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     54|        ct--; \
  |  |  |  |  |  |  |  |  135|     54|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 19, False: 35]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     35|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|     47|    } else {  \
  |  |  |  |  |  |  149|     47|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|     47|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 38, False: 9]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|     38|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|     38|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|     38|{ \
  |  |  |  |  |  |  |  |   45|     38|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 8, False: 30]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      8|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      8|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|     30|    } else { \
  |  |  |  |  |  |  |  |   49|     30|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|     30|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|     30|    } \
  |  |  |  |  |  |  |  |   52|     38|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|     38|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     38|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     38|{ \
  |  |  |  |  |  |  |  |  128|     46|    do { \
  |  |  |  |  |  |  |  |  129|     46|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 9, False: 37]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      9|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      9|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      9|{ \
  |  |  |  |  |  |  |  |  |  |  104|      9|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      9|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      9|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      9|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      9|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 9, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      9|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 8, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      8|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      8|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      8|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      8|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|      9|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      9|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      9|        } \
  |  |  |  |  |  |  |  |  132|     46|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     46|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     46|        ct--; \
  |  |  |  |  |  |  |  |  135|     46|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 8, False: 38]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     38|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|     38|        } else { \
  |  |  |  |  |  |  154|      9|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|      9|        } \
  |  |  |  |  |  |  156|     47|    } \
  |  |  |  |  |  |  157|     82|}
  |  |  |  |  ------------------
  |  |  |  | 1138|     82|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|     82|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 43, False: 39]
  |  |  |  |  ------------------
  |  |  |  | 1140|     82|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|     82|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|     82|{ \
  |  |  |  |  |  |  326|     82|    /* east */ \
  |  |  |  |  |  |  327|     82|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|     82|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|     82| \
  |  |  |  |  |  |  329|     82|    /* mark target as significant */ \
  |  |  |  |  |  |  330|     82|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|     82|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|     82|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|     82| \
  |  |  |  |  |  |  332|     82|    /* west */ \
  |  |  |  |  |  |  333|     82|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|     82|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|     82| \
  |  |  |  |  |  |  335|     82|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|     82|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|     82| \
  |  |  |  |  |  |  343|     82|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|     82|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|     82|}
  |  |  |  |  ------------------
  |  |  |  | 1141|     82|            } \
  |  |  |  | 1142|     82|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|     82|    } \
  |  |  |  | 1144|     82|}
  |  |  ------------------
  |  | 1285|     82|                                            flags, flagsp, flags_stride, data, \
  |  | 1286|     82|                                            l_w, 0, mqc, curctx, \
  |  | 1287|     82|                                            v, a, c, ct, oneplushalf, vsc); \
  |  | 1288|     82|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|     82|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1289|     82|                        /* FALLTHRU */ \
  |  | 1290|    139|                    case 1: \
  |  |  ------------------
  |  |  |  Branch (1290:21): [True: 57, False: 212]
  |  |  ------------------
  |  | 1291|    139|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|    139|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|    139|{ \
  |  |  |  | 1123|    139|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|    139|        do { \
  |  |  |  | 1125|    139|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 82, False: 57]
  |  |  |  |  ------------------
  |  |  |  | 1126|     82|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|     82|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|     82|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|     82|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|     82|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|     82|{ \
  |  |  |  |  |  |  140|     82|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|     82|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|     82|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|     82|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|     82|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|     82|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 30, False: 52]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|     30|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|     30|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|     30|{ \
  |  |  |  |  |  |  |  |   57|     30|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 0, False: 30]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|     30|    } else { \
  |  |  |  |  |  |  |  |   62|     30|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|     30|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|     30|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|     30|    } \
  |  |  |  |  |  |  |  |   66|     30|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|     30|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     30|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     30|{ \
  |  |  |  |  |  |  |  |  128|     51|    do { \
  |  |  |  |  |  |  |  |  129|     51|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4, False: 47]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      4|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      4|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      4|{ \
  |  |  |  |  |  |  |  |  |  |  104|      4|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      4|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      4|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      4|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      4|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      4|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      4|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      4|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      4|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      4|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      4|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      4|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      4|        } \
  |  |  |  |  |  |  |  |  132|     51|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     51|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     51|        ct--; \
  |  |  |  |  |  |  |  |  135|     51|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 21, False: 30]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     30|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|     52|    } else {  \
  |  |  |  |  |  |  149|     52|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|     52|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 18, False: 34]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|     18|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|     18|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|     18|{ \
  |  |  |  |  |  |  |  |   45|     18|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 0, False: 18]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|     18|    } else { \
  |  |  |  |  |  |  |  |   49|     18|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|     18|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|     18|    } \
  |  |  |  |  |  |  |  |   52|     18|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|     18|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     18|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     18|{ \
  |  |  |  |  |  |  |  |  128|     18|    do { \
  |  |  |  |  |  |  |  |  129|     18|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4, False: 14]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      4|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      4|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      4|{ \
  |  |  |  |  |  |  |  |  |  |  104|      4|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      4|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      4|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      4|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      4|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      4|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      4|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      4|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      4|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      4|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      4|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      4|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      4|        } \
  |  |  |  |  |  |  |  |  132|     18|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     18|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     18|        ct--; \
  |  |  |  |  |  |  |  |  135|     18|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 18]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     18|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|     34|        } else { \
  |  |  |  |  |  |  154|     34|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|     34|        } \
  |  |  |  |  |  |  156|     52|    } \
  |  |  |  |  |  |  157|     82|}
  |  |  |  |  ------------------
  |  |  |  | 1129|     82|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 48, False: 34]
  |  |  |  |  ------------------
  |  |  |  | 1130|     82|                    break; \
  |  |  |  | 1131|     82|            } \
  |  |  |  | 1132|    139|            { \
  |  |  |  | 1133|     91|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|     91|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|     91|                                    ci); \
  |  |  |  | 1136|     91|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|     91|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|     91|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|     91|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|     91|{ \
  |  |  |  |  |  |  140|     91|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|     91|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|     91|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|     91|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|     91|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|     91|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 48, False: 43]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|     48|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|     48|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|     48|{ \
  |  |  |  |  |  |  |  |   57|     48|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 2, False: 46]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      2|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      2|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      2|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|     46|    } else { \
  |  |  |  |  |  |  |  |   62|     46|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|     46|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|     46|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|     46|    } \
  |  |  |  |  |  |  |  |   66|     48|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|     48|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     48|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     48|{ \
  |  |  |  |  |  |  |  |  128|     57|    do { \
  |  |  |  |  |  |  |  |  129|     57|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1, False: 56]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      1|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      1|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      1|{ \
  |  |  |  |  |  |  |  |  |  |  104|      1|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      1|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      1|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      1|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      1|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      1|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      1|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      1|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      1|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      1|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      1|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      1|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      1|        } \
  |  |  |  |  |  |  |  |  132|     57|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     57|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     57|        ct--; \
  |  |  |  |  |  |  |  |  135|     57|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 9, False: 48]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     48|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|     48|    } else {  \
  |  |  |  |  |  |  149|     43|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|     43|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 36, False: 7]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|     36|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|     36|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|     36|{ \
  |  |  |  |  |  |  |  |   45|     36|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 8, False: 28]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      8|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      8|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|     28|    } else { \
  |  |  |  |  |  |  |  |   49|     28|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|     28|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|     28|    } \
  |  |  |  |  |  |  |  |   52|     36|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|     36|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     36|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     36|{ \
  |  |  |  |  |  |  |  |  128|     40|    do { \
  |  |  |  |  |  |  |  |  129|     40|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 5, False: 35]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      5|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      5|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      5|{ \
  |  |  |  |  |  |  |  |  |  |  104|      5|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      5|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      5|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      5|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      5|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      5|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      4|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      4|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      4|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      4|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|      5|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      5|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      5|        } \
  |  |  |  |  |  |  |  |  132|     40|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     40|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     40|        ct--; \
  |  |  |  |  |  |  |  |  135|     40|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 4, False: 36]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     36|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|     36|        } else { \
  |  |  |  |  |  |  154|      7|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|      7|        } \
  |  |  |  |  |  |  156|     43|    } \
  |  |  |  |  |  |  157|     91|}
  |  |  |  |  ------------------
  |  |  |  | 1138|     91|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|     91|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 53, False: 38]
  |  |  |  |  ------------------
  |  |  |  | 1140|     91|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|     91|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|     91|{ \
  |  |  |  |  |  |  326|     91|    /* east */ \
  |  |  |  |  |  |  327|     91|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|     91|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|     91| \
  |  |  |  |  |  |  329|     91|    /* mark target as significant */ \
  |  |  |  |  |  |  330|     91|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|     91|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|     91|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|     91| \
  |  |  |  |  |  |  332|     91|    /* west */ \
  |  |  |  |  |  |  333|     91|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|     91|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|     91| \
  |  |  |  |  |  |  335|     91|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|     91|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|     91| \
  |  |  |  |  |  |  343|     91|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|     91|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|     91|}
  |  |  |  |  ------------------
  |  |  |  | 1141|     91|            } \
  |  |  |  | 1142|     91|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|    139|    } \
  |  |  |  | 1144|    139|}
  |  |  ------------------
  |  | 1292|    139|                                            flags, flagsp, flags_stride, data, \
  |  | 1293|    139|                                            l_w, 1, mqc, curctx, \
  |  | 1294|    139|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1295|    139|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|    139|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1296|    139|                        /* FALLTHRU */ \
  |  | 1297|    198|                    case 2: \
  |  |  ------------------
  |  |  |  Branch (1297:21): [True: 59, False: 210]
  |  |  ------------------
  |  | 1298|    198|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|    198|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|    198|{ \
  |  |  |  | 1123|    198|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|    198|        do { \
  |  |  |  | 1125|    198|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 139, False: 59]
  |  |  |  |  ------------------
  |  |  |  | 1126|    139|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|    139|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    139|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|    139|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    139|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    139|{ \
  |  |  |  |  |  |  140|    139|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    139|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    139|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    139|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    139|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    139|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 25, False: 114]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|     25|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|     25|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|     25|{ \
  |  |  |  |  |  |  |  |   57|     25|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 4, False: 21]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      4|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      4|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      4|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|     21|    } else { \
  |  |  |  |  |  |  |  |   62|     21|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|     21|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|     21|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|     21|    } \
  |  |  |  |  |  |  |  |   66|     25|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|     25|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     25|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     25|{ \
  |  |  |  |  |  |  |  |  128|     41|    do { \
  |  |  |  |  |  |  |  |  129|     41|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 4, False: 37]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      4|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      4|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      4|{ \
  |  |  |  |  |  |  |  |  |  |  104|      4|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      4|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      4|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      4|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      4|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 4, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      4|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 4, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      4|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      4|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      4|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      4|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      4|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      4|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      4|        } \
  |  |  |  |  |  |  |  |  132|     41|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     41|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     41|        ct--; \
  |  |  |  |  |  |  |  |  135|     41|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 16, False: 25]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     25|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    114|    } else {  \
  |  |  |  |  |  |  149|    114|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    114|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 37, False: 77]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|     37|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|     37|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|     37|{ \
  |  |  |  |  |  |  |  |   45|     37|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 0, False: 37]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|     37|    } else { \
  |  |  |  |  |  |  |  |   49|     37|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|     37|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|     37|    } \
  |  |  |  |  |  |  |  |   52|     37|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|     37|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     37|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     37|{ \
  |  |  |  |  |  |  |  |  128|     37|    do { \
  |  |  |  |  |  |  |  |  129|     37|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 14, False: 23]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     14|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     14|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     14|{ \
  |  |  |  |  |  |  |  |  |  |  104|     14|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     14|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     14|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     14|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     14|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 14, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     14|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 13, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     13|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     13|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     13|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     13|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|     14|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|     14|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     14|        } \
  |  |  |  |  |  |  |  |  132|     37|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     37|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     37|        ct--; \
  |  |  |  |  |  |  |  |  135|     37|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 37]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     37|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|     77|        } else { \
  |  |  |  |  |  |  154|     77|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|     77|        } \
  |  |  |  |  |  |  156|    114|    } \
  |  |  |  |  |  |  157|    139|}
  |  |  |  |  ------------------
  |  |  |  | 1129|    139|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 113, False: 26]
  |  |  |  |  ------------------
  |  |  |  | 1130|    139|                    break; \
  |  |  |  | 1131|    139|            } \
  |  |  |  | 1132|    198|            { \
  |  |  |  | 1133|     85|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|     85|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|     85|                                    ci); \
  |  |  |  | 1136|     85|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|     85|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|     85|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|     85|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|     85|{ \
  |  |  |  |  |  |  140|     85|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|     85|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|     85|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|     85|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|     85|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|     85|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 36, False: 49]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|     36|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|     36|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|     36|{ \
  |  |  |  |  |  |  |  |   57|     36|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 9, False: 27]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      9|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      9|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      9|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|     27|    } else { \
  |  |  |  |  |  |  |  |   62|     27|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|     27|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|     27|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|     27|    } \
  |  |  |  |  |  |  |  |   66|     36|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|     36|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     36|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     36|{ \
  |  |  |  |  |  |  |  |  128|     36|    do { \
  |  |  |  |  |  |  |  |  129|     36|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 5, False: 31]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      5|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      5|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      5|{ \
  |  |  |  |  |  |  |  |  |  |  104|      5|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      5|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      5|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      5|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      5|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 5, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      5|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      5|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      5|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      5|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      5|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      5|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      5|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      5|        } \
  |  |  |  |  |  |  |  |  132|     36|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     36|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     36|        ct--; \
  |  |  |  |  |  |  |  |  135|     36|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 36]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     36|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|     49|    } else {  \
  |  |  |  |  |  |  149|     49|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|     49|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 43, False: 6]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|     43|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|     43|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|     43|{ \
  |  |  |  |  |  |  |  |   45|     43|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 4, False: 39]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      4|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      4|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|     39|    } else { \
  |  |  |  |  |  |  |  |   49|     39|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|     39|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|     39|    } \
  |  |  |  |  |  |  |  |   52|     43|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|     43|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     43|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     43|{ \
  |  |  |  |  |  |  |  |  128|     43|    do { \
  |  |  |  |  |  |  |  |  129|     43|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 3, False: 40]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      3|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      3|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      3|{ \
  |  |  |  |  |  |  |  |  |  |  104|      3|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      3|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      3|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      3|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      3|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 2, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      2|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 2, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      2|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      2|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      2|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      2|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      2|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      1|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      1|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      1|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      1|        } \
  |  |  |  |  |  |  |  |  |  |  123|      3|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      3|        } \
  |  |  |  |  |  |  |  |  132|     43|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     43|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     43|        ct--; \
  |  |  |  |  |  |  |  |  135|     43|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 43]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     43|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|     43|        } else { \
  |  |  |  |  |  |  154|      6|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|      6|        } \
  |  |  |  |  |  |  156|     49|    } \
  |  |  |  |  |  |  157|     85|}
  |  |  |  |  ------------------
  |  |  |  | 1138|     85|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|     85|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 51, False: 34]
  |  |  |  |  ------------------
  |  |  |  | 1140|     85|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|     85|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|     85|{ \
  |  |  |  |  |  |  326|     85|    /* east */ \
  |  |  |  |  |  |  327|     85|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|     85|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|     85| \
  |  |  |  |  |  |  329|     85|    /* mark target as significant */ \
  |  |  |  |  |  |  330|     85|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|     85|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|     85|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|     85| \
  |  |  |  |  |  |  332|     85|    /* west */ \
  |  |  |  |  |  |  333|     85|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|     85|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|     85| \
  |  |  |  |  |  |  335|     85|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|     85|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|     85| \
  |  |  |  |  |  |  343|     85|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|     85|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|     85|}
  |  |  |  |  ------------------
  |  |  |  | 1141|     85|            } \
  |  |  |  | 1142|     85|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|    198|    } \
  |  |  |  | 1144|    198|}
  |  |  ------------------
  |  | 1299|    198|                                            flags, flagsp, flags_stride, data, \
  |  | 1300|    198|                                            l_w, 2, mqc, curctx, \
  |  | 1301|    198|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1302|    198|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|    198|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1303|    198|                        /* FALLTHRU */ \
  |  | 1304|    269|                    case 3: \
  |  |  ------------------
  |  |  |  Branch (1304:21): [True: 71, False: 198]
  |  |  ------------------
  |  | 1305|    269|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|    269|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|    269|{ \
  |  |  |  | 1123|    269|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|    269|        do { \
  |  |  |  | 1125|    269|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 198, False: 71]
  |  |  |  |  ------------------
  |  |  |  | 1126|    198|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|    198|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    198|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|    198|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    198|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    198|{ \
  |  |  |  |  |  |  140|    198|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    198|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    198|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    198|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    198|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    198|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 28, False: 170]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|     28|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|     28|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|     28|{ \
  |  |  |  |  |  |  |  |   57|     28|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 5, False: 23]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      5|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      5|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      5|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|     23|    } else { \
  |  |  |  |  |  |  |  |   62|     23|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|     23|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|     23|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|     23|    } \
  |  |  |  |  |  |  |  |   66|     28|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|     28|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     28|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     28|{ \
  |  |  |  |  |  |  |  |  128|     42|    do { \
  |  |  |  |  |  |  |  |  129|     42|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1, False: 41]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      1|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      1|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      1|{ \
  |  |  |  |  |  |  |  |  |  |  104|      1|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      1|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      1|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      1|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      1|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  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|      1|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      1|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      1|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      1|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      1|        } \
  |  |  |  |  |  |  |  |  |  |  123|      1|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      1|        } \
  |  |  |  |  |  |  |  |  132|     42|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     42|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     42|        ct--; \
  |  |  |  |  |  |  |  |  135|     42|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 14, False: 28]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     28|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    170|    } else {  \
  |  |  |  |  |  |  149|    170|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    170|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 27, False: 143]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|     27|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|     27|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|     27|{ \
  |  |  |  |  |  |  |  |   45|     27|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1, False: 26]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      1|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      1|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|     26|    } else { \
  |  |  |  |  |  |  |  |   49|     26|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|     26|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|     26|    } \
  |  |  |  |  |  |  |  |   52|     27|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|     27|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     27|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     27|{ \
  |  |  |  |  |  |  |  |  128|     28|    do { \
  |  |  |  |  |  |  |  |  129|     28|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 1, False: 27]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      1|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      1|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      1|{ \
  |  |  |  |  |  |  |  |  |  |  104|      1|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      1|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      1|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      1|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      1|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 1, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      1|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 1, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      1|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      1|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      1|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      1|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      1|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      1|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      1|        } \
  |  |  |  |  |  |  |  |  132|     28|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     28|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     28|        ct--; \
  |  |  |  |  |  |  |  |  135|     28|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1, False: 27]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     27|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    143|        } else { \
  |  |  |  |  |  |  154|    143|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    143|        } \
  |  |  |  |  |  |  156|    170|    } \
  |  |  |  |  |  |  157|    198|}
  |  |  |  |  ------------------
  |  |  |  | 1129|    198|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 177, False: 21]
  |  |  |  |  ------------------
  |  |  |  | 1130|    198|                    break; \
  |  |  |  | 1131|    198|            } \
  |  |  |  | 1132|    269|            { \
  |  |  |  | 1133|     92|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|     92|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|     92|                                    ci); \
  |  |  |  | 1136|     92|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|     92|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|     92|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|     92|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|     92|{ \
  |  |  |  |  |  |  140|     92|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|     92|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|     92|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|     92|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|     92|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|     92|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 43, False: 49]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|     43|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|     43|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|     43|{ \
  |  |  |  |  |  |  |  |   57|     43|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 10, False: 33]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     10|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     10|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     10|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|     33|    } else { \
  |  |  |  |  |  |  |  |   62|     33|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|     33|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|     33|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|     33|    } \
  |  |  |  |  |  |  |  |   66|     43|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|     43|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     43|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     43|{ \
  |  |  |  |  |  |  |  |  128|     51|    do { \
  |  |  |  |  |  |  |  |  129|     51|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 51]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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|     51|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     51|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     51|        ct--; \
  |  |  |  |  |  |  |  |  135|     51|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 8, False: 43]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     43|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|     49|    } else {  \
  |  |  |  |  |  |  149|     49|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|     49|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 33, False: 16]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|     33|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|     33|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|     33|{ \
  |  |  |  |  |  |  |  |   45|     33|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 0, False: 33]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|     33|    } else { \
  |  |  |  |  |  |  |  |   49|     33|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|     33|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|     33|    } \
  |  |  |  |  |  |  |  |   52|     33|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|     33|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     33|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     33|{ \
  |  |  |  |  |  |  |  |  128|     33|    do { \
  |  |  |  |  |  |  |  |  129|     33|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 33]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  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|     33|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     33|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     33|        ct--; \
  |  |  |  |  |  |  |  |  135|     33|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 33]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     33|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|     33|        } else { \
  |  |  |  |  |  |  154|     16|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|     16|        } \
  |  |  |  |  |  |  156|     49|    } \
  |  |  |  |  |  |  157|     92|}
  |  |  |  |  ------------------
  |  |  |  | 1138|     92|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|     92|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 66, False: 26]
  |  |  |  |  ------------------
  |  |  |  | 1140|     92|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|     92|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|     92|{ \
  |  |  |  |  |  |  326|     92|    /* east */ \
  |  |  |  |  |  |  327|     92|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|     92|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|     92| \
  |  |  |  |  |  |  329|     92|    /* mark target as significant */ \
  |  |  |  |  |  |  330|     92|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|     92|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|     92|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|     92| \
  |  |  |  |  |  |  332|     92|    /* west */ \
  |  |  |  |  |  |  333|     92|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|     92|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|     92| \
  |  |  |  |  |  |  335|     92|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|     92|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|     92| \
  |  |  |  |  |  |  343|     92|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|     92|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|     92|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|     92|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|     92|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|     92|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|     92|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|     92|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|     92|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|     92|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|     92|    } \
  |  |  |  |  |  |  350|     92|}
  |  |  |  |  ------------------
  |  |  |  | 1141|     92|            } \
  |  |  |  | 1142|     92|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|    269|    } \
  |  |  |  | 1144|    269|}
  |  |  ------------------
  |  | 1306|    269|                                            flags, flagsp, flags_stride, data, \
  |  | 1307|    269|                                            l_w, 3, mqc, curctx, \
  |  | 1308|    269|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1309|    269|                        break; \
  |  | 1310|    269|                } \
  |  | 1311|  15.2k|            } else { \
  |  | 1312|  15.2k|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  15.2k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  15.2k|{ \
  |  |  |  | 1123|  15.2k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  15.2k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  15.2k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  15.2k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  15.2k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 2.18k, False: 13.0k]
  |  |  |  |  ------------------
  |  |  |  | 1124|  2.18k|        do { \
  |  |  |  | 1125|  2.18k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|  2.18k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  2.18k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  2.18k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  2.18k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.18k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.18k|{ \
  |  |  |  |  |  |  140|  2.18k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.18k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.18k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.18k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.18k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.18k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 483, False: 1.69k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    483|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    483|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    483|{ \
  |  |  |  |  |  |  |  |   57|    483|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 91, False: 392]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     91|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     91|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     91|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    392|    } else { \
  |  |  |  |  |  |  |  |   62|    392|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    392|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    392|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    392|    } \
  |  |  |  |  |  |  |  |   66|    483|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    483|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    483|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    483|{ \
  |  |  |  |  |  |  |  |  128|    854|    do { \
  |  |  |  |  |  |  |  |  129|    854|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 138, False: 716]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    138|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    138|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    138|{ \
  |  |  |  |  |  |  |  |  |  |  104|    138|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    138|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    138|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    138|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    138|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 131, False: 7]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    131|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 126, False: 5]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    126|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    126|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    126|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    126|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      5|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      5|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      5|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      5|            } \
  |  |  |  |  |  |  |  |  |  |  118|    131|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      7|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      7|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      7|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      7|        } \
  |  |  |  |  |  |  |  |  |  |  123|    138|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    138|        } \
  |  |  |  |  |  |  |  |  132|    854|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    854|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    854|        ct--; \
  |  |  |  |  |  |  |  |  135|    854|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 371, False: 483]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    483|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.69k|    } else {  \
  |  |  |  |  |  |  149|  1.69k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.69k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 508, False: 1.19k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    508|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    508|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    508|{ \
  |  |  |  |  |  |  |  |   45|    508|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 66, False: 442]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     66|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     66|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    442|    } else { \
  |  |  |  |  |  |  |  |   49|    442|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    442|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    442|    } \
  |  |  |  |  |  |  |  |   52|    508|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    508|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    508|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    508|{ \
  |  |  |  |  |  |  |  |  128|    525|    do { \
  |  |  |  |  |  |  |  |  129|    525|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 49, False: 476]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     49|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     49|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     49|{ \
  |  |  |  |  |  |  |  |  |  |  104|     49|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     49|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     49|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     49|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     49|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 46, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     46|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 44, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     44|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     44|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     44|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     44|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|     46|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      3|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      3|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      3|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      3|        } \
  |  |  |  |  |  |  |  |  |  |  123|     49|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     49|        } \
  |  |  |  |  |  |  |  |  132|    525|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    525|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    525|        ct--; \
  |  |  |  |  |  |  |  |  135|    525|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 17, False: 508]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    508|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.19k|        } else { \
  |  |  |  |  |  |  154|  1.19k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.19k|        } \
  |  |  |  |  |  |  156|  1.69k|    } \
  |  |  |  |  |  |  157|  2.18k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  2.18k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 1.27k, False: 903]
  |  |  |  |  ------------------
  |  |  |  | 1130|  2.18k|                    break; \
  |  |  |  | 1131|  2.18k|            } \
  |  |  |  | 1132|  2.18k|            { \
  |  |  |  | 1133|    903|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|    903|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|    903|                                    ci); \
  |  |  |  | 1136|    903|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    903|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|    903|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    903|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    903|{ \
  |  |  |  |  |  |  140|    903|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    903|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    903|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    903|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    903|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    903|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 257, False: 646]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    257|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    257|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    257|{ \
  |  |  |  |  |  |  |  |   57|    257|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 62, False: 195]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     62|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     62|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     62|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    195|    } else { \
  |  |  |  |  |  |  |  |   62|    195|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    195|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    195|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    195|    } \
  |  |  |  |  |  |  |  |   66|    257|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    257|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    257|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    257|{ \
  |  |  |  |  |  |  |  |  128|    378|    do { \
  |  |  |  |  |  |  |  |  129|    378|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 57, False: 321]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     57|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     57|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     57|{ \
  |  |  |  |  |  |  |  |  |  |  104|     57|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     57|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     57|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     57|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     57|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 51, False: 6]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     51|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 50, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     50|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     50|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     50|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     50|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|     51|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      6|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      6|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      6|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      6|        } \
  |  |  |  |  |  |  |  |  |  |  123|     57|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     57|        } \
  |  |  |  |  |  |  |  |  132|    378|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    378|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    378|        ct--; \
  |  |  |  |  |  |  |  |  135|    378|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 121, False: 257]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    257|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    646|    } else {  \
  |  |  |  |  |  |  149|    646|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    646|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 295, False: 351]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    295|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    295|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    295|{ \
  |  |  |  |  |  |  |  |   45|    295|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 58, False: 237]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     58|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     58|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    237|    } else { \
  |  |  |  |  |  |  |  |   49|    237|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    237|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    237|    } \
  |  |  |  |  |  |  |  |   52|    295|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    295|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    295|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    295|{ \
  |  |  |  |  |  |  |  |  128|    323|    do { \
  |  |  |  |  |  |  |  |  129|    323|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 41, False: 282]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     41|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     41|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     41|{ \
  |  |  |  |  |  |  |  |  |  |  104|     41|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     41|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     41|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     41|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     41|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 38, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     38|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 38, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     38|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     38|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     38|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     38|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|     38|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      3|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      3|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      3|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      3|        } \
  |  |  |  |  |  |  |  |  |  |  123|     41|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     41|        } \
  |  |  |  |  |  |  |  |  132|    323|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    323|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    323|        ct--; \
  |  |  |  |  |  |  |  |  135|    323|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 28, False: 295]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    295|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    351|        } else { \
  |  |  |  |  |  |  154|    351|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    351|        } \
  |  |  |  |  |  |  156|    646|    } \
  |  |  |  |  |  |  157|    903|}
  |  |  |  |  ------------------
  |  |  |  | 1138|    903|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|    903|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 494, False: 409]
  |  |  |  |  ------------------
  |  |  |  | 1140|    903|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|    903|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|    903|{ \
  |  |  |  |  |  |  326|    903|    /* east */ \
  |  |  |  |  |  |  327|    903|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|    903|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|    903| \
  |  |  |  |  |  |  329|    903|    /* mark target as significant */ \
  |  |  |  |  |  |  330|    903|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|    903|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|    903|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|    903| \
  |  |  |  |  |  |  332|    903|    /* west */ \
  |  |  |  |  |  |  333|    903|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|    903|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|    903| \
  |  |  |  |  |  |  335|    903|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|    903|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|    903| \
  |  |  |  |  |  |  343|    903|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|    903|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|    903|}
  |  |  |  |  ------------------
  |  |  |  | 1141|    903|            } \
  |  |  |  | 1142|    903|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  2.18k|    } \
  |  |  |  | 1144|  15.2k|}
  |  |  ------------------
  |  | 1313|  15.2k|                                    flags, flagsp, flags_stride, data, \
  |  | 1314|  15.2k|                                    l_w, 0, mqc, curctx, \
  |  | 1315|  15.2k|                                    v, a, c, ct, oneplushalf, vsc); \
  |  | 1316|  15.2k|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  15.2k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  15.2k|{ \
  |  |  |  | 1123|  15.2k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  15.2k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  15.2k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  15.2k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  15.2k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 2.14k, False: 13.0k]
  |  |  |  |  ------------------
  |  |  |  | 1124|  2.14k|        do { \
  |  |  |  | 1125|  2.14k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|  2.14k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  2.14k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  2.14k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  2.14k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.14k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.14k|{ \
  |  |  |  |  |  |  140|  2.14k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.14k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.14k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.14k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.14k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.14k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 454, False: 1.69k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    454|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    454|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    454|{ \
  |  |  |  |  |  |  |  |   57|    454|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 92, False: 362]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     92|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     92|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     92|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    362|    } else { \
  |  |  |  |  |  |  |  |   62|    362|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    362|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    362|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    362|    } \
  |  |  |  |  |  |  |  |   66|    454|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    454|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    454|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    454|{ \
  |  |  |  |  |  |  |  |  128|    727|    do { \
  |  |  |  |  |  |  |  |  129|    727|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 113, False: 614]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    113|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    113|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    113|{ \
  |  |  |  |  |  |  |  |  |  |  104|    113|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    113|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    113|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    113|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    113|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 102, False: 11]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    102|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 101, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    101|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    101|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    101|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    101|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|    102|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     11|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     11|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     11|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     11|        } \
  |  |  |  |  |  |  |  |  |  |  123|    113|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    113|        } \
  |  |  |  |  |  |  |  |  132|    727|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    727|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    727|        ct--; \
  |  |  |  |  |  |  |  |  135|    727|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 273, False: 454]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    454|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.69k|    } else {  \
  |  |  |  |  |  |  149|  1.69k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.69k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 497, False: 1.19k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    497|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    497|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    497|{ \
  |  |  |  |  |  |  |  |   45|    497|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 66, False: 431]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     66|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     66|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    431|    } else { \
  |  |  |  |  |  |  |  |   49|    431|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    431|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    431|    } \
  |  |  |  |  |  |  |  |   52|    497|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    497|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    497|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    497|{ \
  |  |  |  |  |  |  |  |  128|    525|    do { \
  |  |  |  |  |  |  |  |  129|    525|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 75, False: 450]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     75|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     75|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     75|{ \
  |  |  |  |  |  |  |  |  |  |  104|     75|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     75|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     75|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     75|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     75|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 67, False: 8]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     67|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 53, False: 14]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     53|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     53|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     53|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     53|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|     14|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|     14|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|     14|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|     14|            } \
  |  |  |  |  |  |  |  |  |  |  118|     67|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      8|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      8|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      8|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      8|        } \
  |  |  |  |  |  |  |  |  |  |  123|     75|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     75|        } \
  |  |  |  |  |  |  |  |  132|    525|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    525|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    525|        ct--; \
  |  |  |  |  |  |  |  |  135|    525|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 28, False: 497]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    497|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.19k|        } else { \
  |  |  |  |  |  |  154|  1.19k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.19k|        } \
  |  |  |  |  |  |  156|  1.69k|    } \
  |  |  |  |  |  |  157|  2.14k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  2.14k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 1.31k, False: 831]
  |  |  |  |  ------------------
  |  |  |  | 1130|  2.14k|                    break; \
  |  |  |  | 1131|  2.14k|            } \
  |  |  |  | 1132|  2.14k|            { \
  |  |  |  | 1133|    831|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|    831|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|    831|                                    ci); \
  |  |  |  | 1136|    831|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    831|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|    831|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    831|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    831|{ \
  |  |  |  |  |  |  140|    831|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    831|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    831|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    831|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    831|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    831|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 188, False: 643]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    188|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    188|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    188|{ \
  |  |  |  |  |  |  |  |   57|    188|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 44, False: 144]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     44|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     44|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     44|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    144|    } else { \
  |  |  |  |  |  |  |  |   62|    144|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    144|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    144|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    144|    } \
  |  |  |  |  |  |  |  |   66|    188|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    188|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    188|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    188|{ \
  |  |  |  |  |  |  |  |  128|    295|    do { \
  |  |  |  |  |  |  |  |  129|    295|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 27, False: 268]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     27|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     27|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     27|{ \
  |  |  |  |  |  |  |  |  |  |  104|     27|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     27|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     27|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     27|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     27|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 27, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     27|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 26, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     26|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     26|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     26|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     26|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|     27|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|     27|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     27|        } \
  |  |  |  |  |  |  |  |  132|    295|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    295|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    295|        ct--; \
  |  |  |  |  |  |  |  |  135|    295|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 107, False: 188]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    188|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    643|    } else {  \
  |  |  |  |  |  |  149|    643|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    643|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 276, False: 367]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    276|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    276|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    276|{ \
  |  |  |  |  |  |  |  |   45|    276|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 46, False: 230]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     46|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     46|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    230|    } else { \
  |  |  |  |  |  |  |  |   49|    230|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    230|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    230|    } \
  |  |  |  |  |  |  |  |   52|    276|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    276|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    276|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    276|{ \
  |  |  |  |  |  |  |  |  128|    293|    do { \
  |  |  |  |  |  |  |  |  129|    293|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 20, False: 273]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     20|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     20|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     20|{ \
  |  |  |  |  |  |  |  |  |  |  104|     20|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     20|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     20|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     20|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     20|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 20, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     20|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 19, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     19|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     19|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     19|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     19|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|     20|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|     20|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     20|        } \
  |  |  |  |  |  |  |  |  132|    293|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    293|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    293|        ct--; \
  |  |  |  |  |  |  |  |  135|    293|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 17, False: 276]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    276|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    367|        } else { \
  |  |  |  |  |  |  154|    367|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    367|        } \
  |  |  |  |  |  |  156|    643|    } \
  |  |  |  |  |  |  157|    831|}
  |  |  |  |  ------------------
  |  |  |  | 1138|    831|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|    831|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 465, False: 366]
  |  |  |  |  ------------------
  |  |  |  | 1140|    831|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|    831|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|    831|{ \
  |  |  |  |  |  |  326|    831|    /* east */ \
  |  |  |  |  |  |  327|    831|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|    831|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|    831| \
  |  |  |  |  |  |  329|    831|    /* mark target as significant */ \
  |  |  |  |  |  |  330|    831|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|    831|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|    831|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|    831| \
  |  |  |  |  |  |  332|    831|    /* west */ \
  |  |  |  |  |  |  333|    831|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|    831|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|    831| \
  |  |  |  |  |  |  335|    831|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|    831|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|    831| \
  |  |  |  |  |  |  343|    831|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|    831|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|    831|}
  |  |  |  |  ------------------
  |  |  |  | 1141|    831|            } \
  |  |  |  | 1142|    831|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  2.14k|    } \
  |  |  |  | 1144|  15.2k|}
  |  |  ------------------
  |  | 1317|  15.2k|                                    flags, flagsp, flags_stride, data, \
  |  | 1318|  15.2k|                                    l_w, 1, mqc, curctx, \
  |  | 1319|  15.2k|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1320|  15.2k|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  15.2k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  15.2k|{ \
  |  |  |  | 1123|  15.2k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  15.2k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  15.2k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  15.2k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  15.2k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 2.14k, False: 13.0k]
  |  |  |  |  ------------------
  |  |  |  | 1124|  2.14k|        do { \
  |  |  |  | 1125|  2.14k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|  2.14k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  2.14k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  2.14k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  2.14k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.14k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.14k|{ \
  |  |  |  |  |  |  140|  2.14k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.14k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.14k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.14k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.14k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.14k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 425, False: 1.71k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    425|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    425|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    425|{ \
  |  |  |  |  |  |  |  |   57|    425|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 103, False: 322]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    103|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    103|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    103|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    322|    } else { \
  |  |  |  |  |  |  |  |   62|    322|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    322|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    322|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    322|    } \
  |  |  |  |  |  |  |  |   66|    425|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    425|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    425|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    425|{ \
  |  |  |  |  |  |  |  |  128|    712|    do { \
  |  |  |  |  |  |  |  |  129|    712|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 68, False: 644]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     68|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     68|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     68|{ \
  |  |  |  |  |  |  |  |  |  |  104|     68|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     68|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     68|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     68|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     68|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 64, False: 4]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     64|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 62, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     62|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     62|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     62|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     62|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|     64|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      4|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      4|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      4|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      4|        } \
  |  |  |  |  |  |  |  |  |  |  123|     68|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     68|        } \
  |  |  |  |  |  |  |  |  132|    712|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    712|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    712|        ct--; \
  |  |  |  |  |  |  |  |  135|    712|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 287, False: 425]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    425|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.71k|    } else {  \
  |  |  |  |  |  |  149|  1.71k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.71k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 487, False: 1.23k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    487|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    487|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    487|{ \
  |  |  |  |  |  |  |  |   45|    487|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 51, False: 436]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     51|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     51|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    436|    } else { \
  |  |  |  |  |  |  |  |   49|    436|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    436|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    436|    } \
  |  |  |  |  |  |  |  |   52|    487|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    487|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    487|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    487|{ \
  |  |  |  |  |  |  |  |  128|    516|    do { \
  |  |  |  |  |  |  |  |  129|    516|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 74, False: 442]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     74|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     74|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     74|{ \
  |  |  |  |  |  |  |  |  |  |  104|     74|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     74|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     74|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     74|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     74|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 72, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     72|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 67, False: 5]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     67|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     67|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     67|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     67|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      5|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      5|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      5|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      5|            } \
  |  |  |  |  |  |  |  |  |  |  118|     72|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      2|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      2|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      2|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      2|        } \
  |  |  |  |  |  |  |  |  |  |  123|     74|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     74|        } \
  |  |  |  |  |  |  |  |  132|    516|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    516|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    516|        ct--; \
  |  |  |  |  |  |  |  |  135|    516|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 29, False: 487]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    487|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.23k|        } else { \
  |  |  |  |  |  |  154|  1.23k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.23k|        } \
  |  |  |  |  |  |  156|  1.71k|    } \
  |  |  |  |  |  |  157|  2.14k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  2.14k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 1.24k, False: 896]
  |  |  |  |  ------------------
  |  |  |  | 1130|  2.14k|                    break; \
  |  |  |  | 1131|  2.14k|            } \
  |  |  |  | 1132|  2.14k|            { \
  |  |  |  | 1133|    896|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|    896|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|    896|                                    ci); \
  |  |  |  | 1136|    896|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    896|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|    896|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    896|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    896|{ \
  |  |  |  |  |  |  140|    896|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    896|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    896|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    896|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    896|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    896|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 250, False: 646]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    250|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    250|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    250|{ \
  |  |  |  |  |  |  |  |   57|    250|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 45, False: 205]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     45|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     45|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     45|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    205|    } else { \
  |  |  |  |  |  |  |  |   62|    205|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    205|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    205|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    205|    } \
  |  |  |  |  |  |  |  |   66|    250|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    250|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    250|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    250|{ \
  |  |  |  |  |  |  |  |  128|    384|    do { \
  |  |  |  |  |  |  |  |  129|    384|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 48, False: 336]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     48|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     48|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     48|{ \
  |  |  |  |  |  |  |  |  |  |  104|     48|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     48|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     48|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     48|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     48|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 42, False: 6]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     42|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 38, False: 4]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     38|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     38|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     38|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     38|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      4|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      4|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      4|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      4|            } \
  |  |  |  |  |  |  |  |  |  |  118|     42|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      6|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      6|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      6|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      6|        } \
  |  |  |  |  |  |  |  |  |  |  123|     48|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     48|        } \
  |  |  |  |  |  |  |  |  132|    384|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    384|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    384|        ct--; \
  |  |  |  |  |  |  |  |  135|    384|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 134, False: 250]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    250|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    646|    } else {  \
  |  |  |  |  |  |  149|    646|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    646|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 259, False: 387]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    259|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    259|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    259|{ \
  |  |  |  |  |  |  |  |   45|    259|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 52, False: 207]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     52|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     52|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    207|    } else { \
  |  |  |  |  |  |  |  |   49|    207|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    207|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    207|    } \
  |  |  |  |  |  |  |  |   52|    259|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    259|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    259|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    259|{ \
  |  |  |  |  |  |  |  |  128|    282|    do { \
  |  |  |  |  |  |  |  |  129|    282|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 18, False: 264]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     18|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     18|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     18|{ \
  |  |  |  |  |  |  |  |  |  |  104|     18|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     18|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     18|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     18|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     18|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 17, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     17|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 17, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     17|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     17|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     17|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     17|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|     17|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      1|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      1|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      1|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      1|        } \
  |  |  |  |  |  |  |  |  |  |  123|     18|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     18|        } \
  |  |  |  |  |  |  |  |  132|    282|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    282|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    282|        ct--; \
  |  |  |  |  |  |  |  |  135|    282|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 23, False: 259]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    259|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    387|        } else { \
  |  |  |  |  |  |  154|    387|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    387|        } \
  |  |  |  |  |  |  156|    646|    } \
  |  |  |  |  |  |  157|    896|}
  |  |  |  |  ------------------
  |  |  |  | 1138|    896|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|    896|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 460, False: 436]
  |  |  |  |  ------------------
  |  |  |  | 1140|    896|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|    896|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|    896|{ \
  |  |  |  |  |  |  326|    896|    /* east */ \
  |  |  |  |  |  |  327|    896|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|    896|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|    896| \
  |  |  |  |  |  |  329|    896|    /* mark target as significant */ \
  |  |  |  |  |  |  330|    896|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|    896|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|    896|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|    896| \
  |  |  |  |  |  |  332|    896|    /* west */ \
  |  |  |  |  |  |  333|    896|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|    896|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|    896| \
  |  |  |  |  |  |  335|    896|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|    896|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|    896| \
  |  |  |  |  |  |  343|    896|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|    896|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|    896|}
  |  |  |  |  ------------------
  |  |  |  | 1141|    896|            } \
  |  |  |  | 1142|    896|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  2.14k|    } \
  |  |  |  | 1144|  15.2k|}
  |  |  ------------------
  |  | 1321|  15.2k|                                    flags, flagsp, flags_stride, data, \
  |  | 1322|  15.2k|                                    l_w, 2, mqc, curctx, \
  |  | 1323|  15.2k|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1324|  15.2k|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  15.2k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  15.2k|{ \
  |  |  |  | 1123|  15.2k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  15.2k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  15.2k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  15.2k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  15.2k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 2.17k, False: 13.0k]
  |  |  |  |  ------------------
  |  |  |  | 1124|  2.17k|        do { \
  |  |  |  | 1125|  2.17k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|  2.17k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  2.17k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  2.17k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  2.17k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  2.17k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  2.17k|{ \
  |  |  |  |  |  |  140|  2.17k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  2.17k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  2.17k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  2.17k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  2.17k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  2.17k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 389, False: 1.78k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    389|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    389|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    389|{ \
  |  |  |  |  |  |  |  |   57|    389|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 72, False: 317]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     72|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     72|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     72|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    317|    } else { \
  |  |  |  |  |  |  |  |   62|    317|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    317|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    317|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    317|    } \
  |  |  |  |  |  |  |  |   66|    389|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    389|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    389|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    389|{ \
  |  |  |  |  |  |  |  |  128|    664|    do { \
  |  |  |  |  |  |  |  |  129|    664|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 62, False: 602]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     62|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     62|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     62|{ \
  |  |  |  |  |  |  |  |  |  |  104|     62|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     62|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     62|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     62|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     62|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 58, False: 4]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     58|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 57, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     57|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     57|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     57|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     57|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|     58|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      4|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      4|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      4|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      4|        } \
  |  |  |  |  |  |  |  |  |  |  123|     62|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     62|        } \
  |  |  |  |  |  |  |  |  132|    664|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    664|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    664|        ct--; \
  |  |  |  |  |  |  |  |  135|    664|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 275, False: 389]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    389|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  1.78k|    } else {  \
  |  |  |  |  |  |  149|  1.78k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  1.78k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 443, False: 1.34k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    443|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    443|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    443|{ \
  |  |  |  |  |  |  |  |   45|    443|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 35, False: 408]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     35|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     35|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    408|    } else { \
  |  |  |  |  |  |  |  |   49|    408|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    408|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    408|    } \
  |  |  |  |  |  |  |  |   52|    443|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    443|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    443|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    443|{ \
  |  |  |  |  |  |  |  |  128|    454|    do { \
  |  |  |  |  |  |  |  |  129|    454|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 53, False: 401]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     53|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     53|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     53|{ \
  |  |  |  |  |  |  |  |  |  |  104|     53|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     53|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     53|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     53|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     53|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 46, False: 7]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     46|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 44, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     44|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     44|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     44|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     44|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|     46|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      7|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      7|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      7|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      7|        } \
  |  |  |  |  |  |  |  |  |  |  123|     53|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     53|        } \
  |  |  |  |  |  |  |  |  132|    454|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    454|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    454|        ct--; \
  |  |  |  |  |  |  |  |  135|    454|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 11, False: 443]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    443|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.34k|        } else { \
  |  |  |  |  |  |  154|  1.34k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  1.34k|        } \
  |  |  |  |  |  |  156|  1.78k|    } \
  |  |  |  |  |  |  157|  2.17k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  2.17k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 1.34k, False: 831]
  |  |  |  |  ------------------
  |  |  |  | 1130|  2.17k|                    break; \
  |  |  |  | 1131|  2.17k|            } \
  |  |  |  | 1132|  2.17k|            { \
  |  |  |  | 1133|    831|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|    831|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|    831|                                    ci); \
  |  |  |  | 1136|    831|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    831|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|    831|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    831|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    831|{ \
  |  |  |  |  |  |  140|    831|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    831|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    831|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    831|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    831|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    831|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 216, False: 615]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    216|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    216|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    216|{ \
  |  |  |  |  |  |  |  |   57|    216|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 54, False: 162]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     54|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     54|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     54|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    162|    } else { \
  |  |  |  |  |  |  |  |   62|    162|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    162|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    162|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    162|    } \
  |  |  |  |  |  |  |  |   66|    216|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    216|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    216|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    216|{ \
  |  |  |  |  |  |  |  |  128|    346|    do { \
  |  |  |  |  |  |  |  |  129|    346|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 59, False: 287]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     59|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     59|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     59|{ \
  |  |  |  |  |  |  |  |  |  |  104|     59|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     59|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     59|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     59|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     59|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 55, False: 4]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     55|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 53, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     53|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     53|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     53|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     53|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|     55|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      4|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      4|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      4|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      4|        } \
  |  |  |  |  |  |  |  |  |  |  123|     59|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     59|        } \
  |  |  |  |  |  |  |  |  132|    346|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    346|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    346|        ct--; \
  |  |  |  |  |  |  |  |  135|    346|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 130, False: 216]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    216|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    615|    } else {  \
  |  |  |  |  |  |  149|    615|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    615|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 201, False: 414]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    201|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    201|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    201|{ \
  |  |  |  |  |  |  |  |   45|    201|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 36, False: 165]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     36|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     36|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    165|    } else { \
  |  |  |  |  |  |  |  |   49|    165|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    165|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    165|    } \
  |  |  |  |  |  |  |  |   52|    201|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    201|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    201|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    201|{ \
  |  |  |  |  |  |  |  |  128|    217|    do { \
  |  |  |  |  |  |  |  |  129|    217|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 32, False: 185]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     32|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     32|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     32|{ \
  |  |  |  |  |  |  |  |  |  |  104|     32|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     32|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     32|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     32|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     32|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 32, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     32|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 31, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     31|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     31|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     31|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     31|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|     32|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|     32|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     32|        } \
  |  |  |  |  |  |  |  |  132|    217|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    217|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    217|        ct--; \
  |  |  |  |  |  |  |  |  135|    217|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 16, False: 201]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    201|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    414|        } else { \
  |  |  |  |  |  |  154|    414|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    414|        } \
  |  |  |  |  |  |  156|    615|    } \
  |  |  |  |  |  |  157|    831|}
  |  |  |  |  ------------------
  |  |  |  | 1138|    831|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|    831|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 416, False: 415]
  |  |  |  |  ------------------
  |  |  |  | 1140|    831|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|    831|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|    831|{ \
  |  |  |  |  |  |  326|    831|    /* east */ \
  |  |  |  |  |  |  327|    831|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|    831|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|    831| \
  |  |  |  |  |  |  329|    831|    /* mark target as significant */ \
  |  |  |  |  |  |  330|    831|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|    831|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|    831|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|    831| \
  |  |  |  |  |  |  332|    831|    /* west */ \
  |  |  |  |  |  |  333|    831|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|    831|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|    831| \
  |  |  |  |  |  |  335|    831|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|    831|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|    831| \
  |  |  |  |  |  |  343|    831|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|    831|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|    831|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|    831|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|    831|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|    831|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|    831|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|    831|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|    831|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|    831|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|    831|    } \
  |  |  |  |  |  |  350|    831|}
  |  |  |  |  ------------------
  |  |  |  | 1141|    831|            } \
  |  |  |  | 1142|    831|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  2.17k|    } \
  |  |  |  | 1144|  15.2k|}
  |  |  ------------------
  |  | 1325|  15.2k|                                    flags, flagsp, flags_stride, data, \
  |  | 1326|  15.2k|                                    l_w, 3, mqc, curctx, \
  |  | 1327|  15.2k|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1328|  15.2k|            } \
  |  | 1329|  25.9k|            *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  15.4k|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  15.4k|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  15.4k|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  15.4k|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1330|  15.4k|        } \
  |  | 1331|    421|    } \
  |  | 1332|    179|    UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|    179|        mqc->curctx = curctx; \
  |  |  |  |  167|    179|        mqc->c = c; \
  |  |  |  |  168|    179|        mqc->a = a; \
  |  |  |  |  169|    179|        mqc->ct = ct;
  |  |  ------------------
  |  | 1333|    179|    if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1333:9): [True: 171, False: 8]
  |  |  ------------------
  |  | 1334|  11.1k|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) { \
  |  |  ------------------
  |  |  |  Branch (1334:21): [True: 10.9k, False: 171]
  |  |  ------------------
  |  | 1335|  21.8k|            for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1335:25): [True: 10.9k, False: 10.9k]
  |  |  ------------------
  |  | 1336|  10.9k|                opj_t1_dec_clnpass_step(t1, flagsp, data + j * l_w, oneplushalf, j, vsc); \
  |  | 1337|  10.9k|            } \
  |  | 1338|  10.9k|            *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  10.9k|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  10.9k|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  10.9k|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  10.9k|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1339|  10.9k|        } \
  |  | 1340|    171|    } \
  |  | 1341|    179|}
  ------------------
 1391|    179|                                t1->w + 2U);
 1392|    179|}
t1.c:opj_t1_dec_clnpass_generic_novsc:
 1381|    135|{
 1382|    135|    opj_t1_dec_clnpass_internal(t1, bpno, OPJ_FALSE, t1->w, t1->h,
  ------------------
  |  | 1254|    135|#define opj_t1_dec_clnpass_internal(t1, bpno, vsc, w, h, flags_stride) \
  |  | 1255|    135|{ \
  |  | 1256|    135|    OPJ_INT32 one, half, oneplushalf; \
  |  | 1257|    135|    OPJ_UINT32 runlen; \
  |  | 1258|    135|    OPJ_UINT32 i, j, k; \
  |  | 1259|    135|    const OPJ_UINT32 l_w = w; \
  |  | 1260|    135|    opj_mqc_t* mqc = &(t1->mqc); \
  |  | 1261|    135|    register OPJ_INT32 *data = t1->data; \
  |  | 1262|    135|    register opj_flag_t *flagsp = &t1->flags[flags_stride + 1]; \
  |  | 1263|    135|    DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  160|    135|        register const opj_mqc_state_t **curctx = mqc->curctx; \
  |  |  |  |  161|    135|        register OPJ_UINT32 c = mqc->c; \
  |  |  |  |  162|    135|        register OPJ_UINT32 a = mqc->a; \
  |  |  |  |  163|    135|        register OPJ_UINT32 ct = mqc->ct
  |  |  ------------------
  |  | 1264|    135|    register OPJ_UINT32 v; \
  |  | 1265|    135|    one = 1 << bpno; \
  |  | 1266|    135|    half = one >> 1; \
  |  | 1267|    135|    oneplushalf = one | half; \
  |  | 1268|    252|    for (k = 0; k < (h & ~3u); k += 4, data += 3*l_w, flagsp += 2) { \
  |  |  ------------------
  |  |  |  Branch (1268:17): [True: 117, False: 135]
  |  |  ------------------
  |  | 1269|  99.3k|        for (i = 0; i < l_w; ++i, ++data, ++flagsp) { \
  |  |  ------------------
  |  |  |  Branch (1269:21): [True: 99.2k, False: 117]
  |  |  ------------------
  |  | 1270|  99.2k|            opj_flag_t flags = *flagsp; \
  |  | 1271|  99.2k|            if (flags == 0) { \
  |  |  ------------------
  |  |  |  Branch (1271:17): [True: 38.6k, False: 60.6k]
  |  |  ------------------
  |  | 1272|  38.6k|                OPJ_UINT32 partial = OPJ_TRUE; \
  |  |  ------------------
  |  |  |  |  117|  38.6k|#define OPJ_TRUE 1
  |  |  ------------------
  |  | 1273|  38.6k|                opj_t1_setcurctx(curctx, T1_CTXNO_AGG); \
  |  |  ------------------
  |  |  |  |   65|  38.6k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1274|  38.6k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|  38.6k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|  38.6k|{ \
  |  |  |  |  140|  38.6k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|  38.6k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|  38.6k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|  38.6k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|  38.6k|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|  38.6k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 799, False: 37.8k]
  |  |  |  |  ------------------
  |  |  |  |  146|    799|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    799|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|    799|{ \
  |  |  |  |  |  |   57|    799|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 94, False: 705]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|     94|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|     94|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|     94|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|    705|    } else { \
  |  |  |  |  |  |   62|    705|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|    705|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|    705|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|    705|    } \
  |  |  |  |  |  |   66|    799|}
  |  |  |  |  ------------------
  |  |  |  |  147|    799|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    799|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    799|{ \
  |  |  |  |  |  |  128|  1.62k|    do { \
  |  |  |  |  |  |  129|  1.62k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 191, False: 1.42k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    191|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|    191|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|    191|{ \
  |  |  |  |  |  |  |  |  104|    191|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|    191|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|    191|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|    191|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|    191|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 152, False: 39]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    152|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 143, False: 9]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    143|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    143|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    143|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    143|            } else { \
  |  |  |  |  |  |  |  |  114|      9|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      9|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      9|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      9|            } \
  |  |  |  |  |  |  |  |  118|    152|        } else { \
  |  |  |  |  |  |  |  |  119|     39|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     39|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     39|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     39|        } \
  |  |  |  |  |  |  |  |  123|    191|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|    191|        } \
  |  |  |  |  |  |  132|  1.62k|        a <<= 1; \
  |  |  |  |  |  |  133|  1.62k|        c <<= 1; \
  |  |  |  |  |  |  134|  1.62k|        ct--; \
  |  |  |  |  |  |  135|  1.62k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 821, False: 799]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    799|}
  |  |  |  |  ------------------
  |  |  |  |  148|  37.8k|    } else {  \
  |  |  |  |  149|  37.8k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|  37.8k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 1.05k, False: 36.7k]
  |  |  |  |  ------------------
  |  |  |  |  151|  1.05k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.05k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|  1.05k|{ \
  |  |  |  |  |  |   45|  1.05k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 71, False: 987]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|     71|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|     71|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|    987|    } else { \
  |  |  |  |  |  |   49|    987|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|    987|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|    987|    } \
  |  |  |  |  |  |   52|  1.05k|}
  |  |  |  |  ------------------
  |  |  |  |  152|  1.05k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|  1.05k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|  1.05k|{ \
  |  |  |  |  |  |  128|  1.08k|    do { \
  |  |  |  |  |  |  129|  1.08k|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 139, False: 949]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    139|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|    139|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|    139|{ \
  |  |  |  |  |  |  |  |  104|    139|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|    139|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|    139|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|    139|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|    139|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 121, False: 18]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    121|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 114, False: 7]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    114|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    114|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    114|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    114|            } else { \
  |  |  |  |  |  |  |  |  114|      7|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      7|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      7|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      7|            } \
  |  |  |  |  |  |  |  |  118|    121|        } else { \
  |  |  |  |  |  |  |  |  119|     18|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     18|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     18|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     18|        } \
  |  |  |  |  |  |  |  |  123|    139|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|    139|        } \
  |  |  |  |  |  |  132|  1.08k|        a <<= 1; \
  |  |  |  |  |  |  133|  1.08k|        c <<= 1; \
  |  |  |  |  |  |  134|  1.08k|        ct--; \
  |  |  |  |  |  |  135|  1.08k|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 30, False: 1.05k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|  1.05k|}
  |  |  |  |  ------------------
  |  |  |  |  153|  36.7k|        } else { \
  |  |  |  |  154|  36.7k|            d = (*curctx)->mps; \
  |  |  |  |  155|  36.7k|        } \
  |  |  |  |  156|  37.8k|    } \
  |  |  |  |  157|  38.6k|}
  |  |  ------------------
  |  | 1275|  38.6k|                if (!v) { \
  |  |  ------------------
  |  |  |  Branch (1275:21): [True: 37.6k, False: 983]
  |  |  ------------------
  |  | 1276|  37.6k|                    continue; \
  |  | 1277|  37.6k|                } \
  |  | 1278|  38.6k|                opj_t1_setcurctx(curctx, T1_CTXNO_UNI); \
  |  |  ------------------
  |  |  |  |   65|    983|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  ------------------
  |  | 1279|    983|                opj_mqc_decode_macro(runlen, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|    983|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|    983|{ \
  |  |  |  |  140|    983|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|    983|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|    983|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|    983|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|    983|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|    983|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 493, False: 490]
  |  |  |  |  ------------------
  |  |  |  |  146|    493|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    493|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|    493|{ \
  |  |  |  |  |  |   57|    493|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 277, False: 216]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|    277|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|    277|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|    277|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|    277|    } else { \
  |  |  |  |  |  |   62|    216|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|    216|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|    216|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|    216|    } \
  |  |  |  |  |  |   66|    493|}
  |  |  |  |  ------------------
  |  |  |  |  147|    493|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    493|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    493|{ \
  |  |  |  |  |  |  128|    493|    do { \
  |  |  |  |  |  |  129|    493|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 60, False: 433]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     60|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     60|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     60|{ \
  |  |  |  |  |  |  |  |  104|     60|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     60|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     60|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     60|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     60|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 53, False: 7]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     53|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 50, False: 3]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     50|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     50|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     50|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     50|            } else { \
  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  118|     53|        } else { \
  |  |  |  |  |  |  |  |  119|      7|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      7|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      7|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      7|        } \
  |  |  |  |  |  |  |  |  123|     60|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     60|        } \
  |  |  |  |  |  |  132|    493|        a <<= 1; \
  |  |  |  |  |  |  133|    493|        c <<= 1; \
  |  |  |  |  |  |  134|    493|        ct--; \
  |  |  |  |  |  |  135|    493|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 493]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    493|}
  |  |  |  |  ------------------
  |  |  |  |  148|    493|    } else {  \
  |  |  |  |  149|    490|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|    490|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 384, False: 106]
  |  |  |  |  ------------------
  |  |  |  |  151|    384|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    384|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|    384|{ \
  |  |  |  |  |  |   45|    384|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 199, False: 185]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|    199|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|    199|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|    199|    } else { \
  |  |  |  |  |  |   49|    185|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|    185|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|    185|    } \
  |  |  |  |  |  |   52|    384|}
  |  |  |  |  ------------------
  |  |  |  |  152|    384|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    384|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    384|{ \
  |  |  |  |  |  |  128|    465|    do { \
  |  |  |  |  |  |  129|    465|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 68, False: 397]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     68|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     68|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     68|{ \
  |  |  |  |  |  |  |  |  104|     68|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     68|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     68|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     68|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     68|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 55, False: 13]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     55|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 52, False: 3]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     52|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     52|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     52|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     52|            } else { \
  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  118|     55|        } else { \
  |  |  |  |  |  |  |  |  119|     13|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     13|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     13|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     13|        } \
  |  |  |  |  |  |  |  |  123|     68|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     68|        } \
  |  |  |  |  |  |  132|    465|        a <<= 1; \
  |  |  |  |  |  |  133|    465|        c <<= 1; \
  |  |  |  |  |  |  134|    465|        ct--; \
  |  |  |  |  |  |  135|    465|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 81, False: 384]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    384|}
  |  |  |  |  ------------------
  |  |  |  |  153|    384|        } else { \
  |  |  |  |  154|    106|            d = (*curctx)->mps; \
  |  |  |  |  155|    106|        } \
  |  |  |  |  156|    490|    } \
  |  |  |  |  157|    983|}
  |  |  ------------------
  |  | 1280|    983|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  138|    983|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|    983|{ \
  |  |  |  |  140|    983|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|    983|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|    983|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|    983|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|    983|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|    983|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 509, False: 474]
  |  |  |  |  ------------------
  |  |  |  |  146|    509|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    509|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|    509|{ \
  |  |  |  |  |  |   57|    509|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 136, False: 373]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|    136|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|    136|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|    136|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|    373|    } else { \
  |  |  |  |  |  |   62|    373|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|    373|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|    373|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|    373|    } \
  |  |  |  |  |  |   66|    509|}
  |  |  |  |  ------------------
  |  |  |  |  147|    509|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    509|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    509|{ \
  |  |  |  |  |  |  128|    509|    do { \
  |  |  |  |  |  |  129|    509|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 71, False: 438]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     71|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     71|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     71|{ \
  |  |  |  |  |  |  |  |  104|     71|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     71|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     71|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     71|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     71|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 61, False: 10]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     61|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 57, False: 4]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     57|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     57|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     57|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     57|            } else { \
  |  |  |  |  |  |  |  |  114|      4|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      4|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      4|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      4|            } \
  |  |  |  |  |  |  |  |  118|     61|        } else { \
  |  |  |  |  |  |  |  |  119|     10|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|     10|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|     10|            ct = 8; \
  |  |  |  |  |  |  |  |  122|     10|        } \
  |  |  |  |  |  |  |  |  123|     71|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     71|        } \
  |  |  |  |  |  |  132|    509|        a <<= 1; \
  |  |  |  |  |  |  133|    509|        c <<= 1; \
  |  |  |  |  |  |  134|    509|        ct--; \
  |  |  |  |  |  |  135|    509|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 509]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    509|}
  |  |  |  |  ------------------
  |  |  |  |  148|    509|    } else {  \
  |  |  |  |  149|    474|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|    474|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 406, False: 68]
  |  |  |  |  ------------------
  |  |  |  |  151|    406|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    406|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|    406|{ \
  |  |  |  |  |  |   45|    406|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 90, False: 316]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|     90|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|     90|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|    316|    } else { \
  |  |  |  |  |  |   49|    316|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|    316|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|    316|    } \
  |  |  |  |  |  |   52|    406|}
  |  |  |  |  ------------------
  |  |  |  |  152|    406|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    406|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    406|{ \
  |  |  |  |  |  |  128|    454|    do { \
  |  |  |  |  |  |  129|    454|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 60, False: 394]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     60|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     60|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     60|{ \
  |  |  |  |  |  |  |  |  104|     60|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     60|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     60|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     60|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     60|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 51, False: 9]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     51|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 49, False: 2]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     49|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     49|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     49|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     49|            } else { \
  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  118|     51|        } else { \
  |  |  |  |  |  |  |  |  119|      9|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      9|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      9|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      9|        } \
  |  |  |  |  |  |  |  |  123|     60|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     60|        } \
  |  |  |  |  |  |  132|    454|        a <<= 1; \
  |  |  |  |  |  |  133|    454|        c <<= 1; \
  |  |  |  |  |  |  134|    454|        ct--; \
  |  |  |  |  |  |  135|    454|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 48, False: 406]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    406|}
  |  |  |  |  ------------------
  |  |  |  |  153|    406|        } else { \
  |  |  |  |  154|     68|            d = (*curctx)->mps; \
  |  |  |  |  155|     68|        } \
  |  |  |  |  156|    474|    } \
  |  |  |  |  157|    983|}
  |  |  ------------------
  |  | 1281|    983|                runlen = (runlen << 1) | v; \
  |  | 1282|    983|                switch(runlen) { \
  |  |  ------------------
  |  |  |  Branch (1282:24): [True: 0, False: 983]
  |  |  ------------------
  |  | 1283|    296|                    case 0: \
  |  |  ------------------
  |  |  |  Branch (1283:21): [True: 296, False: 687]
  |  |  ------------------
  |  | 1284|    296|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, OPJ_TRUE,\
  |  |  ------------------
  |  |  |  | 1121|    296|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|    296|{ \
  |  |  |  | 1123|    296|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|    296|        do { \
  |  |  |  | 1125|    296|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|      0|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|      0|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      0|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|      0|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      0|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|      0|{ \
  |  |  |  |  |  |  140|      0|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|      0|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|      0|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|      0|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|      0|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|      0|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|      0|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|      0|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|      0|{ \
  |  |  |  |  |  |  |  |   57|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|      0|    } else { \
  |  |  |  |  |  |  |  |   62|      0|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|      0|    } \
  |  |  |  |  |  |  |  |   66|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|      0|    } else {  \
  |  |  |  |  |  |  149|      0|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|      0|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|      0|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|      0|{ \
  |  |  |  |  |  |  |  |   45|      0|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      0|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|      0|    } else { \
  |  |  |  |  |  |  |  |   49|      0|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|      0|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|      0|    } \
  |  |  |  |  |  |  |  |   52|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|      0|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|      0|{ \
  |  |  |  |  |  |  |  |  128|      0|    do { \
  |  |  |  |  |  |  |  |  129|      0|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      0|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      0|{ \
  |  |  |  |  |  |  |  |  |  |  104|      0|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      0|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      0|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      0|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      0|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      0|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      0|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      0|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      0|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      0|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|      0|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  |  |  123|      0|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      0|        } \
  |  |  |  |  |  |  |  |  132|      0|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|      0|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|      0|        ct--; \
  |  |  |  |  |  |  |  |  135|      0|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|        } else { \
  |  |  |  |  |  |  154|      0|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|      0|        } \
  |  |  |  |  |  |  156|      0|    } \
  |  |  |  |  |  |  157|      0|}
  |  |  |  |  ------------------
  |  |  |  | 1129|      0|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1130|      0|                    break; \
  |  |  |  | 1131|      0|            } \
  |  |  |  | 1132|    296|            { \
  |  |  |  | 1133|    296|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|    296|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|    296|                                    ci); \
  |  |  |  | 1136|    296|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    296|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|    296|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    296|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    296|{ \
  |  |  |  |  |  |  140|    296|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    296|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    296|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    296|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    296|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    296|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 77, False: 219]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|     77|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|     77|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|     77|{ \
  |  |  |  |  |  |  |  |   57|     77|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 4, False: 73]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|      4|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|      4|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|      4|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|     73|    } else { \
  |  |  |  |  |  |  |  |   62|     73|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|     73|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|     73|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|     73|    } \
  |  |  |  |  |  |  |  |   66|     77|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|     77|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     77|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     77|{ \
  |  |  |  |  |  |  |  |  128|    130|    do { \
  |  |  |  |  |  |  |  |  129|    130|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 16, False: 114]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     16|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     16|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     16|{ \
  |  |  |  |  |  |  |  |  |  |  104|     16|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     16|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     16|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     16|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     16|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 15, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     15|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 15, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     15|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     15|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     15|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     15|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|     15|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      1|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      1|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      1|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      1|        } \
  |  |  |  |  |  |  |  |  |  |  123|     16|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     16|        } \
  |  |  |  |  |  |  |  |  132|    130|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    130|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    130|        ct--; \
  |  |  |  |  |  |  |  |  135|    130|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 53, False: 77]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     77|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    219|    } else {  \
  |  |  |  |  |  |  149|    219|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    219|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 104, False: 115]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    104|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    104|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    104|{ \
  |  |  |  |  |  |  |  |   45|    104|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 1, False: 103]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      1|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      1|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    103|    } else { \
  |  |  |  |  |  |  |  |   49|    103|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    103|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    103|    } \
  |  |  |  |  |  |  |  |   52|    104|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    104|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    104|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    104|{ \
  |  |  |  |  |  |  |  |  128|    105|    do { \
  |  |  |  |  |  |  |  |  129|    105|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 13, False: 92]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     13|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     13|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     13|{ \
  |  |  |  |  |  |  |  |  |  |  104|     13|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     13|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     13|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     13|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     13|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 7, False: 6]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      7|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 5, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      5|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      5|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      5|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      5|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|      7|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      6|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      6|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      6|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      6|        } \
  |  |  |  |  |  |  |  |  |  |  123|     13|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     13|        } \
  |  |  |  |  |  |  |  |  132|    105|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    105|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    105|        ct--; \
  |  |  |  |  |  |  |  |  135|    105|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1, False: 104]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    104|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    115|        } else { \
  |  |  |  |  |  |  154|    115|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    115|        } \
  |  |  |  |  |  |  156|    219|    } \
  |  |  |  |  |  |  157|    296|}
  |  |  |  |  ------------------
  |  |  |  | 1138|    296|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|    296|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 151, False: 145]
  |  |  |  |  ------------------
  |  |  |  | 1140|    296|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|    296|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|    296|{ \
  |  |  |  |  |  |  326|    296|    /* east */ \
  |  |  |  |  |  |  327|    296|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|    296|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|    296| \
  |  |  |  |  |  |  329|    296|    /* mark target as significant */ \
  |  |  |  |  |  |  330|    296|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|    296|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|    296|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|    296| \
  |  |  |  |  |  |  332|    296|    /* west */ \
  |  |  |  |  |  |  333|    296|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|    296|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|    296| \
  |  |  |  |  |  |  335|    296|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|    296|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|    296|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|    296|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|    296|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|    296|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|    296|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|    296|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|    296|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|    296|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|    296|    } \
  |  |  |  |  |  |  342|    296| \
  |  |  |  |  |  |  343|    296|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|    296|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|    296|}
  |  |  |  |  ------------------
  |  |  |  | 1141|    296|            } \
  |  |  |  | 1142|    296|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|    296|    } \
  |  |  |  | 1144|    296|}
  |  |  ------------------
  |  | 1285|    296|                                            flags, flagsp, flags_stride, data, \
  |  | 1286|    296|                                            l_w, 0, mqc, curctx, \
  |  | 1287|    296|                                            v, a, c, ct, oneplushalf, vsc); \
  |  | 1288|    296|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|    296|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1289|    296|                        /* FALLTHRU */ \
  |  | 1290|    568|                    case 1: \
  |  |  ------------------
  |  |  |  Branch (1290:21): [True: 272, False: 711]
  |  |  ------------------
  |  | 1291|    568|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|    568|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|    568|{ \
  |  |  |  | 1123|    568|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|    568|        do { \
  |  |  |  | 1125|    568|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 296, False: 272]
  |  |  |  |  ------------------
  |  |  |  | 1126|    296|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|    296|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    296|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|    296|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    296|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    296|{ \
  |  |  |  |  |  |  140|    296|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    296|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    296|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    296|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    296|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    296|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 75, False: 221]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|     75|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|     75|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|     75|{ \
  |  |  |  |  |  |  |  |   57|     75|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 11, False: 64]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     11|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     11|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     11|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|     64|    } else { \
  |  |  |  |  |  |  |  |   62|     64|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|     64|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|     64|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|     64|    } \
  |  |  |  |  |  |  |  |   66|     75|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|     75|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     75|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     75|{ \
  |  |  |  |  |  |  |  |  128|    127|    do { \
  |  |  |  |  |  |  |  |  129|    127|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 17, False: 110]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     17|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     17|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     17|{ \
  |  |  |  |  |  |  |  |  |  |  104|     17|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     17|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     17|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     17|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     17|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 14, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     14|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 12, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     12|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     12|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     12|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     12|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|     14|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      3|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      3|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      3|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      3|        } \
  |  |  |  |  |  |  |  |  |  |  123|     17|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     17|        } \
  |  |  |  |  |  |  |  |  132|    127|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    127|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    127|        ct--; \
  |  |  |  |  |  |  |  |  135|    127|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 52, False: 75]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     75|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    221|    } else {  \
  |  |  |  |  |  |  149|    221|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    221|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 75, False: 146]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|     75|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|     75|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|     75|{ \
  |  |  |  |  |  |  |  |   45|     75|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 11, False: 64]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     11|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     11|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|     64|    } else { \
  |  |  |  |  |  |  |  |   49|     64|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|     64|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|     64|    } \
  |  |  |  |  |  |  |  |   52|     75|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|     75|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|     75|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|     75|{ \
  |  |  |  |  |  |  |  |  128|     82|    do { \
  |  |  |  |  |  |  |  |  129|     82|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 12, False: 70]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     12|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     12|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     12|{ \
  |  |  |  |  |  |  |  |  |  |  104|     12|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     12|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     12|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     12|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     12|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 10, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     10|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 9, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      9|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      9|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      9|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      9|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|     10|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      2|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      2|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      2|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      2|        } \
  |  |  |  |  |  |  |  |  |  |  123|     12|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     12|        } \
  |  |  |  |  |  |  |  |  132|     82|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|     82|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|     82|        ct--; \
  |  |  |  |  |  |  |  |  135|     82|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 7, False: 75]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|     75|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    146|        } else { \
  |  |  |  |  |  |  154|    146|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    146|        } \
  |  |  |  |  |  |  156|    221|    } \
  |  |  |  |  |  |  157|    296|}
  |  |  |  |  ------------------
  |  |  |  | 1129|    296|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 144, False: 152]
  |  |  |  |  ------------------
  |  |  |  | 1130|    296|                    break; \
  |  |  |  | 1131|    296|            } \
  |  |  |  | 1132|    568|            { \
  |  |  |  | 1133|    424|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|    424|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|    424|                                    ci); \
  |  |  |  | 1136|    424|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    424|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|    424|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    424|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    424|{ \
  |  |  |  |  |  |  140|    424|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    424|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    424|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    424|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    424|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    424|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 135, False: 289]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    135|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    135|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    135|{ \
  |  |  |  |  |  |  |  |   57|    135|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 12, False: 123]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     12|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     12|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     12|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    123|    } else { \
  |  |  |  |  |  |  |  |   62|    123|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    123|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    123|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    123|    } \
  |  |  |  |  |  |  |  |   66|    135|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    135|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    135|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    135|{ \
  |  |  |  |  |  |  |  |  128|    226|    do { \
  |  |  |  |  |  |  |  |  129|    226|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 33, False: 193]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     33|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     33|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     33|{ \
  |  |  |  |  |  |  |  |  |  |  104|     33|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     33|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     33|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     33|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     33|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 28, False: 5]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     28|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 28, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     28|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     28|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     28|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     28|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|     28|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      5|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      5|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      5|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      5|        } \
  |  |  |  |  |  |  |  |  |  |  123|     33|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     33|        } \
  |  |  |  |  |  |  |  |  132|    226|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    226|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    226|        ct--; \
  |  |  |  |  |  |  |  |  135|    226|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 91, False: 135]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    135|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    289|    } else {  \
  |  |  |  |  |  |  149|    289|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    289|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 148, False: 141]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    148|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    148|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    148|{ \
  |  |  |  |  |  |  |  |   45|    148|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 9, False: 139]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      9|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|      9|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    139|    } else { \
  |  |  |  |  |  |  |  |   49|    139|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    139|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    139|    } \
  |  |  |  |  |  |  |  |   52|    148|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    148|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    148|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    148|{ \
  |  |  |  |  |  |  |  |  128|    150|    do { \
  |  |  |  |  |  |  |  |  129|    150|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 9, False: 141]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|      9|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      9|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|      9|{ \
  |  |  |  |  |  |  |  |  |  |  104|      9|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|      9|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|      9|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|      9|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|      9|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 8, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|      8|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 7, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|      7|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|      7|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|      7|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|      7|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|      8|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      1|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      1|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      1|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      1|        } \
  |  |  |  |  |  |  |  |  |  |  123|      9|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|      9|        } \
  |  |  |  |  |  |  |  |  132|    150|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    150|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    150|        ct--; \
  |  |  |  |  |  |  |  |  135|    150|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 2, False: 148]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    148|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    148|        } else { \
  |  |  |  |  |  |  154|    141|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    141|        } \
  |  |  |  |  |  |  156|    289|    } \
  |  |  |  |  |  |  157|    424|}
  |  |  |  |  ------------------
  |  |  |  | 1138|    424|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|    424|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 224, False: 200]
  |  |  |  |  ------------------
  |  |  |  | 1140|    424|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|    424|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|    424|{ \
  |  |  |  |  |  |  326|    424|    /* east */ \
  |  |  |  |  |  |  327|    424|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|    424|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|    424| \
  |  |  |  |  |  |  329|    424|    /* mark target as significant */ \
  |  |  |  |  |  |  330|    424|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|    424|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|    424|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|    424| \
  |  |  |  |  |  |  332|    424|    /* west */ \
  |  |  |  |  |  |  333|    424|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|    424|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|    424| \
  |  |  |  |  |  |  335|    424|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|    424|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|    424| \
  |  |  |  |  |  |  343|    424|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|    424|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|    424|}
  |  |  |  |  ------------------
  |  |  |  | 1141|    424|            } \
  |  |  |  | 1142|    424|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|    568|    } \
  |  |  |  | 1144|    568|}
  |  |  ------------------
  |  | 1292|    568|                                            flags, flagsp, flags_stride, data, \
  |  | 1293|    568|                                            l_w, 1, mqc, curctx, \
  |  | 1294|    568|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1295|    568|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|    568|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1296|    568|                        /* FALLTHRU */ \
  |  | 1297|    792|                    case 2: \
  |  |  ------------------
  |  |  |  Branch (1297:21): [True: 224, False: 759]
  |  |  ------------------
  |  | 1298|    792|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|    792|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|    792|{ \
  |  |  |  | 1123|    792|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|    792|        do { \
  |  |  |  | 1125|    792|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 568, False: 224]
  |  |  |  |  ------------------
  |  |  |  | 1126|    568|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|    568|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    568|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|    568|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    568|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    568|{ \
  |  |  |  |  |  |  140|    568|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    568|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    568|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    568|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    568|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    568|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 120, False: 448]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    120|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    120|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    120|{ \
  |  |  |  |  |  |  |  |   57|    120|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 30, False: 90]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     30|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     30|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     30|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|     90|    } else { \
  |  |  |  |  |  |  |  |   62|     90|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|     90|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|     90|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|     90|    } \
  |  |  |  |  |  |  |  |   66|    120|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    120|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    120|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    120|{ \
  |  |  |  |  |  |  |  |  128|    193|    do { \
  |  |  |  |  |  |  |  |  129|    193|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 21, False: 172]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     21|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     21|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     21|{ \
  |  |  |  |  |  |  |  |  |  |  104|     21|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     21|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     21|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     21|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     21|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 17, False: 4]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     17|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 16, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     16|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     16|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     16|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     16|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|     17|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      4|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      4|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      4|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      4|        } \
  |  |  |  |  |  |  |  |  |  |  123|     21|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     21|        } \
  |  |  |  |  |  |  |  |  132|    193|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    193|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    193|        ct--; \
  |  |  |  |  |  |  |  |  135|    193|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 73, False: 120]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    120|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    448|    } else {  \
  |  |  |  |  |  |  149|    448|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    448|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 135, False: 313]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    135|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    135|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    135|{ \
  |  |  |  |  |  |  |  |   45|    135|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 26, False: 109]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     26|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     26|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    109|    } else { \
  |  |  |  |  |  |  |  |   49|    109|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    109|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    109|    } \
  |  |  |  |  |  |  |  |   52|    135|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    135|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    135|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    135|{ \
  |  |  |  |  |  |  |  |  128|    147|    do { \
  |  |  |  |  |  |  |  |  129|    147|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 15, False: 132]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     15|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     15|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     15|{ \
  |  |  |  |  |  |  |  |  |  |  104|     15|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     15|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     15|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     15|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     15|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 11, False: 4]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     11|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 11, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     11|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     11|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     11|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     11|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|     11|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      4|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      4|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      4|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      4|        } \
  |  |  |  |  |  |  |  |  |  |  123|     15|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     15|        } \
  |  |  |  |  |  |  |  |  132|    147|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    147|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    147|        ct--; \
  |  |  |  |  |  |  |  |  135|    147|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 12, False: 135]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    135|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    313|        } else { \
  |  |  |  |  |  |  154|    313|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    313|        } \
  |  |  |  |  |  |  156|    448|    } \
  |  |  |  |  |  |  157|    568|}
  |  |  |  |  ------------------
  |  |  |  | 1129|    568|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 293, False: 275]
  |  |  |  |  ------------------
  |  |  |  | 1130|    568|                    break; \
  |  |  |  | 1131|    568|            } \
  |  |  |  | 1132|    792|            { \
  |  |  |  | 1133|    499|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|    499|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|    499|                                    ci); \
  |  |  |  | 1136|    499|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    499|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|    499|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    499|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    499|{ \
  |  |  |  |  |  |  140|    499|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    499|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    499|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    499|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    499|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    499|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 159, False: 340]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    159|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    159|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    159|{ \
  |  |  |  |  |  |  |  |   57|    159|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 31, False: 128]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     31|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     31|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     31|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    128|    } else { \
  |  |  |  |  |  |  |  |   62|    128|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    128|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    128|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    128|    } \
  |  |  |  |  |  |  |  |   66|    159|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    159|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    159|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    159|{ \
  |  |  |  |  |  |  |  |  128|    246|    do { \
  |  |  |  |  |  |  |  |  129|    246|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 33, False: 213]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     33|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     33|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     33|{ \
  |  |  |  |  |  |  |  |  |  |  104|     33|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     33|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     33|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     33|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     33|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 25, False: 8]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     25|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 25, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     25|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     25|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     25|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     25|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|     25|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      8|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      8|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      8|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      8|        } \
  |  |  |  |  |  |  |  |  |  |  123|     33|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     33|        } \
  |  |  |  |  |  |  |  |  132|    246|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    246|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    246|        ct--; \
  |  |  |  |  |  |  |  |  135|    246|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 87, False: 159]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    159|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    340|    } else {  \
  |  |  |  |  |  |  149|    340|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    340|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 163, False: 177]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    163|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    163|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    163|{ \
  |  |  |  |  |  |  |  |   45|    163|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 22, False: 141]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     22|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     22|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    141|    } else { \
  |  |  |  |  |  |  |  |   49|    141|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    141|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    141|    } \
  |  |  |  |  |  |  |  |   52|    163|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    163|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    163|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    163|{ \
  |  |  |  |  |  |  |  |  128|    173|    do { \
  |  |  |  |  |  |  |  |  129|    173|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 18, False: 155]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     18|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     18|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     18|{ \
  |  |  |  |  |  |  |  |  |  |  104|     18|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     18|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     18|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     18|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     18|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 16, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     16|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 16, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     16|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     16|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     16|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     16|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  |  |  118|     16|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      2|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      2|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      2|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      2|        } \
  |  |  |  |  |  |  |  |  |  |  123|     18|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     18|        } \
  |  |  |  |  |  |  |  |  132|    173|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    173|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    173|        ct--; \
  |  |  |  |  |  |  |  |  135|    173|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 10, False: 163]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    163|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    177|        } else { \
  |  |  |  |  |  |  154|    177|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    177|        } \
  |  |  |  |  |  |  156|    340|    } \
  |  |  |  |  |  |  157|    499|}
  |  |  |  |  ------------------
  |  |  |  | 1138|    499|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|    499|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 262, False: 237]
  |  |  |  |  ------------------
  |  |  |  | 1140|    499|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|    499|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|    499|{ \
  |  |  |  |  |  |  326|    499|    /* east */ \
  |  |  |  |  |  |  327|    499|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|    499|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|    499| \
  |  |  |  |  |  |  329|    499|    /* mark target as significant */ \
  |  |  |  |  |  |  330|    499|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|    499|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|    499|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|    499| \
  |  |  |  |  |  |  332|    499|    /* west */ \
  |  |  |  |  |  |  333|    499|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|    499|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|    499| \
  |  |  |  |  |  |  335|    499|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|    499|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|    499| \
  |  |  |  |  |  |  343|    499|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|    499|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|    499|}
  |  |  |  |  ------------------
  |  |  |  | 1141|    499|            } \
  |  |  |  | 1142|    499|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|    792|    } \
  |  |  |  | 1144|    792|}
  |  |  ------------------
  |  | 1299|    792|                                            flags, flagsp, flags_stride, data, \
  |  | 1300|    792|                                            l_w, 2, mqc, curctx, \
  |  | 1301|    792|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1302|    792|                        partial = OPJ_FALSE; \
  |  |  ------------------
  |  |  |  |  118|    792|#define OPJ_FALSE 0
  |  |  ------------------
  |  | 1303|    792|                        /* FALLTHRU */ \
  |  | 1304|    983|                    case 3: \
  |  |  ------------------
  |  |  |  Branch (1304:21): [True: 191, False: 792]
  |  |  ------------------
  |  | 1305|    983|                        opj_t1_dec_clnpass_step_macro(OPJ_FALSE, partial,\
  |  |  ------------------
  |  |  |  | 1121|    983|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|    983|{ \
  |  |  |  | 1123|    983|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|      0|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|      0|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1124|    983|        do { \
  |  |  |  | 1125|    983|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [True: 792, False: 191]
  |  |  |  |  ------------------
  |  |  |  | 1126|    792|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|    792|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    792|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|    792|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    792|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    792|{ \
  |  |  |  |  |  |  140|    792|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    792|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    792|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    792|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    792|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    792|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 155, False: 637]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    155|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    155|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    155|{ \
  |  |  |  |  |  |  |  |   57|    155|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 36, False: 119]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     36|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     36|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     36|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    119|    } else { \
  |  |  |  |  |  |  |  |   62|    119|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    119|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    119|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    119|    } \
  |  |  |  |  |  |  |  |   66|    155|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    155|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    155|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    155|{ \
  |  |  |  |  |  |  |  |  128|    275|    do { \
  |  |  |  |  |  |  |  |  129|    275|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 45, False: 230]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     45|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     45|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     45|{ \
  |  |  |  |  |  |  |  |  |  |  104|     45|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     45|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     45|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     45|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     45|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 35, False: 10]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     35|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 34, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     34|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     34|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     34|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     34|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|     35|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     10|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     10|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     10|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     10|        } \
  |  |  |  |  |  |  |  |  |  |  123|     45|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     45|        } \
  |  |  |  |  |  |  |  |  132|    275|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    275|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    275|        ct--; \
  |  |  |  |  |  |  |  |  135|    275|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 120, False: 155]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    155|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    637|    } else {  \
  |  |  |  |  |  |  149|    637|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    637|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 180, False: 457]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    180|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    180|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    180|{ \
  |  |  |  |  |  |  |  |   45|    180|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 20, False: 160]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     20|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     20|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    160|    } else { \
  |  |  |  |  |  |  |  |   49|    160|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    160|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    160|    } \
  |  |  |  |  |  |  |  |   52|    180|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    180|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    180|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    180|{ \
  |  |  |  |  |  |  |  |  128|    195|    do { \
  |  |  |  |  |  |  |  |  129|    195|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 35, False: 160]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     35|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     35|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     35|{ \
  |  |  |  |  |  |  |  |  |  |  104|     35|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     35|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     35|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     35|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     35|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 29, False: 6]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     29|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 28, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     28|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     28|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     28|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     28|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|     29|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      6|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      6|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      6|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      6|        } \
  |  |  |  |  |  |  |  |  |  |  123|     35|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     35|        } \
  |  |  |  |  |  |  |  |  132|    195|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    195|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    195|        ct--; \
  |  |  |  |  |  |  |  |  135|    195|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 15, False: 180]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    180|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    457|        } else { \
  |  |  |  |  |  |  154|    457|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    457|        } \
  |  |  |  |  |  |  156|    637|    } \
  |  |  |  |  |  |  157|    792|}
  |  |  |  |  ------------------
  |  |  |  | 1129|    792|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 435, False: 357]
  |  |  |  |  ------------------
  |  |  |  | 1130|    792|                    break; \
  |  |  |  | 1131|    792|            } \
  |  |  |  | 1132|    983|            { \
  |  |  |  | 1133|    548|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|    548|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|    548|                                    ci); \
  |  |  |  | 1136|    548|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|    548|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|    548|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|    548|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|    548|{ \
  |  |  |  |  |  |  140|    548|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|    548|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|    548|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|    548|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|    548|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|    548|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 178, False: 370]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    178|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|    178|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|    178|{ \
  |  |  |  |  |  |  |  |   57|    178|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 37, False: 141]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|     37|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|     37|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|     37|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    141|    } else { \
  |  |  |  |  |  |  |  |   62|    141|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    141|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    141|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    141|    } \
  |  |  |  |  |  |  |  |   66|    178|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    178|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    178|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    178|{ \
  |  |  |  |  |  |  |  |  128|    269|    do { \
  |  |  |  |  |  |  |  |  129|    269|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 38, False: 231]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     38|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     38|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     38|{ \
  |  |  |  |  |  |  |  |  |  |  104|     38|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     38|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     38|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     38|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     38|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 33, False: 5]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     33|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 32, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     32|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     32|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     32|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     32|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|     33|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      5|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      5|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      5|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      5|        } \
  |  |  |  |  |  |  |  |  |  |  123|     38|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     38|        } \
  |  |  |  |  |  |  |  |  132|    269|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    269|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    269|        ct--; \
  |  |  |  |  |  |  |  |  135|    269|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 91, False: 178]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    178|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|    370|    } else {  \
  |  |  |  |  |  |  149|    370|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|    370|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 181, False: 189]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|    181|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|    181|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|    181|{ \
  |  |  |  |  |  |  |  |   45|    181|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 24, False: 157]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     24|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|     24|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    157|    } else { \
  |  |  |  |  |  |  |  |   49|    157|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    157|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    157|    } \
  |  |  |  |  |  |  |  |   52|    181|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|    181|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|    181|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|    181|{ \
  |  |  |  |  |  |  |  |  128|    190|    do { \
  |  |  |  |  |  |  |  |  129|    190|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 29, False: 161]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|     29|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|     29|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|     29|{ \
  |  |  |  |  |  |  |  |  |  |  104|     29|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|     29|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|     29|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|     29|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|     29|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 19, False: 10]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|     19|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 18, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|     18|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|     18|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|     18|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|     18|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|     19|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     10|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     10|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     10|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     10|        } \
  |  |  |  |  |  |  |  |  |  |  123|     29|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|     29|        } \
  |  |  |  |  |  |  |  |  132|    190|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|    190|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|    190|        ct--; \
  |  |  |  |  |  |  |  |  135|    190|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 9, False: 181]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|    181|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    189|        } else { \
  |  |  |  |  |  |  154|    189|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|    189|        } \
  |  |  |  |  |  |  156|    370|    } \
  |  |  |  |  |  |  157|    548|}
  |  |  |  |  ------------------
  |  |  |  | 1138|    548|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|    548|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 304, False: 244]
  |  |  |  |  ------------------
  |  |  |  | 1140|    548|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|    548|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|    548|{ \
  |  |  |  |  |  |  326|    548|    /* east */ \
  |  |  |  |  |  |  327|    548|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|    548|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|    548| \
  |  |  |  |  |  |  329|    548|    /* mark target as significant */ \
  |  |  |  |  |  |  330|    548|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|    548|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|    548|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|    548| \
  |  |  |  |  |  |  332|    548|    /* west */ \
  |  |  |  |  |  |  333|    548|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|    548|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|    548| \
  |  |  |  |  |  |  335|    548|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|    548|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|    548| \
  |  |  |  |  |  |  343|    548|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|    548|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|    548|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|    548|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|    548|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|    548|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|    548|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|    548|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|    548|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|    548|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|    548|    } \
  |  |  |  |  |  |  350|    548|}
  |  |  |  |  ------------------
  |  |  |  | 1141|    548|            } \
  |  |  |  | 1142|    548|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|    983|    } \
  |  |  |  | 1144|    983|}
  |  |  ------------------
  |  | 1306|    983|                                            flags, flagsp, flags_stride, data, \
  |  | 1307|    983|                                            l_w, 3, mqc, curctx, \
  |  | 1308|    983|                                            v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1309|    983|                        break; \
  |  | 1310|    983|                } \
  |  | 1311|  60.6k|            } else { \
  |  | 1312|  60.6k|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  60.6k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  60.6k|{ \
  |  |  |  | 1123|  60.6k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  60.6k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  60.6k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  60.6k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  60.6k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 9.81k, False: 50.7k]
  |  |  |  |  ------------------
  |  |  |  | 1124|  9.81k|        do { \
  |  |  |  | 1125|  9.81k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|  9.81k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  9.81k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  9.81k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  9.81k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  9.81k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  9.81k|{ \
  |  |  |  |  |  |  140|  9.81k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  9.81k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  9.81k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  9.81k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  9.81k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  9.81k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.79k, False: 8.01k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.79k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.79k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.79k|{ \
  |  |  |  |  |  |  |  |   57|  1.79k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 366, False: 1.43k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    366|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    366|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    366|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.43k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.43k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.43k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.43k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.43k|    } \
  |  |  |  |  |  |  |  |   66|  1.79k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.79k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.79k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.79k|{ \
  |  |  |  |  |  |  |  |  128|  3.13k|    do { \
  |  |  |  |  |  |  |  |  129|  3.13k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 413, False: 2.71k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    413|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    413|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    413|{ \
  |  |  |  |  |  |  |  |  |  |  104|    413|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    413|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    413|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    413|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    413|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 353, False: 60]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    353|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 346, False: 7]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    346|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    346|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    346|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    346|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      7|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      7|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      7|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      7|            } \
  |  |  |  |  |  |  |  |  |  |  118|    353|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     60|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     60|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     60|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     60|        } \
  |  |  |  |  |  |  |  |  |  |  123|    413|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    413|        } \
  |  |  |  |  |  |  |  |  132|  3.13k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.13k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.13k|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.13k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.33k, False: 1.79k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.79k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  8.01k|    } else {  \
  |  |  |  |  |  |  149|  8.01k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  8.01k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.92k, False: 6.08k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.92k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.92k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.92k|{ \
  |  |  |  |  |  |  |  |   45|  1.92k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 287, False: 1.64k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    287|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    287|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.64k|    } else { \
  |  |  |  |  |  |  |  |   49|  1.64k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.64k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.64k|    } \
  |  |  |  |  |  |  |  |   52|  1.92k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.92k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.92k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.92k|{ \
  |  |  |  |  |  |  |  |  128|  2.06k|    do { \
  |  |  |  |  |  |  |  |  129|  2.06k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 261, False: 1.80k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    261|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    261|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    261|{ \
  |  |  |  |  |  |  |  |  |  |  104|    261|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    261|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    261|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    261|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    261|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 229, False: 32]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    229|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 227, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    227|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    227|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    227|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    227|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|    229|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     32|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     32|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     32|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     32|        } \
  |  |  |  |  |  |  |  |  |  |  123|    261|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    261|        } \
  |  |  |  |  |  |  |  |  132|  2.06k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.06k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.06k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.06k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 141, False: 1.92k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.92k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  6.08k|        } else { \
  |  |  |  |  |  |  154|  6.08k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  6.08k|        } \
  |  |  |  |  |  |  156|  8.01k|    } \
  |  |  |  |  |  |  157|  9.81k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  9.81k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 5.35k, False: 4.45k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  9.81k|                    break; \
  |  |  |  | 1131|  9.81k|            } \
  |  |  |  | 1132|  9.81k|            { \
  |  |  |  | 1133|  4.45k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  4.45k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  4.45k|                                    ci); \
  |  |  |  | 1136|  4.45k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  4.45k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  4.45k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.45k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.45k|{ \
  |  |  |  |  |  |  140|  4.45k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.45k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.45k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.45k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.45k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.45k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.04k, False: 3.41k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.04k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.04k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.04k|{ \
  |  |  |  |  |  |  |  |   57|  1.04k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 229, False: 814]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    229|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    229|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    229|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    814|    } else { \
  |  |  |  |  |  |  |  |   62|    814|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    814|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    814|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    814|    } \
  |  |  |  |  |  |  |  |   66|  1.04k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.04k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.04k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.04k|{ \
  |  |  |  |  |  |  |  |  128|  1.70k|    do { \
  |  |  |  |  |  |  |  |  129|  1.70k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 222, False: 1.48k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    222|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    222|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    222|{ \
  |  |  |  |  |  |  |  |  |  |  104|    222|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    222|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    222|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    222|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    222|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 209, False: 13]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    209|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 203, False: 6]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    203|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    203|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    203|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    203|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      6|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      6|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      6|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      6|            } \
  |  |  |  |  |  |  |  |  |  |  118|    209|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     13|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     13|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     13|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     13|        } \
  |  |  |  |  |  |  |  |  |  |  123|    222|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    222|        } \
  |  |  |  |  |  |  |  |  132|  1.70k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.70k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.70k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.70k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 661, False: 1.04k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.04k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.41k|    } else {  \
  |  |  |  |  |  |  149|  3.41k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.41k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.08k, False: 2.33k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.08k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.08k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.08k|{ \
  |  |  |  |  |  |  |  |   45|  1.08k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 161, False: 919]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    161|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    161|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    919|    } else { \
  |  |  |  |  |  |  |  |   49|    919|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    919|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    919|    } \
  |  |  |  |  |  |  |  |   52|  1.08k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.08k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.08k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.08k|{ \
  |  |  |  |  |  |  |  |  128|  1.15k|    do { \
  |  |  |  |  |  |  |  |  129|  1.15k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 147, False: 1.00k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    147|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    147|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    147|{ \
  |  |  |  |  |  |  |  |  |  |  104|    147|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    147|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    147|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    147|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    147|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 137, False: 10]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    137|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 134, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    134|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    134|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    134|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    134|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  |  |  118|    137|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     10|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     10|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     10|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     10|        } \
  |  |  |  |  |  |  |  |  |  |  123|    147|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    147|        } \
  |  |  |  |  |  |  |  |  132|  1.15k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.15k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.15k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.15k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 76, False: 1.08k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.08k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.33k|        } else { \
  |  |  |  |  |  |  154|  2.33k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.33k|        } \
  |  |  |  |  |  |  156|  3.41k|    } \
  |  |  |  |  |  |  157|  4.45k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  4.45k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  4.45k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 1.99k, False: 2.46k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  4.45k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  4.45k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  4.45k|{ \
  |  |  |  |  |  |  326|  4.45k|    /* east */ \
  |  |  |  |  |  |  327|  4.45k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.45k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.45k| \
  |  |  |  |  |  |  329|  4.45k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  4.45k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.45k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.45k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.45k| \
  |  |  |  |  |  |  332|  4.45k|    /* west */ \
  |  |  |  |  |  |  333|  4.45k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.45k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  4.45k| \
  |  |  |  |  |  |  335|  4.45k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  4.45k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|  4.45k|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|  4.45k|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|  4.45k|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|  4.45k|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|  4.45k|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|  4.45k|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|  4.45k|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|  4.45k|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|  4.45k|    } \
  |  |  |  |  |  |  342|  4.45k| \
  |  |  |  |  |  |  343|  4.45k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  4.45k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  4.45k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  4.45k|            } \
  |  |  |  | 1142|  4.45k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  9.81k|    } \
  |  |  |  | 1144|  60.6k|}
  |  |  ------------------
  |  | 1313|  60.6k|                                    flags, flagsp, flags_stride, data, \
  |  | 1314|  60.6k|                                    l_w, 0, mqc, curctx, \
  |  | 1315|  60.6k|                                    v, a, c, ct, oneplushalf, vsc); \
  |  | 1316|  60.6k|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  60.6k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  60.6k|{ \
  |  |  |  | 1123|  60.6k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  60.6k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  60.6k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  60.6k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  60.6k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 9.11k, False: 51.4k]
  |  |  |  |  ------------------
  |  |  |  | 1124|  9.11k|        do { \
  |  |  |  | 1125|  9.11k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|  9.11k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  9.11k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  9.11k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  9.11k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  9.11k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  9.11k|{ \
  |  |  |  |  |  |  140|  9.11k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  9.11k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  9.11k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  9.11k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  9.11k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  9.11k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 2.05k, False: 7.06k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  2.05k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  2.05k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  2.05k|{ \
  |  |  |  |  |  |  |  |   57|  2.05k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 504, False: 1.54k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    504|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    504|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    504|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.54k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.54k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.54k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.54k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.54k|    } \
  |  |  |  |  |  |  |  |   66|  2.05k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.05k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.05k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.05k|{ \
  |  |  |  |  |  |  |  |  128|  3.28k|    do { \
  |  |  |  |  |  |  |  |  129|  3.28k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 419, False: 2.86k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    419|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    419|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    419|{ \
  |  |  |  |  |  |  |  |  |  |  104|    419|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    419|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    419|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    419|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    419|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 371, False: 48]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    371|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 366, False: 5]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    366|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    366|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    366|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    366|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      5|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      5|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      5|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      5|            } \
  |  |  |  |  |  |  |  |  |  |  118|    371|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     48|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     48|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     48|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     48|        } \
  |  |  |  |  |  |  |  |  |  |  123|    419|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    419|        } \
  |  |  |  |  |  |  |  |  132|  3.28k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.28k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.28k|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.28k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.23k, False: 2.05k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.05k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  7.06k|    } else {  \
  |  |  |  |  |  |  149|  7.06k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  7.06k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.00k, False: 5.06k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.00k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.00k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.00k|{ \
  |  |  |  |  |  |  |  |   45|  2.00k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 330, False: 1.67k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    330|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    330|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.67k|    } else { \
  |  |  |  |  |  |  |  |   49|  1.67k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.67k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.67k|    } \
  |  |  |  |  |  |  |  |   52|  2.00k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.00k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.00k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.00k|{ \
  |  |  |  |  |  |  |  |  128|  2.16k|    do { \
  |  |  |  |  |  |  |  |  129|  2.16k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 252, False: 1.90k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    252|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    252|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    252|{ \
  |  |  |  |  |  |  |  |  |  |  104|    252|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    252|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    252|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    252|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    252|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 224, False: 28]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    224|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 220, False: 4]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    220|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    220|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    220|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    220|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      4|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      4|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      4|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      4|            } \
  |  |  |  |  |  |  |  |  |  |  118|    224|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     28|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     28|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     28|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     28|        } \
  |  |  |  |  |  |  |  |  |  |  123|    252|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    252|        } \
  |  |  |  |  |  |  |  |  132|  2.16k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.16k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.16k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.16k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 155, False: 2.00k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.00k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  5.06k|        } else { \
  |  |  |  |  |  |  154|  5.06k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  5.06k|        } \
  |  |  |  |  |  |  156|  7.06k|    } \
  |  |  |  |  |  |  157|  9.11k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  9.11k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 4.83k, False: 4.28k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  9.11k|                    break; \
  |  |  |  | 1131|  9.11k|            } \
  |  |  |  | 1132|  9.11k|            { \
  |  |  |  | 1133|  4.28k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  4.28k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  4.28k|                                    ci); \
  |  |  |  | 1136|  4.28k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  4.28k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  4.28k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.28k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.28k|{ \
  |  |  |  |  |  |  140|  4.28k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.28k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.28k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.28k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.28k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.28k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.05k, False: 3.23k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.05k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.05k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.05k|{ \
  |  |  |  |  |  |  |  |   57|  1.05k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 232, False: 826]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    232|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    232|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    232|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    826|    } else { \
  |  |  |  |  |  |  |  |   62|    826|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    826|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    826|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    826|    } \
  |  |  |  |  |  |  |  |   66|  1.05k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.05k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.05k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.05k|{ \
  |  |  |  |  |  |  |  |  128|  1.67k|    do { \
  |  |  |  |  |  |  |  |  129|  1.67k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 213, False: 1.46k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    213|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    213|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    213|{ \
  |  |  |  |  |  |  |  |  |  |  104|    213|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    213|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    213|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    213|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    213|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 193, False: 20]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    193|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 190, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    190|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    190|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    190|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    190|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  |  |  118|    193|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     20|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     20|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     20|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     20|        } \
  |  |  |  |  |  |  |  |  |  |  123|    213|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    213|        } \
  |  |  |  |  |  |  |  |  132|  1.67k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.67k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.67k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.67k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 615, False: 1.05k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.05k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.23k|    } else {  \
  |  |  |  |  |  |  149|  3.23k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.23k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.19k, False: 2.04k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.19k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.19k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.19k|{ \
  |  |  |  |  |  |  |  |   45|  1.19k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 193, False: 998]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    193|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    193|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    998|    } else { \
  |  |  |  |  |  |  |  |   49|    998|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    998|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    998|    } \
  |  |  |  |  |  |  |  |   52|  1.19k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.19k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.19k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.19k|{ \
  |  |  |  |  |  |  |  |  128|  1.27k|    do { \
  |  |  |  |  |  |  |  |  129|  1.27k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 176, False: 1.09k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    176|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    176|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    176|{ \
  |  |  |  |  |  |  |  |  |  |  104|    176|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    176|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    176|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    176|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    176|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 168, False: 8]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    168|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 166, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    166|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    166|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    166|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    166|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|    168|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      8|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      8|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      8|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      8|        } \
  |  |  |  |  |  |  |  |  |  |  123|    176|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    176|        } \
  |  |  |  |  |  |  |  |  132|  1.27k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.27k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.27k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.27k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 79, False: 1.19k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.19k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.04k|        } else { \
  |  |  |  |  |  |  154|  2.04k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.04k|        } \
  |  |  |  |  |  |  156|  3.23k|    } \
  |  |  |  |  |  |  157|  4.28k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  4.28k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  4.28k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 2.10k, False: 2.18k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  4.28k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  4.28k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  4.28k|{ \
  |  |  |  |  |  |  326|  4.28k|    /* east */ \
  |  |  |  |  |  |  327|  4.28k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.28k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.28k| \
  |  |  |  |  |  |  329|  4.28k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  4.28k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.28k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.28k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.28k| \
  |  |  |  |  |  |  332|  4.28k|    /* west */ \
  |  |  |  |  |  |  333|  4.28k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.28k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  4.28k| \
  |  |  |  |  |  |  335|  4.28k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  4.28k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  4.28k| \
  |  |  |  |  |  |  343|  4.28k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  4.28k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  4.28k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  4.28k|            } \
  |  |  |  | 1142|  4.28k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  9.11k|    } \
  |  |  |  | 1144|  60.6k|}
  |  |  ------------------
  |  | 1317|  60.6k|                                    flags, flagsp, flags_stride, data, \
  |  | 1318|  60.6k|                                    l_w, 1, mqc, curctx, \
  |  | 1319|  60.6k|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1320|  60.6k|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  60.6k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  60.6k|{ \
  |  |  |  | 1123|  60.6k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  60.6k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  60.6k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  60.6k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  60.6k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 8.96k, False: 51.6k]
  |  |  |  |  ------------------
  |  |  |  | 1124|  8.96k|        do { \
  |  |  |  | 1125|  8.96k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|  8.96k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  8.96k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  8.96k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  8.96k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  8.96k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  8.96k|{ \
  |  |  |  |  |  |  140|  8.96k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  8.96k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  8.96k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  8.96k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  8.96k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  8.96k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.95k, False: 7.01k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.95k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.95k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.95k|{ \
  |  |  |  |  |  |  |  |   57|  1.95k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 409, False: 1.54k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    409|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    409|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    409|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.54k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.54k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.54k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.54k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.54k|    } \
  |  |  |  |  |  |  |  |   66|  1.95k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.95k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.95k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.95k|{ \
  |  |  |  |  |  |  |  |  128|  3.20k|    do { \
  |  |  |  |  |  |  |  |  129|  3.20k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 386, False: 2.81k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    386|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    386|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    386|{ \
  |  |  |  |  |  |  |  |  |  |  104|    386|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    386|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    386|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    386|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    386|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 339, False: 47]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    339|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 337, False: 2]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    337|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    337|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    337|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    337|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  |  |  118|    339|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     47|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     47|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     47|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     47|        } \
  |  |  |  |  |  |  |  |  |  |  123|    386|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    386|        } \
  |  |  |  |  |  |  |  |  132|  3.20k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  3.20k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  3.20k|        ct--; \
  |  |  |  |  |  |  |  |  135|  3.20k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.25k, False: 1.95k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.95k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  7.01k|    } else {  \
  |  |  |  |  |  |  149|  7.01k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  7.01k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 2.06k, False: 4.95k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  2.06k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.06k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  2.06k|{ \
  |  |  |  |  |  |  |  |   45|  2.06k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 337, False: 1.72k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    337|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    337|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.72k|    } else { \
  |  |  |  |  |  |  |  |   49|  1.72k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.72k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.72k|    } \
  |  |  |  |  |  |  |  |   52|  2.06k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.06k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  2.06k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  2.06k|{ \
  |  |  |  |  |  |  |  |  128|  2.22k|    do { \
  |  |  |  |  |  |  |  |  129|  2.22k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 309, False: 1.91k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    309|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    309|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    309|{ \
  |  |  |  |  |  |  |  |  |  |  104|    309|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    309|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    309|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    309|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    309|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 266, False: 43]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    266|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 260, False: 6]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    260|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    260|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    260|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    260|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      6|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      6|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      6|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      6|            } \
  |  |  |  |  |  |  |  |  |  |  118|    266|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     43|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     43|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     43|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     43|        } \
  |  |  |  |  |  |  |  |  |  |  123|    309|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    309|        } \
  |  |  |  |  |  |  |  |  132|  2.22k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.22k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.22k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.22k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 158, False: 2.06k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  2.06k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  4.95k|        } else { \
  |  |  |  |  |  |  154|  4.95k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  4.95k|        } \
  |  |  |  |  |  |  156|  7.01k|    } \
  |  |  |  |  |  |  157|  8.96k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  8.96k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 4.65k, False: 4.31k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  8.96k|                    break; \
  |  |  |  | 1131|  8.96k|            } \
  |  |  |  | 1132|  8.96k|            { \
  |  |  |  | 1133|  4.31k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  4.31k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  4.31k|                                    ci); \
  |  |  |  | 1136|  4.31k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  4.31k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  4.31k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.31k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.31k|{ \
  |  |  |  |  |  |  140|  4.31k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.31k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.31k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.31k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.31k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.31k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.07k, False: 3.23k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.07k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.07k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.07k|{ \
  |  |  |  |  |  |  |  |   57|  1.07k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 236, False: 842]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    236|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    236|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    236|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    842|    } else { \
  |  |  |  |  |  |  |  |   62|    842|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    842|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    842|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    842|    } \
  |  |  |  |  |  |  |  |   66|  1.07k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.07k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.07k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.07k|{ \
  |  |  |  |  |  |  |  |  128|  1.75k|    do { \
  |  |  |  |  |  |  |  |  129|  1.75k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 217, False: 1.53k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    217|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    217|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    217|{ \
  |  |  |  |  |  |  |  |  |  |  104|    217|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    217|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    217|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    217|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    217|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 195, False: 22]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    195|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 188, False: 7]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    188|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    188|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    188|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    188|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      7|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      7|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      7|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      7|            } \
  |  |  |  |  |  |  |  |  |  |  118|    195|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     22|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     22|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     22|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     22|        } \
  |  |  |  |  |  |  |  |  |  |  123|    217|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    217|        } \
  |  |  |  |  |  |  |  |  132|  1.75k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.75k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.75k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.75k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 674, False: 1.07k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.07k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.23k|    } else {  \
  |  |  |  |  |  |  149|  3.23k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.23k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.06k, False: 2.16k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.06k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.06k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.06k|{ \
  |  |  |  |  |  |  |  |   45|  1.06k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 181, False: 886]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    181|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    181|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    886|    } else { \
  |  |  |  |  |  |  |  |   49|    886|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    886|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    886|    } \
  |  |  |  |  |  |  |  |   52|  1.06k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.06k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.06k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.06k|{ \
  |  |  |  |  |  |  |  |  128|  1.14k|    do { \
  |  |  |  |  |  |  |  |  129|  1.14k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 127, False: 1.02k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    127|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    127|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    127|{ \
  |  |  |  |  |  |  |  |  |  |  104|    127|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    127|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    127|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    127|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    127|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 119, False: 8]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    119|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 118, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    118|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    118|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    118|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    118|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|    119|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      8|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      8|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      8|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      8|        } \
  |  |  |  |  |  |  |  |  |  |  123|    127|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    127|        } \
  |  |  |  |  |  |  |  |  132|  1.14k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.14k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.14k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.14k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 82, False: 1.06k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.06k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.16k|        } else { \
  |  |  |  |  |  |  154|  2.16k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.16k|        } \
  |  |  |  |  |  |  156|  3.23k|    } \
  |  |  |  |  |  |  157|  4.31k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  4.31k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  4.31k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 2.06k, False: 2.24k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  4.31k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  4.31k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  4.31k|{ \
  |  |  |  |  |  |  326|  4.31k|    /* east */ \
  |  |  |  |  |  |  327|  4.31k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.31k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.31k| \
  |  |  |  |  |  |  329|  4.31k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  4.31k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.31k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.31k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.31k| \
  |  |  |  |  |  |  332|  4.31k|    /* west */ \
  |  |  |  |  |  |  333|  4.31k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.31k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  4.31k| \
  |  |  |  |  |  |  335|  4.31k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  4.31k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  4.31k| \
  |  |  |  |  |  |  343|  4.31k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  4.31k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|      0|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|      0|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|      0|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|      0|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|      0|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|      0|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|      0|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|      0|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|      0|    } \
  |  |  |  |  |  |  350|  4.31k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  4.31k|            } \
  |  |  |  | 1142|  4.31k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  8.96k|    } \
  |  |  |  | 1144|  60.6k|}
  |  |  ------------------
  |  | 1321|  60.6k|                                    flags, flagsp, flags_stride, data, \
  |  | 1322|  60.6k|                                    l_w, 2, mqc, curctx, \
  |  | 1323|  60.6k|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1324|  60.6k|                opj_t1_dec_clnpass_step_macro(OPJ_TRUE, OPJ_FALSE, \
  |  |  ------------------
  |  |  |  | 1121|  60.6k|                                      v, a, c, ct, oneplushalf, vsc) \
  |  |  |  | 1122|  60.6k|{ \
  |  |  |  | 1123|  60.6k|    if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  60.6k|#define T1_SIGMA_THIS T1_SIGMA_4
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  60.6k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   if ( !check_flags || !(flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U)))) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  60.6k|#define T1_PI_THIS    T1_PI_0
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  60.6k|#define T1_PI_0     (1U << 21)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1123:10): [Folded - Ignored]
  |  |  |  |  |  Branch (1123:26): [True: 9.14k, False: 51.4k]
  |  |  |  |  ------------------
  |  |  |  | 1124|  9.14k|        do { \
  |  |  |  | 1125|  9.14k|            if( !partial ) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1125:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1126|  9.14k|                OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); \
  |  |  |  | 1127|  9.14k|                opj_t1_setcurctx(curctx, ctxt1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  9.14k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1128|  9.14k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  9.14k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  9.14k|{ \
  |  |  |  |  |  |  140|  9.14k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  9.14k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  9.14k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  9.14k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  9.14k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  9.14k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.76k, False: 7.38k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.76k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.76k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.76k|{ \
  |  |  |  |  |  |  |  |   57|  1.76k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 357, False: 1.40k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    357|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    357|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    357|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|  1.40k|    } else { \
  |  |  |  |  |  |  |  |   62|  1.40k|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|  1.40k|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|  1.40k|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|  1.40k|    } \
  |  |  |  |  |  |  |  |   66|  1.76k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.76k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.76k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.76k|{ \
  |  |  |  |  |  |  |  |  128|  2.98k|    do { \
  |  |  |  |  |  |  |  |  129|  2.98k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 339, False: 2.64k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    339|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    339|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    339|{ \
  |  |  |  |  |  |  |  |  |  |  104|    339|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    339|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    339|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    339|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    339|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 297, False: 42]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    297|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 289, False: 8]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    289|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    289|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    289|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    289|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      8|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      8|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      8|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      8|            } \
  |  |  |  |  |  |  |  |  |  |  118|    297|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     42|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     42|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     42|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     42|        } \
  |  |  |  |  |  |  |  |  |  |  123|    339|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    339|        } \
  |  |  |  |  |  |  |  |  132|  2.98k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.98k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.98k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.98k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 1.21k, False: 1.76k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.76k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  7.38k|    } else {  \
  |  |  |  |  |  |  149|  7.38k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  7.38k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.98k, False: 5.39k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.98k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.98k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.98k|{ \
  |  |  |  |  |  |  |  |   45|  1.98k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 296, False: 1.69k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    296|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    296|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|  1.69k|    } else { \
  |  |  |  |  |  |  |  |   49|  1.69k|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|  1.69k|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|  1.69k|    } \
  |  |  |  |  |  |  |  |   52|  1.98k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.98k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.98k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.98k|{ \
  |  |  |  |  |  |  |  |  128|  2.13k|    do { \
  |  |  |  |  |  |  |  |  129|  2.13k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 270, False: 1.86k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    270|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    270|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    270|{ \
  |  |  |  |  |  |  |  |  |  |  104|    270|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    270|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    270|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    270|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    270|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 243, False: 27]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    243|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 240, False: 3]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    240|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    240|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    240|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    240|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      3|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      3|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      3|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      3|            } \
  |  |  |  |  |  |  |  |  |  |  118|    243|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     27|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     27|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     27|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     27|        } \
  |  |  |  |  |  |  |  |  |  |  123|    270|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    270|        } \
  |  |  |  |  |  |  |  |  132|  2.13k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  2.13k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  2.13k|        ct--; \
  |  |  |  |  |  |  |  |  135|  2.13k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 148, False: 1.98k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.98k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  5.39k|        } else { \
  |  |  |  |  |  |  154|  5.39k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  5.39k|        } \
  |  |  |  |  |  |  156|  7.38k|    } \
  |  |  |  |  |  |  157|  9.14k|}
  |  |  |  |  ------------------
  |  |  |  | 1129|  9.14k|                if( !v ) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1129:21): [True: 4.74k, False: 4.40k]
  |  |  |  |  ------------------
  |  |  |  | 1130|  9.14k|                    break; \
  |  |  |  | 1131|  9.14k|            } \
  |  |  |  | 1132|  9.14k|            { \
  |  |  |  | 1133|  4.40k|                OPJ_UINT32 lu = opj_t1_getctxtno_sc_or_spb_index( \
  |  |  |  | 1134|  4.40k|                                    flags, flagsp[-1], flagsp[1], \
  |  |  |  | 1135|  4.40k|                                    ci); \
  |  |  |  | 1136|  4.40k|                opj_t1_setcurctx(curctx, opj_t1_getctxno_sc(lu)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|  4.40k|#define opj_t1_setcurctx(curctx, ctxno)  curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  |  |  |  |  ------------------
  |  |  |  | 1137|  4.40k|                opj_mqc_decode_macro(v, mqc, curctx, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|  4.40k|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  |  |  139|  4.40k|{ \
  |  |  |  |  |  |  140|  4.40k|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  |  |  141|  4.40k|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  |  |  142|  4.40k|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  |  |  143|  4.40k|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  |  |  144|  4.40k|    a -= (*curctx)->qeval;  \
  |  |  |  |  |  |  145|  4.40k|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (145:9): [True: 1.08k, False: 3.32k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  146|  1.08k|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   55|  1.08k|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   56|  1.08k|{ \
  |  |  |  |  |  |  |  |   57|  1.08k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (57:9): [True: 243, False: 841]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   58|    243|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   59|    243|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   60|    243|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   61|    841|    } else { \
  |  |  |  |  |  |  |  |   62|    841|        a = (*curctx)->qeval; \
  |  |  |  |  |  |  |  |   63|    841|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   64|    841|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   65|    841|    } \
  |  |  |  |  |  |  |  |   66|  1.08k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.08k|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.08k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.08k|{ \
  |  |  |  |  |  |  |  |  128|  1.73k|    do { \
  |  |  |  |  |  |  |  |  129|  1.73k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 203, False: 1.53k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    203|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    203|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    203|{ \
  |  |  |  |  |  |  |  |  |  |  104|    203|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    203|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    203|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    203|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    203|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 190, False: 13]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    190|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 189, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    189|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    189|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    189|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    189|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|    190|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|     13|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|     13|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|     13|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|     13|        } \
  |  |  |  |  |  |  |  |  |  |  123|    203|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    203|        } \
  |  |  |  |  |  |  |  |  132|  1.73k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.73k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.73k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.73k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 650, False: 1.08k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.08k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.32k|    } else {  \
  |  |  |  |  |  |  149|  3.32k|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  |  |  150|  3.32k|        if ((a & 0x8000) == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:13): [True: 1.07k, False: 2.24k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.07k|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.07k|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |  |  |   44|  1.07k|{ \
  |  |  |  |  |  |  |  |   45|  1.07k|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (45:9): [True: 179, False: 898]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|    179|        d = !((*curctx)->mps); \
  |  |  |  |  |  |  |  |   47|    179|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |  |  |   48|    898|    } else { \
  |  |  |  |  |  |  |  |   49|    898|        d = (*curctx)->mps; \
  |  |  |  |  |  |  |  |   50|    898|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |  |  |   51|    898|    } \
  |  |  |  |  |  |  |  |   52|  1.07k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.07k|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  126|  1.07k|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  |  |  127|  1.07k|{ \
  |  |  |  |  |  |  |  |  128|  1.15k|    do { \
  |  |  |  |  |  |  |  |  129|  1.15k|        if (ct == 0) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (129:13): [True: 136, False: 1.01k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  130|    136|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|    136|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  |  |  103|    136|{ \
  |  |  |  |  |  |  |  |  |  |  104|    136|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  |  |  105|    136|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  |  |  106|    136|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  |  |  107|    136|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  |  |  108|    136|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 129, False: 7]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  109|    129|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 128, False: 1]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  110|    128|                c += 0xff00; \
  |  |  |  |  |  |  |  |  |  |  111|    128|                ct = 8; \
  |  |  |  |  |  |  |  |  |  |  112|    128|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  |  |  113|    128|            } else { \
  |  |  |  |  |  |  |  |  |  |  114|      1|                mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  115|      1|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  |  |  116|      1|                ct = 7; \
  |  |  |  |  |  |  |  |  |  |  117|      1|            } \
  |  |  |  |  |  |  |  |  |  |  118|    129|        } else { \
  |  |  |  |  |  |  |  |  |  |  119|      7|            mqc->bp++; \
  |  |  |  |  |  |  |  |  |  |  120|      7|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  |  |  121|      7|            ct = 8; \
  |  |  |  |  |  |  |  |  |  |  122|      7|        } \
  |  |  |  |  |  |  |  |  |  |  123|    136|}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  131|    136|        } \
  |  |  |  |  |  |  |  |  132|  1.15k|        a <<= 1; \
  |  |  |  |  |  |  |  |  133|  1.15k|        c <<= 1; \
  |  |  |  |  |  |  |  |  134|  1.15k|        ct--; \
  |  |  |  |  |  |  |  |  135|  1.15k|    } while (a < 0x8000); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (135:14): [True: 75, False: 1.07k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  136|  1.07k|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  2.24k|        } else { \
  |  |  |  |  |  |  154|  2.24k|            d = (*curctx)->mps; \
  |  |  |  |  |  |  155|  2.24k|        } \
  |  |  |  |  |  |  156|  3.32k|    } \
  |  |  |  |  |  |  157|  4.40k|}
  |  |  |  |  ------------------
  |  |  |  | 1138|  4.40k|                v = v ^ opj_t1_getspb(lu); \
  |  |  |  | 1139|  4.40k|                data[ci*data_stride] = v ? -oneplushalf : oneplushalf; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1139:40): [True: 2.06k, False: 2.33k]
  |  |  |  |  ------------------
  |  |  |  | 1140|  4.40k|                opj_t1_update_flags_macro(flags, flagsp, ci, v, flags_stride, vsc); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  324|  4.40k|#define opj_t1_update_flags_macro(flags, flagsp, ci, s, stride, vsc) \
  |  |  |  |  |  |  325|  4.40k|{ \
  |  |  |  |  |  |  326|  4.40k|    /* east */ \
  |  |  |  |  |  |  327|  4.40k|    flagsp[-1] |= T1_SIGMA_5 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   96|  4.40k|#define T1_SIGMA_5  (1U << 5)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  328|  4.40k| \
  |  |  |  |  |  |  329|  4.40k|    /* mark target as significant */ \
  |  |  |  |  |  |  330|  4.40k|    flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  113|  4.40k|#define T1_CHI_1_I  19
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   95|  4.40k|#define T1_SIGMA_4  (1U << 4)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  331|  4.40k| \
  |  |  |  |  |  |  332|  4.40k|    /* west */ \
  |  |  |  |  |  |  333|  4.40k|    flagsp[1] |= T1_SIGMA_3 << (3U * ci); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  4.40k|#define T1_SIGMA_3  (1U << 3)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  334|  4.40k| \
  |  |  |  |  |  |  335|  4.40k|    /* north-west, north, north-east */ \
  |  |  |  |  |  |  336|  4.40k|    if (ci == 0U && !(vsc)) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (336:9): [Folded - Ignored]
  |  |  |  |  |  |  |  Branch (336:21): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  337|      0|        opj_flag_t* north = flagsp - (stride); \
  |  |  |  |  |  |  338|      0|        *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  127|      0|#define T1_CHI_5_I  31
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  107|      0|#define T1_SIGMA_16 (1U << 16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  339|      0|        north[-1] |= T1_SIGMA_17; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  108|      0|#define T1_SIGMA_17 (1U << 17)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  340|      0|        north[1] |= T1_SIGMA_15; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  106|      0|#define T1_SIGMA_15 (1U << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  341|      0|    } \
  |  |  |  |  |  |  342|  4.40k| \
  |  |  |  |  |  |  343|  4.40k|    /* south-west, south, south-east */ \
  |  |  |  |  |  |  344|  4.40k|    if (ci == 3U) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (344:9): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  345|  4.40k|        opj_flag_t* south = flagsp + (stride); \
  |  |  |  |  |  |  346|  4.40k|        *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  4.40k|#define T1_CHI_0_I  18
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                       *south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   92|  4.40k|#define T1_SIGMA_1  (1U << 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  347|  4.40k|        south[-1] |= T1_SIGMA_2; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   93|  4.40k|#define T1_SIGMA_2  (1U << 2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  348|  4.40k|        south[1] |= T1_SIGMA_0; \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   91|  4.40k|#define T1_SIGMA_0  (1U << 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  349|  4.40k|    } \
  |  |  |  |  |  |  350|  4.40k|}
  |  |  |  |  ------------------
  |  |  |  | 1141|  4.40k|            } \
  |  |  |  | 1142|  4.40k|        } while(0); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1142:17): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  | 1143|  9.14k|    } \
  |  |  |  | 1144|  60.6k|}
  |  |  ------------------
  |  | 1325|  60.6k|                                    flags, flagsp, flags_stride, data, \
  |  | 1326|  60.6k|                                    l_w, 3, mqc, curctx, \
  |  | 1327|  60.6k|                                    v, a, c, ct, oneplushalf, OPJ_FALSE); \
  |  | 1328|  60.6k|            } \
  |  | 1329|  99.2k|            *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  61.5k|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  61.5k|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  61.5k|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp = flags & ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  61.5k|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1330|  61.5k|        } \
  |  | 1331|    117|    } \
  |  | 1332|    135|    UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct); \
  |  |  ------------------
  |  |  |  |  166|    135|        mqc->curctx = curctx; \
  |  |  |  |  167|    135|        mqc->c = c; \
  |  |  |  |  168|    135|        mqc->a = a; \
  |  |  |  |  169|    135|        mqc->ct = ct;
  |  |  ------------------
  |  | 1333|    135|    if( k < h ) { \
  |  |  ------------------
  |  |  |  Branch (1333:9): [True: 18, False: 117]
  |  |  ------------------
  |  | 1334|  10.8k|        for (i = 0; i < l_w; ++i, ++flagsp, ++data) { \
  |  |  ------------------
  |  |  |  Branch (1334:21): [True: 10.8k, False: 18]
  |  |  ------------------
  |  | 1335|  34.5k|            for (j = 0; j < h - k; ++j) { \
  |  |  ------------------
  |  |  |  Branch (1335:25): [True: 23.7k, False: 10.8k]
  |  |  ------------------
  |  | 1336|  23.7k|                opj_t1_dec_clnpass_step(t1, flagsp, data + j * l_w, oneplushalf, j, vsc); \
  |  | 1337|  23.7k|            } \
  |  | 1338|  10.8k|            *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  115|  10.8k|#define T1_PI_0     (1U << 21)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  119|  10.8k|#define T1_PI_1     (1U << 24)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  122|  10.8k|#define T1_PI_2     (1U << 27)
  |  |  ------------------
  |  |                           *flagsp &= ~(T1_PI_0 | T1_PI_1 | T1_PI_2 | T1_PI_3); \
  |  |  ------------------
  |  |  |  |  125|  10.8k|#define T1_PI_3     (1U << 30)
  |  |  ------------------
  |  | 1339|  10.8k|        } \
  |  | 1340|     18|    } \
  |  | 1341|    135|}
  ------------------
 1383|    135|                                t1->w + 2U);
 1384|    135|}
t1.c:opj_t1_dec_clnpass_check_segsym:
 1344|  2.31k|{
 1345|  2.31k|    if (cblksty & J2K_CCP_CBLKSTY_SEGSYM) {
  ------------------
  |  |   63|  2.31k|#define J2K_CCP_CBLKSTY_SEGSYM 0x20   /**< Segmentation symbols are used */
  ------------------
  |  Branch (1345:9): [True: 759, False: 1.55k]
  ------------------
 1346|    759|        opj_mqc_t* mqc = &(t1->mqc);
 1347|    759|        OPJ_UINT32 v, v2;
 1348|    759|        opj_mqc_setcurctx(mqc, T1_CTXNO_UNI);
  ------------------
  |  |  139|    759|#define opj_mqc_setcurctx(mqc, ctxno)   (mqc)->curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
  ------------------
 1349|    759|        opj_mqc_decode(v, mqc);
  ------------------
  |  |  194|    759|    opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
  |  |  ------------------
  |  |  |  |  138|    759|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|    759|{ \
  |  |  |  |  140|    759|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|    759|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|    759|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|    759|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|    759|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|    759|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 262, False: 497]
  |  |  |  |  ------------------
  |  |  |  |  146|    262|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    262|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|    262|{ \
  |  |  |  |  |  |   57|    262|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 139, False: 123]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|    139|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|    139|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|    139|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|    139|    } else { \
  |  |  |  |  |  |   62|    123|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|    123|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|    123|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|    123|    } \
  |  |  |  |  |  |   66|    262|}
  |  |  |  |  ------------------
  |  |  |  |  147|    262|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    262|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    262|{ \
  |  |  |  |  |  |  128|    262|    do { \
  |  |  |  |  |  |  129|    262|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 41, False: 221]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     41|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     41|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     41|{ \
  |  |  |  |  |  |  |  |  104|     41|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     41|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     41|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     41|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     41|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 41, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     41|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 41, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     41|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     41|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     41|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     41|            } else { \
  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  118|     41|        } else { \
  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  123|     41|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     41|        } \
  |  |  |  |  |  |  132|    262|        a <<= 1; \
  |  |  |  |  |  |  133|    262|        c <<= 1; \
  |  |  |  |  |  |  134|    262|        ct--; \
  |  |  |  |  |  |  135|    262|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 262]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    262|}
  |  |  |  |  ------------------
  |  |  |  |  148|    497|    } else {  \
  |  |  |  |  149|    497|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|    497|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 240, False: 257]
  |  |  |  |  ------------------
  |  |  |  |  151|    240|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    240|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|    240|{ \
  |  |  |  |  |  |   45|    240|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 149, False: 91]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|    149|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|    149|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|    149|    } else { \
  |  |  |  |  |  |   49|     91|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|     91|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|     91|    } \
  |  |  |  |  |  |   52|    240|}
  |  |  |  |  ------------------
  |  |  |  |  152|    240|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    240|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    240|{ \
  |  |  |  |  |  |  128|    295|    do { \
  |  |  |  |  |  |  129|    295|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 49, False: 246]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     49|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     49|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     49|{ \
  |  |  |  |  |  |  |  |  104|     49|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     49|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     49|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     49|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     49|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 49, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     49|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 49, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     49|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     49|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     49|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     49|            } else { \
  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  118|     49|        } else { \
  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  123|     49|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     49|        } \
  |  |  |  |  |  |  132|    295|        a <<= 1; \
  |  |  |  |  |  |  133|    295|        c <<= 1; \
  |  |  |  |  |  |  134|    295|        ct--; \
  |  |  |  |  |  |  135|    295|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 55, False: 240]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    240|}
  |  |  |  |  ------------------
  |  |  |  |  153|    257|        } else { \
  |  |  |  |  154|    257|            d = (*curctx)->mps; \
  |  |  |  |  155|    257|        } \
  |  |  |  |  156|    497|    } \
  |  |  |  |  157|    759|}
  |  |  ------------------
  ------------------
 1350|    759|        opj_mqc_decode(v2, mqc);
  ------------------
  |  |  194|    759|    opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
  |  |  ------------------
  |  |  |  |  138|    759|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|    759|{ \
  |  |  |  |  140|    759|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|    759|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|    759|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|    759|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|    759|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|    759|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 244, False: 515]
  |  |  |  |  ------------------
  |  |  |  |  146|    244|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    244|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|    244|{ \
  |  |  |  |  |  |   57|    244|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 106, False: 138]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|    106|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|    106|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|    106|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|    138|    } else { \
  |  |  |  |  |  |   62|    138|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|    138|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|    138|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|    138|    } \
  |  |  |  |  |  |   66|    244|}
  |  |  |  |  ------------------
  |  |  |  |  147|    244|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    244|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    244|{ \
  |  |  |  |  |  |  128|    244|    do { \
  |  |  |  |  |  |  129|    244|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 18, False: 226]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     18|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     18|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     18|{ \
  |  |  |  |  |  |  |  |  104|     18|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     18|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     18|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     18|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     18|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 18, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     18|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 18, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     18|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     18|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     18|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     18|            } else { \
  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  118|     18|        } else { \
  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  123|     18|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     18|        } \
  |  |  |  |  |  |  132|    244|        a <<= 1; \
  |  |  |  |  |  |  133|    244|        c <<= 1; \
  |  |  |  |  |  |  134|    244|        ct--; \
  |  |  |  |  |  |  135|    244|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 244]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    244|}
  |  |  |  |  ------------------
  |  |  |  |  148|    515|    } else {  \
  |  |  |  |  149|    515|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|    515|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 441, False: 74]
  |  |  |  |  ------------------
  |  |  |  |  151|    441|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    441|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|    441|{ \
  |  |  |  |  |  |   45|    441|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 245, False: 196]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|    245|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|    245|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|    245|    } else { \
  |  |  |  |  |  |   49|    196|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|    196|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|    196|    } \
  |  |  |  |  |  |   52|    441|}
  |  |  |  |  ------------------
  |  |  |  |  152|    441|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    441|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    441|{ \
  |  |  |  |  |  |  128|    493|    do { \
  |  |  |  |  |  |  129|    493|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 19, False: 474]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     19|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     19|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     19|{ \
  |  |  |  |  |  |  |  |  104|     19|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     19|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     19|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     19|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     19|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 19, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     19|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 19, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     19|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     19|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     19|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     19|            } else { \
  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  118|     19|        } else { \
  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  123|     19|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     19|        } \
  |  |  |  |  |  |  132|    493|        a <<= 1; \
  |  |  |  |  |  |  133|    493|        c <<= 1; \
  |  |  |  |  |  |  134|    493|        ct--; \
  |  |  |  |  |  |  135|    493|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 52, False: 441]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    441|}
  |  |  |  |  ------------------
  |  |  |  |  153|    441|        } else { \
  |  |  |  |  154|     74|            d = (*curctx)->mps; \
  |  |  |  |  155|     74|        } \
  |  |  |  |  156|    515|    } \
  |  |  |  |  157|    759|}
  |  |  ------------------
  ------------------
 1351|    759|        v = (v << 1) | v2;
 1352|    759|        opj_mqc_decode(v2, mqc);
  ------------------
  |  |  194|    759|    opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
  |  |  ------------------
  |  |  |  |  138|    759|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|    759|{ \
  |  |  |  |  140|    759|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|    759|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|    759|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|    759|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|    759|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|    759|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 311, False: 448]
  |  |  |  |  ------------------
  |  |  |  |  146|    311|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    311|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|    311|{ \
  |  |  |  |  |  |   57|    311|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 57, False: 254]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|     57|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|     57|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|     57|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|    254|    } else { \
  |  |  |  |  |  |   62|    254|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|    254|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|    254|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|    254|    } \
  |  |  |  |  |  |   66|    311|}
  |  |  |  |  ------------------
  |  |  |  |  147|    311|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    311|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    311|{ \
  |  |  |  |  |  |  128|    311|    do { \
  |  |  |  |  |  |  129|    311|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 29, False: 282]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     29|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     29|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     29|{ \
  |  |  |  |  |  |  |  |  104|     29|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     29|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     29|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     29|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     29|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 28, False: 1]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     28|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 28, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     28|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     28|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     28|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     28|            } else { \
  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  118|     28|        } else { \
  |  |  |  |  |  |  |  |  119|      1|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      1|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      1|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      1|        } \
  |  |  |  |  |  |  |  |  123|     29|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     29|        } \
  |  |  |  |  |  |  132|    311|        a <<= 1; \
  |  |  |  |  |  |  133|    311|        c <<= 1; \
  |  |  |  |  |  |  134|    311|        ct--; \
  |  |  |  |  |  |  135|    311|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 311]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    311|}
  |  |  |  |  ------------------
  |  |  |  |  148|    448|    } else {  \
  |  |  |  |  149|    448|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|    448|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 421, False: 27]
  |  |  |  |  ------------------
  |  |  |  |  151|    421|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    421|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|    421|{ \
  |  |  |  |  |  |   45|    421|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 211, False: 210]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|    211|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|    211|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|    211|    } else { \
  |  |  |  |  |  |   49|    210|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|    210|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|    210|    } \
  |  |  |  |  |  |   52|    421|}
  |  |  |  |  ------------------
  |  |  |  |  152|    421|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    421|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    421|{ \
  |  |  |  |  |  |  128|    587|    do { \
  |  |  |  |  |  |  129|    587|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 26, False: 561]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     26|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     26|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     26|{ \
  |  |  |  |  |  |  |  |  104|     26|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     26|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     26|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     26|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     26|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 26, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     26|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 26, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     26|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     26|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     26|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     26|            } else { \
  |  |  |  |  |  |  |  |  114|      0|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      0|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      0|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      0|            } \
  |  |  |  |  |  |  |  |  118|     26|        } else { \
  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  123|     26|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     26|        } \
  |  |  |  |  |  |  132|    587|        a <<= 1; \
  |  |  |  |  |  |  133|    587|        c <<= 1; \
  |  |  |  |  |  |  134|    587|        ct--; \
  |  |  |  |  |  |  135|    587|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 166, False: 421]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    421|}
  |  |  |  |  ------------------
  |  |  |  |  153|    421|        } else { \
  |  |  |  |  154|     27|            d = (*curctx)->mps; \
  |  |  |  |  155|     27|        } \
  |  |  |  |  156|    448|    } \
  |  |  |  |  157|    759|}
  |  |  ------------------
  ------------------
 1353|    759|        v = (v << 1) | v2;
 1354|    759|        opj_mqc_decode(v2, mqc);
  ------------------
  |  |  194|    759|    opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
  |  |  ------------------
  |  |  |  |  138|    759|#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
  |  |  |  |  139|    759|{ \
  |  |  |  |  140|    759|    /* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
  |  |  |  |  141|    759|    /* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
  |  |  |  |  142|    759|    /* software-conventions decoder" has been tried, but does not bring any */ \
  |  |  |  |  143|    759|    /* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
  |  |  |  |  144|    759|    a -= (*curctx)->qeval;  \
  |  |  |  |  145|    759|    if ((c >> 16) < (*curctx)->qeval) {  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (145:9): [True: 242, False: 517]
  |  |  |  |  ------------------
  |  |  |  |  146|    242|        opj_mqc_lpsexchange_macro(d, curctx, a);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    242|#define opj_mqc_lpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   56|    242|{ \
  |  |  |  |  |  |   57|    242|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (57:9): [True: 18, False: 224]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   58|     18|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   59|     18|        d = (*curctx)->mps; \
  |  |  |  |  |  |   60|     18|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   61|    224|    } else { \
  |  |  |  |  |  |   62|    224|        a = (*curctx)->qeval; \
  |  |  |  |  |  |   63|    224|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   64|    224|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   65|    224|    } \
  |  |  |  |  |  |   66|    242|}
  |  |  |  |  ------------------
  |  |  |  |  147|    242|        opj_mqc_renormd_macro(mqc, a, c, ct);  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    242|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    242|{ \
  |  |  |  |  |  |  128|    242|    do { \
  |  |  |  |  |  |  129|    242|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 36, False: 206]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     36|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|     36|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|     36|{ \
  |  |  |  |  |  |  |  |  104|     36|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|     36|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|     36|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|     36|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|     36|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 36, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|     36|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 34, False: 2]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|     34|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|     34|                ct = 8; \
  |  |  |  |  |  |  |  |  112|     34|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|     34|            } else { \
  |  |  |  |  |  |  |  |  114|      2|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|      2|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|      2|                ct = 7; \
  |  |  |  |  |  |  |  |  117|      2|            } \
  |  |  |  |  |  |  |  |  118|     36|        } else { \
  |  |  |  |  |  |  |  |  119|      0|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      0|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      0|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      0|        } \
  |  |  |  |  |  |  |  |  123|     36|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|     36|        } \
  |  |  |  |  |  |  132|    242|        a <<= 1; \
  |  |  |  |  |  |  133|    242|        c <<= 1; \
  |  |  |  |  |  |  134|    242|        ct--; \
  |  |  |  |  |  |  135|    242|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 0, False: 242]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    242|}
  |  |  |  |  ------------------
  |  |  |  |  148|    517|    } else {  \
  |  |  |  |  149|    517|        c -= (*curctx)->qeval << 16;  \
  |  |  |  |  150|    517|        if ((a & 0x8000) == 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:13): [True: 459, False: 58]
  |  |  |  |  ------------------
  |  |  |  |  151|    459|            opj_mqc_mpsexchange_macro(d, curctx, a); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    459|#define opj_mqc_mpsexchange_macro(d, curctx, a) \
  |  |  |  |  |  |   44|    459|{ \
  |  |  |  |  |  |   45|    459|    if (a < (*curctx)->qeval) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:9): [True: 58, False: 401]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   46|     58|        d = !((*curctx)->mps); \
  |  |  |  |  |  |   47|     58|        *curctx = (*curctx)->nlps; \
  |  |  |  |  |  |   48|    401|    } else { \
  |  |  |  |  |  |   49|    401|        d = (*curctx)->mps; \
  |  |  |  |  |  |   50|    401|        *curctx = (*curctx)->nmps; \
  |  |  |  |  |  |   51|    401|    } \
  |  |  |  |  |  |   52|    459|}
  |  |  |  |  ------------------
  |  |  |  |  152|    459|            opj_mqc_renormd_macro(mqc, a, c, ct); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    459|#define opj_mqc_renormd_macro(mqc, a, c, ct) \
  |  |  |  |  |  |  127|    459|{ \
  |  |  |  |  |  |  128|    487|    do { \
  |  |  |  |  |  |  129|    487|        if (ct == 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (129:13): [True: 133, False: 354]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  130|    133|            opj_mqc_bytein_macro(mqc, c, ct); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|    133|#define opj_mqc_bytein_macro(mqc, c, ct) \
  |  |  |  |  |  |  |  |  103|    133|{ \
  |  |  |  |  |  |  |  |  104|    133|        OPJ_UINT32 l_c;  \
  |  |  |  |  |  |  |  |  105|    133|        /* Given opj_mqc_init_dec() we know that at some point we will */ \
  |  |  |  |  |  |  |  |  106|    133|        /* have a 0xFF 0xFF artificial marker */ \
  |  |  |  |  |  |  |  |  107|    133|        l_c = *(mqc->bp + 1); \
  |  |  |  |  |  |  |  |  108|    133|        if (*mqc->bp == 0xff) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (108:13): [True: 129, False: 4]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|    129|            if (l_c > 0x8f) { \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (109:17): [True: 119, False: 10]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  110|    119|                c += 0xff00; \
  |  |  |  |  |  |  |  |  111|    119|                ct = 8; \
  |  |  |  |  |  |  |  |  112|    119|                mqc->end_of_byte_stream_counter ++; \
  |  |  |  |  |  |  |  |  113|    119|            } else { \
  |  |  |  |  |  |  |  |  114|     10|                mqc->bp++; \
  |  |  |  |  |  |  |  |  115|     10|                c += l_c << 9; \
  |  |  |  |  |  |  |  |  116|     10|                ct = 7; \
  |  |  |  |  |  |  |  |  117|     10|            } \
  |  |  |  |  |  |  |  |  118|    129|        } else { \
  |  |  |  |  |  |  |  |  119|      4|            mqc->bp++; \
  |  |  |  |  |  |  |  |  120|      4|            c += l_c << 8; \
  |  |  |  |  |  |  |  |  121|      4|            ct = 8; \
  |  |  |  |  |  |  |  |  122|      4|        } \
  |  |  |  |  |  |  |  |  123|    133|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  131|    133|        } \
  |  |  |  |  |  |  132|    487|        a <<= 1; \
  |  |  |  |  |  |  133|    487|        c <<= 1; \
  |  |  |  |  |  |  134|    487|        ct--; \
  |  |  |  |  |  |  135|    487|    } while (a < 0x8000); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (135:14): [True: 28, False: 459]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  136|    459|}
  |  |  |  |  ------------------
  |  |  |  |  153|    459|        } else { \
  |  |  |  |  154|     58|            d = (*curctx)->mps; \
  |  |  |  |  155|     58|        } \
  |  |  |  |  156|    517|    } \
  |  |  |  |  157|    759|}
  |  |  ------------------
  ------------------
 1355|    759|        v = (v << 1) | v2;
 1356|       |        /*
 1357|       |        if (v!=0xa) {
 1358|       |            opj_event_msg(t1->cinfo, EVT_WARNING, "Bad segmentation symbol %x\n", v);
 1359|       |        }
 1360|       |        */
 1361|    759|    }
 1362|  2.31k|}

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

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

opj_tgt_create:
   50|   323k|{
   51|   323k|    OPJ_INT32 nplh[32];
   52|   323k|    OPJ_INT32 nplv[32];
   53|   323k|    opj_tgt_node_t *node = 00;
   54|   323k|    opj_tgt_node_t *l_parent_node = 00;
   55|   323k|    opj_tgt_node_t *l_parent_node0 = 00;
   56|   323k|    opj_tgt_tree_t *tree = 00;
   57|   323k|    OPJ_UINT32 i;
   58|   323k|    OPJ_INT32  j, k;
   59|   323k|    OPJ_UINT32 numlvls;
   60|   323k|    OPJ_UINT32 n;
   61|       |
   62|   323k|    tree = (opj_tgt_tree_t *) opj_calloc(1, sizeof(opj_tgt_tree_t));
   63|   323k|    if (!tree) {
  ------------------
  |  Branch (63:9): [True: 0, False: 323k]
  ------------------
   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|   323k|    tree->numleafsh = numleafsh;
   69|   323k|    tree->numleafsv = numleafsv;
   70|       |
   71|   323k|    numlvls = 0;
   72|   323k|    nplh[0] = (OPJ_INT32)numleafsh;
   73|   323k|    nplv[0] = (OPJ_INT32)numleafsv;
   74|   323k|    tree->numnodes = 0;
   75|  1.63M|    do {
   76|  1.63M|        n = (OPJ_UINT32)(nplh[numlvls] * nplv[numlvls]);
   77|  1.63M|        nplh[numlvls + 1] = (nplh[numlvls] + 1) / 2;
   78|  1.63M|        nplv[numlvls + 1] = (nplv[numlvls] + 1) / 2;
   79|  1.63M|        tree->numnodes += n;
   80|  1.63M|        ++numlvls;
   81|  1.63M|    } while (n > 1);
  ------------------
  |  Branch (81:14): [True: 1.31M, False: 323k]
  ------------------
   82|       |
   83|       |    /* ADD */
   84|   323k|    if (tree->numnodes == 0) {
  ------------------
  |  Branch (84:9): [True: 934, False: 322k]
  ------------------
   85|    934|        opj_free(tree);
   86|    934|        return 00;
   87|    934|    }
   88|       |
   89|   322k|    tree->nodes = (opj_tgt_node_t*) opj_calloc(tree->numnodes,
   90|   322k|                  sizeof(opj_tgt_node_t));
   91|   322k|    if (!tree->nodes) {
  ------------------
  |  Branch (91:9): [True: 0, False: 322k]
  ------------------
   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|   322k|    tree->nodes_size = tree->numnodes * (OPJ_UINT32)sizeof(opj_tgt_node_t);
   98|       |
   99|   322k|    node = tree->nodes;
  100|   322k|    l_parent_node = &tree->nodes[tree->numleafsh * tree->numleafsv];
  101|   322k|    l_parent_node0 = l_parent_node;
  102|       |
  103|  1.63M|    for (i = 0; i < numlvls - 1; ++i) {
  ------------------
  |  Branch (103:17): [True: 1.31M, False: 322k]
  ------------------
  104|  3.63M|        for (j = 0; j < nplv[i]; ++j) {
  ------------------
  |  Branch (104:21): [True: 2.32M, False: 1.31M]
  ------------------
  105|  2.32M|            k = nplh[i];
  106|  8.58M|            while (--k >= 0) {
  ------------------
  |  Branch (106:20): [True: 6.25M, False: 2.32M]
  ------------------
  107|  6.25M|                node->parent = l_parent_node;
  108|  6.25M|                ++node;
  109|  6.25M|                if (--k >= 0) {
  ------------------
  |  Branch (109:21): [True: 5.26M, False: 990k]
  ------------------
  110|  5.26M|                    node->parent = l_parent_node;
  111|  5.26M|                    ++node;
  112|  5.26M|                }
  113|  6.25M|                ++l_parent_node;
  114|  6.25M|            }
  115|  2.32M|            if ((j & 1) || j == nplv[i] - 1) {
  ------------------
  |  Branch (115:17): [True: 515k, False: 1.81M]
  |  Branch (115:28): [True: 1.29M, False: 515k]
  ------------------
  116|  1.81M|                l_parent_node0 = l_parent_node;
  117|  1.81M|            } else {
  118|   515k|                l_parent_node = l_parent_node0;
  119|   515k|                l_parent_node0 += nplh[i];
  120|   515k|            }
  121|  2.32M|        }
  122|  1.31M|    }
  123|   322k|    node->parent = 0;
  124|   322k|    opj_tgt_reset(tree);
  125|   322k|    return tree;
  126|   322k|}
opj_tgt_init:
  138|    148|{
  139|    148|    OPJ_INT32 l_nplh[32];
  140|    148|    OPJ_INT32 l_nplv[32];
  141|    148|    opj_tgt_node_t *l_node = 00;
  142|    148|    opj_tgt_node_t *l_parent_node = 00;
  143|    148|    opj_tgt_node_t *l_parent_node0 = 00;
  144|    148|    OPJ_UINT32 i;
  145|    148|    OPJ_INT32 j, k;
  146|    148|    OPJ_UINT32 l_num_levels;
  147|    148|    OPJ_UINT32 n;
  148|    148|    OPJ_UINT32 l_node_size;
  149|       |
  150|    148|    if (! p_tree) {
  ------------------
  |  Branch (150:9): [True: 0, False: 148]
  ------------------
  151|      0|        return 00;
  152|      0|    }
  153|       |
  154|    148|    if ((p_tree->numleafsh != p_num_leafs_h) ||
  ------------------
  |  Branch (154:9): [True: 0, False: 148]
  ------------------
  155|    148|            (p_tree->numleafsv != p_num_leafs_v)) {
  ------------------
  |  Branch (155:13): [True: 24, False: 124]
  ------------------
  156|     24|        p_tree->numleafsh = p_num_leafs_h;
  157|     24|        p_tree->numleafsv = p_num_leafs_v;
  158|       |
  159|     24|        l_num_levels = 0;
  160|     24|        l_nplh[0] = (OPJ_INT32)p_num_leafs_h;
  161|     24|        l_nplv[0] = (OPJ_INT32)p_num_leafs_v;
  162|     24|        p_tree->numnodes = 0;
  163|     24|        do {
  164|     24|            n = (OPJ_UINT32)(l_nplh[l_num_levels] * l_nplv[l_num_levels]);
  165|     24|            l_nplh[l_num_levels + 1] = (l_nplh[l_num_levels] + 1) / 2;
  166|     24|            l_nplv[l_num_levels + 1] = (l_nplv[l_num_levels] + 1) / 2;
  167|     24|            p_tree->numnodes += n;
  168|     24|            ++l_num_levels;
  169|     24|        } while (n > 1);
  ------------------
  |  Branch (169:18): [True: 0, False: 24]
  ------------------
  170|       |
  171|       |        /* ADD */
  172|     24|        if (p_tree->numnodes == 0) {
  ------------------
  |  Branch (172:13): [True: 0, False: 24]
  ------------------
  173|      0|            opj_tgt_destroy(p_tree);
  174|      0|            return 00;
  175|      0|        }
  176|     24|        l_node_size = p_tree->numnodes * (OPJ_UINT32)sizeof(opj_tgt_node_t);
  177|       |
  178|     24|        if (l_node_size > p_tree->nodes_size) {
  ------------------
  |  Branch (178:13): [True: 0, False: 24]
  ------------------
  179|      0|            opj_tgt_node_t* new_nodes = (opj_tgt_node_t*) opj_realloc(p_tree->nodes,
  180|      0|                                        l_node_size);
  181|      0|            if (! new_nodes) {
  ------------------
  |  Branch (181:17): [True: 0, False: 0]
  ------------------
  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|      0|            p_tree->nodes = new_nodes;
  188|      0|            memset(((char *) p_tree->nodes) + p_tree->nodes_size, 0,
  189|      0|                   l_node_size - p_tree->nodes_size);
  190|      0|            p_tree->nodes_size = l_node_size;
  191|      0|        }
  192|     24|        l_node = p_tree->nodes;
  193|     24|        l_parent_node = &p_tree->nodes[p_tree->numleafsh * p_tree->numleafsv];
  194|     24|        l_parent_node0 = l_parent_node;
  195|       |
  196|     24|        for (i = 0; i < l_num_levels - 1; ++i) {
  ------------------
  |  Branch (196:21): [True: 0, False: 24]
  ------------------
  197|      0|            for (j = 0; j < l_nplv[i]; ++j) {
  ------------------
  |  Branch (197:25): [True: 0, False: 0]
  ------------------
  198|      0|                k = l_nplh[i];
  199|      0|                while (--k >= 0) {
  ------------------
  |  Branch (199:24): [True: 0, False: 0]
  ------------------
  200|      0|                    l_node->parent = l_parent_node;
  201|      0|                    ++l_node;
  202|      0|                    if (--k >= 0) {
  ------------------
  |  Branch (202:25): [True: 0, False: 0]
  ------------------
  203|      0|                        l_node->parent = l_parent_node;
  204|      0|                        ++l_node;
  205|      0|                    }
  206|      0|                    ++l_parent_node;
  207|      0|                }
  208|      0|                if ((j & 1) || j == l_nplv[i] - 1) {
  ------------------
  |  Branch (208:21): [True: 0, False: 0]
  |  Branch (208:32): [True: 0, False: 0]
  ------------------
  209|      0|                    l_parent_node0 = l_parent_node;
  210|      0|                } else {
  211|      0|                    l_parent_node = l_parent_node0;
  212|      0|                    l_parent_node0 += l_nplh[i];
  213|      0|                }
  214|      0|            }
  215|      0|        }
  216|     24|        l_node->parent = 0;
  217|     24|    }
  218|    148|    opj_tgt_reset(p_tree);
  219|       |
  220|    148|    return p_tree;
  221|    148|}
opj_tgt_destroy:
  224|   323k|{
  225|   323k|    if (! p_tree) {
  ------------------
  |  Branch (225:9): [True: 902, False: 322k]
  ------------------
  226|    902|        return;
  227|    902|    }
  228|       |
  229|   322k|    if (p_tree->nodes) {
  ------------------
  |  Branch (229:9): [True: 322k, False: 0]
  ------------------
  230|   322k|        opj_free(p_tree->nodes);
  231|   322k|        p_tree->nodes = 00;
  232|   322k|    }
  233|   322k|    opj_free(p_tree);
  234|   322k|}
opj_tgt_reset:
  237|   438k|{
  238|   438k|    OPJ_UINT32 i;
  239|   438k|    opj_tgt_node_t * l_current_node = 00;;
  240|       |
  241|   438k|    if (! p_tree) {
  ------------------
  |  Branch (241:9): [True: 0, False: 438k]
  ------------------
  242|      0|        return;
  243|      0|    }
  244|       |
  245|   438k|    l_current_node = p_tree->nodes;
  246|  16.3M|    for (i = 0; i < p_tree->numnodes; ++i) {
  ------------------
  |  Branch (246:17): [True: 15.9M, False: 438k]
  ------------------
  247|  15.9M|        l_current_node->value = 999;
  248|  15.9M|        l_current_node->low = 0;
  249|  15.9M|        l_current_node->known = 0;
  250|  15.9M|        ++l_current_node;
  251|  15.9M|    }
  252|   438k|}
opj_tgt_decode:
  309|  10.3k|{
  310|  10.3k|    opj_tgt_node_t *stk[31];
  311|  10.3k|    opj_tgt_node_t **stkptr;
  312|  10.3k|    opj_tgt_node_t *node;
  313|  10.3k|    OPJ_INT32 low;
  314|       |
  315|  10.3k|    stkptr = stk;
  316|  10.3k|    node = &tree->nodes[leafno];
  317|  47.3k|    while (node->parent) {
  ------------------
  |  Branch (317:12): [True: 37.0k, False: 10.3k]
  ------------------
  318|  37.0k|        *stkptr++ = node;
  319|  37.0k|        node = node->parent;
  320|  37.0k|    }
  321|       |
  322|  10.3k|    low = 0;
  323|  47.3k|    for (;;) {
  324|  47.3k|        if (low > node->low) {
  ------------------
  |  Branch (324:13): [True: 5.87k, False: 41.4k]
  ------------------
  325|  5.87k|            node->low = low;
  326|  41.4k|        } else {
  327|  41.4k|            low = node->low;
  328|  41.4k|        }
  329|  53.3k|        while (low < threshold && low < node->value) {
  ------------------
  |  Branch (329:16): [True: 19.1k, False: 34.1k]
  |  Branch (329:35): [True: 5.93k, False: 13.1k]
  ------------------
  330|  5.93k|            if (opj_bio_read(bio, 1)) {
  ------------------
  |  Branch (330:17): [True: 1.61k, False: 4.31k]
  ------------------
  331|  1.61k|                node->value = low;
  332|  4.31k|            } else {
  333|  4.31k|                ++low;
  334|  4.31k|            }
  335|  5.93k|        }
  336|  47.3k|        node->low = low;
  337|  47.3k|        if (stkptr == stk) {
  ------------------
  |  Branch (337:13): [True: 10.3k, False: 37.0k]
  ------------------
  338|  10.3k|            break;
  339|  10.3k|        }
  340|  37.0k|        node = *--stkptr;
  341|  37.0k|    }
  342|       |
  343|  10.3k|    return (node->value < threshold) ? 1 : 0;
  ------------------
  |  Branch (343:12): [True: 1.03k, False: 9.31k]
  ------------------
  344|  10.3k|}

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

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

